|
From: <sv...@va...> - 2014-09-14 22:20:02
|
Author: florian
Date: Sun Sep 14 22:19:52 2014
New Revision: 14536
Log:
Document that VG_(newRangeMap) never returns NULL.
Remove pointless asserts.
Modified:
trunk/coregrind/m_rangemap.c
trunk/include/pub_tool_rangemap.h
trunk/memcheck/mc_main.c
Modified: trunk/coregrind/m_rangemap.c
==============================================================================
--- trunk/coregrind/m_rangemap.c (original)
+++ trunk/coregrind/m_rangemap.c Sun Sep 14 22:19:52 2014
@@ -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,
Modified: trunk/include/pub_tool_rangemap.h
==============================================================================
--- trunk/include/pub_tool_rangemap.h (original)
+++ trunk/include/pub_tool_rangemap.h Sun Sep 14 22:19:52 2014
@@ -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*),
Modified: trunk/memcheck/mc_main.c
==============================================================================
--- trunk/memcheck/mc_main.c (original)
+++ trunk/memcheck/mc_main.c Sun Sep 14 22:19:52 2014
@@ -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 )
|