changeset 39999:d8b00b7465aa

Fix comments. * lib/gl_list.h (gl_list_free): Clarify what it does. * lib/gl_oset.h (gl_oset_free): Likewise. * lib/gl_set.h (gl_set_free): Likewise. * lib/gl_anytree_oset.h (gl_tree_search_atleast): Fix typo in comment. * lib/gl_array_oset.c (gl_array_search_atleast): Likewise. * lib/gl_anyavltree_list1.h (MAXHEIGHT): Likewise. * lib/gl_avltree_oset.c (MAXHEIGHT): Likewise.
author Bruno Haible <bruno@clisp.org>
date Sat, 08 Dec 2018 15:25:51 +0100
parents cbf29fad7b78
children 5361c721aa56
files ChangeLog lib/gl_anyavltree_list1.h lib/gl_anytree_oset.h lib/gl_array_oset.c lib/gl_avltree_oset.c lib/gl_list.h lib/gl_oset.h lib/gl_set.h
diffstat 8 files changed, 28 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Dec 04 00:57:58 2018 +0100
+++ b/ChangeLog	Sat Dec 08 15:25:51 2018 +0100
@@ -1,3 +1,14 @@
+2018-12-08  Bruno Haible  <bruno@clisp.org>
+
+	Fix comments.
+	* lib/gl_list.h (gl_list_free): Clarify what it does.
+	* lib/gl_oset.h (gl_oset_free): Likewise.
+	* lib/gl_set.h (gl_set_free): Likewise.
+	* lib/gl_anytree_oset.h (gl_tree_search_atleast): Fix typo in comment.
+	* lib/gl_array_oset.c (gl_array_search_atleast): Likewise.
+	* lib/gl_anyavltree_list1.h (MAXHEIGHT): Likewise.
+	* lib/gl_avltree_oset.c (MAXHEIGHT): Likewise.
+
 2018-12-03  Bruno Haible  <bruno@clisp.org>
 
 	hash-set: Add tests.
--- a/lib/gl_anyavltree_list1.h	Tue Dec 04 00:57:58 2018 +0100
+++ b/lib/gl_anyavltree_list1.h	Sat Dec 08 15:25:51 2018 +0100
@@ -62,9 +62,9 @@
   struct gl_list_node_impl *root;   /* root node or NULL */
 };
 
-/* An AVL tree of height h has at least F_(h+2) [Fibonacci number] and at most
-   2^h - 1 elements.  So, h <= 84 (because a tree of height h >= 85 would have
-   at least F_87 elements, and because even on 64-bit machines,
-     sizeof (gl_list_node_impl) * F_87 > 2^64
+/* An AVL tree of height h has at least F_(h+2) - 1 [Fibonacci number] and at
+   most 2^h - 1 elements.  So, h <= 84 (because a tree of height h >= 85 would
+   have at least F_87 - 1 elements, and because even on 64-bit machines,
+     sizeof (gl_list_node_impl) * (F_87 - 1) > 2^64
    this would exceed the address space of the machine.  */
 #define MAXHEIGHT 83
--- a/lib/gl_anytree_oset.h	Tue Dec 04 00:57:58 2018 +0100
+++ b/lib/gl_anytree_oset.h	Sat Dec 08 15:25:51 2018 +0100
@@ -91,7 +91,7 @@
         node = node->right;
       else
         {
-          /* We have an element >= VALUE.  But we need the leftmost such
+          /* We have an element >= THRESHOLD.  But we need the leftmost such
              element.  */
           gl_oset_node_t found = node;
           node = node->left;
--- a/lib/gl_array_oset.c	Tue Dec 04 00:57:58 2018 +0100
+++ b/lib/gl_array_oset.c	Sat Dec 08 15:25:51 2018 +0100
@@ -136,7 +136,7 @@
                  minimal such index.  */
               high = mid;
               /* At each loop iteration, low <= high and
-                   compar (list->elements[high], value) >= 0,
+                   compar (set->elements[high], threshold) >= 0,
                  and we know that the first occurrence of the element is at
                  low <= position <= high.  */
               while (low < high)
--- a/lib/gl_avltree_oset.c	Tue Dec 04 00:57:58 2018 +0100
+++ b/lib/gl_avltree_oset.c	Sat Dec 08 15:25:51 2018 +0100
@@ -59,10 +59,10 @@
   size_t count;                     /* number of nodes */
 };
 
-/* An AVL tree of height h has at least F_(h+2) [Fibonacci number] and at most
-   2^h - 1 elements.  So, h <= 84 (because a tree of height h >= 85 would have
-   at least F_87 elements, and because even on 64-bit machines,
-     sizeof (gl_oset_node_impl) * F_87 > 2^64
+/* An AVL tree of height h has at least F_(h+2) - 1 [Fibonacci number] and at
+   most 2^h - 1 elements.  So, h <= 84 (because a tree of height h >= 85 would
+   have at least F_87 - 1 elements, and because even on 64-bit machines,
+     sizeof (gl_oset_node_impl) * (F_87 - 1) > 2^64
    this would exceed the address space of the machine.  */
 #define MAXHEIGHT 83
 
--- a/lib/gl_list.h	Tue Dec 04 00:57:58 2018 +0100
+++ b/lib/gl_list.h	Sat Dec 08 15:25:51 2018 +0100
@@ -333,7 +333,9 @@
 extern bool gl_list_remove (gl_list_t list, const void *elt);
 
 /* Free an entire list.
-   (But this call does not free the elements of the list.)  */
+   (But this call does not free the elements of the list.  It only invokes
+   the DISPOSE_FN on each of the elements of the list, and only if the list
+   is not a sublist.)  */
 extern void gl_list_free (gl_list_t list);
 
 #endif /* End of inline and gl_xlist.h-defined functions.  */
--- a/lib/gl_oset.h	Tue Dec 04 00:57:58 2018 +0100
+++ b/lib/gl_oset.h	Sat Dec 08 15:25:51 2018 +0100
@@ -144,7 +144,8 @@
 extern bool gl_oset_remove (gl_oset_t set, const void *elt);
 
 /* Free an entire ordered set.
-   (But this call does not free the elements of the set.)  */
+   (But this call does not free the elements of the set.  It only invokes
+   the DISPOSE_FN on each of the elements of the set.)  */
 extern void gl_oset_free (gl_oset_t set);
 
 #endif /* End of inline and gl_xoset.h-defined functions.  */
--- a/lib/gl_set.h	Tue Dec 04 00:57:58 2018 +0100
+++ b/lib/gl_set.h	Sat Dec 08 15:25:51 2018 +0100
@@ -136,7 +136,8 @@
 extern bool gl_set_remove (gl_set_t set, const void *elt);
 
 /* Free an entire set.
-   (But this call does not free the elements of the set.)  */
+   (But this call does not free the elements of the set.  It only invokes
+   the DISPOSE_FN on each of the elements of the set.)  */
 extern void gl_set_free (gl_set_t set);
 
 #endif /* End of inline and gl_xset.h-defined functions.  */