X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgtree.c;h=d67629f8c34709b00686b95f5b869918b2936dbf;hb=147c398cd05d71fb172d3788b9dc576c67141811;hp=17bfb824f58c9b1abc46444b8414bf286ee047e1;hpb=5e3c122e6c1fb35ed1a2cb0b76e62a519251fb33;p=platform%2Fupstream%2Fglib2.0.git diff --git a/glib/gtree.c b/glib/gtree.c index 17bfb82..d67629f 100644 --- a/glib/gtree.c +++ b/glib/gtree.c @@ -30,11 +30,14 @@ #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 @@ -92,8 +95,8 @@ struct _GTreeNode 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; }; @@ -1001,23 +1004,23 @@ g_tree_traverse (GTree *tree, /** * 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, @@ -1251,7 +1254,6 @@ g_tree_node_rotate_left (GTreeNode *node) else { node->right_child = FALSE; - node->right = right; right->left_child = TRUE; } right->left = node; @@ -1293,7 +1295,6 @@ g_tree_node_rotate_right (GTreeNode *node) else { node->left_child = FALSE; - node->left = left; left->right_child = TRUE; } left->right = node; @@ -1410,8 +1411,3 @@ g_tree_dump (GTree *tree) g_tree_node_dump (tree->root, 0); } #endif - - -#define __G_TREE_C__ -#include "galiasdef.c" -