]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Document that VG_(newRangeMap) never returns NULL.
authorFlorian Krohm <florian@eich-krohm.de>
Sun, 14 Sep 2014 22:19:52 +0000 (22:19 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Sun, 14 Sep 2014 22:19:52 +0000 (22:19 +0000)
Remove pointless asserts.

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

coregrind/m_rangemap.c
include/pub_tool_rangemap.h
memcheck/mc_main.c

index b066fb92dde43ae3c439ca021b39bcbca15296fd..96c65373e53b5f5ab78ef1a14481d8def7828191 100644 (file)
@@ -48,9 +48,9 @@ typedef
 
 
 struct _RangeMap {
-   void* (*alloc) ( const HChar*, SizeT ); /* alloc fn (nofail) */
-   const HChar* cc;                 /* cost centre for alloc */
-   void  (*free) ( void* );         /* free fn */
+   void* (*alloc_fn) ( const HChar*, SizeT ); /* alloc fn (nofail) */
+   const HChar* cc;                    /* cost centre for alloc */
+   void  (*free_fn) ( void* );         /* free fn */
    XArray* ranges;
 };
 
@@ -71,10 +71,9 @@ RangeMap* VG_(newRangeMap) ( void*(*alloc_fn)(const HChar*,SizeT),
    vg_assert(alloc_fn);
    vg_assert(free_fn);
    RangeMap* rm = alloc_fn(cc, sizeof(RangeMap));
-   vg_assert(rm);
-   rm->alloc  = alloc_fn;
-   rm->cc     = cc;
-   rm->free   = free_fn;
+   rm->alloc_fn = alloc_fn;
+   rm->cc       = cc;
+   rm->free_fn  = free_fn;
    rm->ranges = VG_(newXA)( alloc_fn, cc, free_fn, sizeof(Range) );
    vg_assert(rm->ranges);
    /* Add the initial range */
@@ -92,10 +91,10 @@ RangeMap* VG_(newRangeMap) ( void*(*alloc_fn)(const HChar*,SizeT),
 void VG_(deleteRangeMap) ( RangeMap* rm )
 {
    vg_assert(rm);
-   vg_assert(rm->free);
+   vg_assert(rm->free_fn);
    vg_assert(rm->ranges);
    VG_(deleteXA)(rm->ranges);
-   rm->free(rm);
+   rm->free_fn(rm);
 }
 
 void VG_(bindRangeMap) ( RangeMap* rm,
index beb7198ede2f7e6b23fa6a8a95f05d569348d174..dba0fcfb3ef4636a26dcceb9527d72a239b15490 100644 (file)
 typedef  struct _RangeMap  RangeMap;
 
 /* Create a new RangeMap, using given allocation and free functions.
-   Alloc fn must not fail (that is, if it returns it must have
+   alloc_fn must not return NULL (that is, if it returns it must have
    succeeded.)  The new array will contain a single range covering the
-   entire key space, which will be bound to the value |initialVal|. */
+   entire key space, which will be bound to the value |initialVal|.
+   This function never returns NULL. */
 RangeMap* VG_(newRangeMap) ( void*(*alloc_fn)(const HChar*,SizeT), 
                              const HChar* cc,
                              void(*free_fn)(void*),
index 5526833d2177415d8c463b43269d73a896e15503..e39817effc5c2bfbdef90b4e8c10715e696106d3 100644 (file)
@@ -1088,7 +1088,6 @@ static void init_gIgnoredAddressRanges ( void )
       return;
    gIgnoredAddressRanges = VG_(newRangeMap)( VG_(malloc), "mc.igIAR.1",
                                              VG_(free), IAR_NotIgnored );
-   tl_assert(gIgnoredAddressRanges != NULL);
 }
 
 INLINE Bool MC_(in_ignored_range) ( Addr a )