#include "config.h"
-#include "glib.h"
-#include "galias.h"
+#include "gtree.h"
+
+#include "gatomic.h"
+#include "gtestutils.h"
+#include "gslice.h"
/**
- * SECTION: trees-binary
+ * SECTION:trees-binary
* @title: Balanced Binary Trees
* @short_description: a sorted collection of key/value pairs optimized
* for searching and traversing in order
gpointer value; /* value stored at this node */
GTreeNode *left; /* left subtree */
GTreeNode *right; /* right subtree */
- gint8 balance; /* height (left) - height (right) */
- guint8 left_child;
+ gint8 balance; /* height (right) - height (left) */
+ guint8 left_child;
guint8 right_child;
};
/**
* g_tree_search:
- * @tree: a #GTree.
- * @search_func: a function used to search the #GTree.
- * @user_data: the data passed as the second argument to the @search_func
- * function.
- *
+ * @tree: a #GTree
+ * @search_func: a function used to search the #GTree
+ * @user_data: the data passed as the second argument to @search_func
+ *
* Searches a #GTree using @search_func.
*
- * The @search_func is called with a pointer to the key of a key/value pair in
- * the tree, and the passed in @user_data. If @search_func returns 0 for a
- * key/value pair, then g_tree_search_func() will return the value of that
- * pair. If @search_func returns -1, searching will proceed among the
- * key/value pairs that have a smaller key; if @search_func returns 1,
- * searching will proceed among the key/value pairs that have a larger key.
+ * The @search_func is called with a pointer to the key of a key/value
+ * pair in the tree, and the passed in @user_data. If @search_func returns
+ * 0 for a key/value pair, then the corresponding value is returned as
+ * the result of g_tree_search(). If @search_func returns -1, searching
+ * will proceed among the key/value pairs that have a smaller key; if
+ * @search_func returns 1, searching will proceed among the key/value
+ * pairs that have a larger key.
*
- * Return value: the value corresponding to the found key, or %NULL if the key
- * was not found.
- **/
+ * Return value: the value corresponding to the found key, or %NULL if
+ * the key was not found.
+ */
gpointer
g_tree_search (GTree *tree,
GCompareFunc search_func,
else
{
node->right_child = FALSE;
- node->right = right;
right->left_child = TRUE;
}
right->left = node;
else
{
node->left_child = FALSE;
- node->left = left;
left->right_child = TRUE;
}
left->right = node;
g_tree_node_dump (tree->root, 0);
}
#endif
-
-
-#define __G_TREE_C__
-#include "galiasdef.c"
-