X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgl_anytree_list1.h;h=4999c96fa9ffd692eac4798d26d262dbce230c3c;hb=1b5bc6ed268e3f86e5fab50eb42794400e29ea2f;hp=c73a4f139d16b4d08da48bf2b8d1651a440e2857;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/gl_anytree_list1.h b/lib/gl_anytree_list1.h index c73a4f139..4999c96fa 100644 --- a/lib/gl_anytree_list1.h +++ b/lib/gl_anytree_list1.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a binary tree. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify @@ -27,3 +27,15 @@ typedef struct /* A stack used for iterating across the elements. */ typedef iterstack_item_t iterstack_t[MAXHEIGHT]; + +/* Free a non-empty subtree recursively. + This function is recursive and therefore not very fast. */ +static void +free_subtree (gl_list_node_t node) +{ + if (node->left != NULL) + free_subtree (node->left); + if (node->right != NULL) + free_subtree (node->right); + free (node); +}