X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgnode.c;h=b529f48dc224ed6e9b82e5a7600abe23a3a06c2a;hb=49b59e5ac4428a6a99a85d699c3662f96efc4e9d;hp=7d3dfceb6f7f67d45196d5dedb9dbe63742bf775;hpb=73007021796f33d7ccec4e5f2bb2b2f8660347f2;p=platform%2Fupstream%2Fglib.git
diff --git a/glib/gnode.c b/glib/gnode.c
index 7d3dfce..b529f48 100644
--- a/glib/gnode.c
+++ b/glib/gnode.c
@@ -15,29 +15,30 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see .
*/
/*
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
-/*
+/*
* MT safe
*/
#include "config.h"
-#include "glib.h"
-#include "galias.h"
+#include "gnode.h"
+
+#include "gslice.h"
+
+#include "gtestutils.h"
/**
- * SECTION: trees-nary
+ * SECTION:trees-nary
* @title: N-ary Trees
* @short_description: trees of data with any number of branches
*
@@ -50,8 +51,9 @@
* g_node_insert_before(), g_node_append() and g_node_prepend().
*
* To create a new node and insert it into a tree use
- * g_node_insert_data(), g_node_insert_data_before(),
- * g_node_append_data() and g_node_prepend_data().
+ * g_node_insert_data(), g_node_insert_data_after(),
+ * g_node_insert_data_before(), g_node_append_data()
+ * and g_node_prepend_data().
*
* To reverse the children of a node use g_node_reverse_children().
*
@@ -84,41 +86,9 @@
* children are accessed by using the @next pointer of each
* child.
*
- * The #GNode struct represents one node in a
- * N-ary Tree. fields
+ * The #GNode struct represents one node in a [n-ary tree][glib-N-ary-Trees].
**/
-/**
- * g_node_push_allocator:
- * @dummy: the #GAllocator to use when allocating #GNode elements.
- *
- * Sets the allocator to use to allocate #GNode elements. Use
- * g_node_pop_allocator() to restore the previous allocator.
- *
- * Note that this function is not available if GLib has been compiled
- * with
- *
- * Deprecated:2.10: It does nothing, since #GNode has been converted to
- * the slice
- * allocator
- **/
-void g_node_push_allocator (gpointer dummy) { /* present for binary compat only */ }
-
-/**
- * g_node_pop_allocator:
- *
- * Restores the previous #GAllocator, used when allocating #GNode
- * elements.
- *
- * Note that this function is not available if GLib has been compiled
- * with
- *
- * Deprecated:2.10: It does nothing, since #GNode has been converted to
- * the slice
- * allocator
- **/
-void g_node_pop_allocator (void) { /* present for binary compat only */ }
-
#define g_node_alloc0() g_slice_new0 (GNode)
#define g_node_free(node) g_slice_free (GNode, node)
@@ -204,7 +174,7 @@ g_node_unlink (GNode *node)
*
* Recursively copies a #GNode and its data.
*
- * Return value: a new #GNode containing copies of the data in @node.
+ * Returns: a new #GNode containing copies of the data in @node.
*
* Since: 2.4
**/
@@ -847,6 +817,35 @@ g_node_depth_traverse_level (GNode *node,
* It calls the given function for each node visited.
* The traversal can be halted at any point by returning %TRUE from @func.
*/
+
+/**
+ * GTraverseType:
+ * @G_IN_ORDER: vists a node's left child first, then the node itself,
+ * then its right child. This is the one to use if you
+ * want the output sorted according to the compare
+ * function.
+ * @G_PRE_ORDER: visits a node, then its children.
+ * @G_POST_ORDER: visits the node's children, then the node itself.
+ * @G_LEVEL_ORDER: is not implemented for
+ * [balanced binary trees][glib-Balanced-Binary-Trees].
+ * For [n-ary trees][glib-N-ary-Trees], it
+ * vists the root node first, then its children, then
+ * its grandchildren, and so on. Note that this is less
+ * efficient than the other orders.
+ *
+ * Specifies the type of traveral performed by g_tree_traverse(),
+ * g_node_traverse() and g_node_find(). The different orders are
+ * illustrated here:
+ * - In order: A, B, C, D, E, F, G, H, I
+ * ![](Sorted_binary_tree_inorder.svg)
+ * - Pre order: F, B, A, D, C, E, G, I, H
+ * ![](Sorted_binary_tree_preorder.svg)
+ * - Post order: A, C, E, D, B, H, I, G, F
+ * ![](Sorted_binary_tree_postorder.svg)
+ * - Level order: F, B, G, A, D, I, C, E, H
+ * ![](Sorted_binary_tree_breadth-first_traversal.svg)
+ */
+
/**
* GTraverseFlags:
* @G_TRAVERSE_LEAVES: only leaf nodes should be visited. This name has
@@ -867,12 +866,13 @@ g_node_depth_traverse_level (GNode *node,
* GNodeTraverseFunc:
* @node: a #GNode.
* @data: user data passed to g_node_traverse().
- * @Returns: %TRUE to stop the traversal.
*
* Specifies the type of function passed to g_node_traverse(). The
* function is called with each of the nodes visited, together with the
* user data passed to g_node_traverse(). If the function returns
* %TRUE, then the traversal is stopped.
+ *
+ * Returns: %TRUE to stop the traversal.
**/
void
g_node_traverse (GNode *root,
@@ -1276,6 +1276,3 @@ g_node_children_foreach (GNode *node,
}
}
}
-
-#define __G_NODE_C__
-#include "galiasdef.c"