X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgl_anytree_list1.h;h=bebfd934003017760c2038b7bf695240f827cb14;hb=87f8903d4b15b30b6b3da2c0632fef3e626129fd;hp=c73a4f139d16b4d08da48bf2b8d1651a440e2857;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/gl_anytree_list1.h b/lib/gl_anytree_list1.h index c73a4f139..bebfd9340 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 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); +}