]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Document the NULL-ness of the return values of HT_construct and HT_to_array.
authorFlorian Krohm <florian@eich-krohm.de>
Sat, 13 Sep 2014 22:31:13 +0000 (22:31 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Sat, 13 Sep 2014 22:31:13 +0000 (22:31 +0000)
Audit call sites.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14532

drd/drd_malloc_wrappers.c
include/pub_tool_hashtable.h

index 4e1cfc279dd0229acb67f47cd10daa4ed3f06627..0f9896467e2ee4d74800408bdca6a5350d2754be 100644 (file)
@@ -293,7 +293,6 @@ void DRD_(register_malloc_wrappers)(const StartUsingMem start_callback,
 {
    tl_assert(s_malloc_list == 0);
    s_malloc_list = VG_(HT_construct)("drd_malloc_list");
-   tl_assert(s_malloc_list);
    tl_assert(start_callback);
    tl_assert(stop_callback);
 
index d640c39e478d997923a96ebd7a9e259970895f67..21dd0b234a13643d07ed8a8f20c1d97bbbf3977c 100644 (file)
@@ -54,7 +54,7 @@ typedef struct _VgHashTable * VgHashTable;
 /* Make a new table.  Allocates the memory with VG_(calloc)(), so can
    be freed with VG_(free)().  The table starts small but will
    periodically be expanded.  This is transparent to the users of this
-   module. */
+   module. The function never returns NULL. */
 extern VgHashTable VG_(HT_construct) ( const HChar* name );
 
 /* Count the number of nodes in a table. */
@@ -95,7 +95,8 @@ extern void VG_(HT_print_stats) ( VgHashTable table, HT_Cmp_t cmp );
 
 /* Allocates a suitably-sized array, copies pointers to all the hashtable
    elements into it, then returns both the array and the size of it.  The
-   array must be freed with VG_(free). */
+   array must be freed with VG_(free). If the hashtable is empty, the
+   function returns NULL and assigns *nelems = 0. */
 extern VgHashNode** VG_(HT_to_array) ( VgHashTable t, /*OUT*/ UInt* n_elems );
 
 /* Reset the table's iterator to point to the first element. */