From: Florian Krohm Date: Sun, 14 Sep 2014 22:19:52 +0000 (+0000) Subject: Document that VG_(newRangeMap) never returns NULL. X-Git-Tag: svn/VALGRIND_3_11_0~996 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17f4960a2c52fb6a8680ab75be349c5cc151f5ba;p=thirdparty%2Fvalgrind.git Document that VG_(newRangeMap) never returns NULL. Remove pointless asserts. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14536 --- diff --git a/coregrind/m_rangemap.c b/coregrind/m_rangemap.c index b066fb92dd..96c65373e5 100644 --- a/coregrind/m_rangemap.c +++ b/coregrind/m_rangemap.c @@ -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, diff --git a/include/pub_tool_rangemap.h b/include/pub_tool_rangemap.h index beb7198ede..dba0fcfb3e 100644 --- a/include/pub_tool_rangemap.h +++ b/include/pub_tool_rangemap.h @@ -43,9 +43,10 @@ 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*), diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 5526833d21..e39817effc 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -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 )