Document that VG_(newRangeMap) never returns NULL.
Remove pointless asserts.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14536 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_rangemap.c b/coregrind/m_rangemap.c
index b066fb9..96c6537 100644
--- a/coregrind/m_rangemap.c
+++ b/coregrind/m_rangemap.c
@@ -48,9 +48,9 @@
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 @@
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 @@
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 beb7198..dba0fcf 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 5526833..e39817e 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -1088,7 +1088,6 @@
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 )