/* PSPP - a program for statistical analysis.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <config.h>
#endif
-#include <libpspp/bt.h>
+#include "libpspp/bt.h"
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
+#include "libpspp/cast.h"
+
static void rebalance_subtree (struct bt *, struct bt_node *, size_t);
static struct bt_node **down_link (struct bt *, struct bt_node *);
/* Initializes BT as an empty BT that uses the given COMPARE
function, passing in AUX as auxiliary data. */
void
-bt_init (struct bt *bt,
- bt_compare_func *compare,
- const void *aux)
+bt_init (struct bt *bt, bt_compare_func *compare, const void *aux)
{
bt->root = NULL;
bt->compare = compare;
{
cmp = bt->compare (target, p, bt->aux);
if (cmp == 0)
- return (struct bt_node *) p;
+ return CONST_CAST (struct bt_node *, p);
}
return NULL;
break;
}
}
- return (struct bt_node *) q;
+ return CONST_CAST (struct bt_node *, q);
}
/* Searches BT for, and returns, the last node in in-order whose
break;
}
}
- return (struct bt_node *) q;
+ return CONST_CAST (struct bt_node *, q);
}
/* Returns the node in BT following P in in-order.
p = p->down[1];
while (p->down[0] != NULL)
p = p->down[0];
- return (struct bt_node *) p;
+ return CONST_CAST (struct bt_node *, p);
}
}
p = p->down[0];
while (p->down[1] != NULL)
p = p->down[1];
- return (struct bt_node *) p;
+ return CONST_CAST (struct bt_node *, p);
}
}