aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>2014-09-15 18:50:17 +0000
committerflorian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>2014-09-15 18:50:17 +0000
commit91ed8ccd3dae8a6abfaa45cc0d250df47b45187f (patch)
treeed709f144a610bf37f228c364f86b18916435dae
parent5e1e9234daf0d106770fe34ee26bfd8c87cc0bdb (diff)
downloadvalgrind-91ed8ccd3dae8a6abfaa45cc0d250df47b45187f.tar.gz
Tidy up m_xarray.c.
VG_(newXA) and VG_(cloneXA) never return NULL. Remove pointless asserts. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14539 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r--coregrind/m_commandline.c3
-rw-r--r--coregrind/m_debuginfo/debuginfo.c1
-rw-r--r--coregrind/m_debuginfo/readdwarf.c3
-rw-r--r--coregrind/m_debuginfo/readdwarf3.c3
-rw-r--r--coregrind/m_debuginfo/readmacho.c1
-rw-r--r--coregrind/m_debuginfo/storage.c3
-rw-r--r--coregrind/m_debuginfo/tytypes.c1
-rw-r--r--coregrind/m_deduppoolalloc.c2
-rw-r--r--coregrind/m_errormgr.c1
-rw-r--r--coregrind/m_main.c1
-rw-r--r--coregrind/m_poolalloc.c2
-rw-r--r--coregrind/m_rangemap.c1
-rw-r--r--coregrind/m_xarray.c90
-rw-r--r--drd/drd_error.c2
-rw-r--r--helgrind/hg_main.c1
-rw-r--r--helgrind/libhb_core.c11
-rw-r--r--include/pub_tool_xarray.h12
17 files changed, 45 insertions, 93 deletions
diff --git a/coregrind/m_commandline.c b/coregrind/m_commandline.c
index 85e91b419..9f020fd5f 100644
--- a/coregrind/m_commandline.c
+++ b/coregrind/m_commandline.c
@@ -164,19 +164,16 @@ void VG_(split_up_argv)( Int argc, HChar** argv )
tmp_xarray = VG_(newXA)( VG_(malloc), "commandline.sua.1",
VG_(free), sizeof(HChar*) );
- vg_assert(tmp_xarray);
vg_assert( ! VG_(args_for_valgrind) );
VG_(args_for_valgrind)
= VG_(newXA)( VG_(malloc), "commandline.sua.2",
VG_(free), sizeof(HChar*) );
- vg_assert( VG_(args_for_valgrind) );
vg_assert( ! VG_(args_for_client) );
VG_(args_for_client)
= VG_(newXA)( VG_(malloc), "commandline.sua.3",
VG_(free), sizeof(HChar*) );
- vg_assert( VG_(args_for_client) );
/* Collect up the args-for-V. */
i = 1; /* skip the exe (stage2) name. */
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index 285f7c95f..ab11a5ab5 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -3953,7 +3953,6 @@ void* /* really, XArray* of GlobalBlock */
/* we'll put the collected variables in here. */
gvars = VG_(newXA)( ML_(dinfo_zalloc), "di.debuginfo.dggbfd.1",
ML_(dinfo_free), sizeof(GlobalBlock) );
- tl_assert(gvars);
/* any var info at all? */
if (!di->varinfo)
diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c
index 9a076968e..c8021d352 100644
--- a/coregrind/m_debuginfo/readdwarf.c
+++ b/coregrind/m_debuginfo/readdwarf.c
@@ -2073,7 +2073,6 @@ static Bool summarise_context(/*OUT*/Addr* base,
if (src && (VG_(sizeXA)(src) > 0) && (!dst)) {
dst = VG_(newXA)( ML_(dinfo_zalloc), "di.ccCt.1", ML_(dinfo_free),
sizeof(CfiExpr) );
- vg_assert(dst);
debuginfo->cfsi_exprs = dst;
}
conv = copy_convert_CfiExpr_tree
@@ -2152,7 +2151,6 @@ static Bool summarise_context(/*OUT*/Addr* base,
"di.ccCt.2", \
ML_(dinfo_free), \
sizeof(CfiExpr) ); \
- vg_assert(dst); \
debuginfo->cfsi_exprs = dst; \
} \
conv = copy_convert_CfiExpr_tree \
@@ -4125,7 +4123,6 @@ void ML_(read_callframe_info_dwarf3)
ctx.exprs = VG_(newXA)( ML_(dinfo_zalloc), "di.rcid.1",
ML_(dinfo_free),
sizeof(CfiExpr) );
- vg_assert(ctx.exprs);
/* Run the CIE's instructions. Ugly hack: if
--debug-dump=frames is in effect, suppress output for
diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
index a319bf31c..afc7b8bc6 100644
--- a/coregrind/m_debuginfo/readdwarf3.c
+++ b/coregrind/m_debuginfo/readdwarf3.c
@@ -4689,7 +4689,6 @@ void new_dwarf3_reader_wrk (
= VG_(newXA)( ML_(dinfo_zalloc), "di.readdwarf3.ndrw.5var",
ML_(dinfo_free),
sizeof(UInt) );
- vg_assert(varparser.fndn_ix_Table);
}
if (VG_(clo_read_inline_info)) {
@@ -4699,7 +4698,6 @@ void new_dwarf3_reader_wrk (
= VG_(newXA)( ML_(dinfo_zalloc), "di.readdwarf3.ndrw.5inl",
ML_(dinfo_free),
sizeof(UInt) );
- vg_assert(inlparser.fndn_ix_Table);
}
/* Now read the one-and-only top-level DIE for this CU. */
@@ -4855,7 +4853,6 @@ void new_dwarf3_reader_wrk (
= VG_(newXA)( ML_(dinfo_zalloc), "di.readdwarf3.ndrw.9",
ML_(dinfo_free),
sizeof(TempVar*) );
- vg_assert(dioff_lookup_tab);
n = VG_(sizeXA)( tempvars );
Word first_primary_var = 0;
diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c
index 27508178c..32be81957 100644
--- a/coregrind/m_debuginfo/readmacho.c
+++ b/coregrind/m_debuginfo/readmacho.c
@@ -930,7 +930,6 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di )
ML_(dinfo_zalloc), "di.readmacho.candsyms.1",
ML_(dinfo_free), sizeof(DiSym)
);
- vg_assert(candSyms);
// extern symbols
read_symtab(candSyms,
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
index 689a68f9b..efa04f35a 100644
--- a/coregrind/m_debuginfo/storage.c
+++ b/coregrind/m_debuginfo/storage.c
@@ -1053,7 +1053,6 @@ static void add_var_to_arange (
/* copy vars into it */
vg_assert(first->vars);
nyu->vars = VG_(cloneXA)( "di.storage.avta.1", first->vars );
- vg_assert(nyu->vars);
VG_(OSetGen_Insert)( scope, nyu );
first = nyu;
}
@@ -1082,7 +1081,6 @@ static void add_var_to_arange (
/* copy vars into it */
vg_assert(last->vars);
nyu->vars = VG_(cloneXA)( "di.storage.avta.2", last->vars );
- vg_assert(nyu->vars);
VG_(OSetGen_Insert)( scope, nyu );
last = nyu;
}
@@ -1272,7 +1270,6 @@ void ML_(addVar)( struct _DebugInfo* di,
nyu->vars = VG_(newXA)( ML_(dinfo_zalloc), "di.storage.addVar.3",
ML_(dinfo_free),
sizeof(DiVariable) );
- vg_assert(nyu->vars);
VG_(OSetGen_Insert)( scope, nyu );
}
diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c
index abf6c1856..d80876c55 100644
--- a/coregrind/m_debuginfo/tytypes.c
+++ b/coregrind/m_debuginfo/tytypes.c
@@ -754,7 +754,6 @@ XArray* /*HChar*/ ML_(describe_type)( /*OUT*/PtrdiffT* residual_offset,
XArray* xa = VG_(newXA)( ML_(dinfo_zalloc), "di.tytypes.dt.1",
ML_(dinfo_free),
sizeof(HChar) );
- vg_assert(xa);
ty = ML_(TyEnts__index_by_cuOff)(tyents, NULL, ty_cuOff);
diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c
index 8a203e88e..916f7e826 100644
--- a/coregrind/m_deduppoolalloc.c
+++ b/coregrind/m_deduppoolalloc.c
@@ -112,7 +112,7 @@ DedupPoolAlloc* VG_(newDedupPA) ( SizeT poolSzB,
ddpa->curpool = NULL;
ddpa->curpool_limit = NULL;
ddpa->curpool_free = NULL;
- vg_assert(ddpa->pools);
+
return ddpa;
}
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index e08cfc879..02bf0e4be 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -388,7 +388,6 @@ static void gen_suppression(Error* err)
mode. So generate it into TEXT. */
text = VG_(newXA)( VG_(malloc), "errormgr.gen_suppression.1",
VG_(free), sizeof(HChar) );
- vg_assert(text);
/* Ok. Generate the plain text version into TEXT. */
VG_(xaprintf)(text, "{\n");
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index a1e7a3a93..131ac4fb8 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -2115,7 +2115,6 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp )
tl_assert(!addr2dihandle);
addr2dihandle = VG_(newXA)( VG_(malloc), "main.vm.2",
VG_(free), sizeof(Addr_n_ULong) );
- tl_assert(addr2dihandle);
# if defined(VGO_linux)
{ Addr* seg_starts;
diff --git a/coregrind/m_poolalloc.c b/coregrind/m_poolalloc.c
index 544239de0..c9528e8c2 100644
--- a/coregrind/m_poolalloc.c
+++ b/coregrind/m_poolalloc.c
@@ -72,7 +72,7 @@ PoolAlloc* VG_(newPA) ( UWord elemSzB,
pa->free_fn = free_fn;
pa->pools = VG_(newXA)( alloc_fn, cc, free_fn, sizeof(void*) );
pa->nextFree = NULL;
- vg_assert(pa->pools);
+
return pa;
}
diff --git a/coregrind/m_rangemap.c b/coregrind/m_rangemap.c
index 96c65373e..dcb9b83d9 100644
--- a/coregrind/m_rangemap.c
+++ b/coregrind/m_rangemap.c
@@ -75,7 +75,6 @@ RangeMap* VG_(newRangeMap) ( void*(*alloc_fn)(const HChar*,SizeT),
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 */
Range r;
r.key_min = UWORD_MIN;
diff --git a/coregrind/m_xarray.c b/coregrind/m_xarray.c
index c440bfd3a..74ee63102 100644
--- a/coregrind/m_xarray.c
+++ b/coregrind/m_xarray.c
@@ -38,9 +38,9 @@
/* See pub_tool_xarray.h for details of what this is all about. */
struct _XArray {
- 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 */
Int (*cmpFn) ( const void*, const void* ); /* cmp fn (may be NULL) */
Word elemSzB; /* element size in bytes */
void* arr; /* pointer to elements */
@@ -55,7 +55,7 @@ XArray* VG_(newXA) ( void*(*alloc_fn)(const HChar*,SizeT),
void(*free_fn)(void*),
Word elemSzB )
{
- struct _XArray* xa;
+ XArray* xa;
/* Implementation relies on Word being signed and (possibly)
on SizeT being unsigned. */
vg_assert( sizeof(Word) == sizeof(void*) );
@@ -66,10 +66,9 @@ XArray* VG_(newXA) ( void*(*alloc_fn)(const HChar*,SizeT),
vg_assert(free_fn);
vg_assert(elemSzB > 0);
xa = alloc_fn( cc, sizeof(struct _XArray) );
- vg_assert(xa);
- xa->alloc = alloc_fn;
+ xa->alloc_fn = alloc_fn;
xa->cc = cc;
- xa->free = free_fn;
+ xa->free_fn = free_fn;
xa->cmpFn = NULL;
xa->elemSzB = elemSzB;
xa->usedsizeE = 0;
@@ -79,19 +78,17 @@ XArray* VG_(newXA) ( void*(*alloc_fn)(const HChar*,SizeT),
return xa;
}
-XArray* VG_(cloneXA)( const HChar* cc, XArray* xao )
+XArray* VG_(cloneXA)( const HChar* cc, XArray* xa )
{
- struct _XArray* xa = (struct _XArray*)xao;
- struct _XArray* nyu;
+ XArray* nyu;
const HChar* nyu_cc;
vg_assert(xa);
- vg_assert(xa->alloc);
- vg_assert(xa->free);
+ vg_assert(xa->alloc_fn);
+ vg_assert(xa->free_fn);
vg_assert(xa->elemSzB >= 1);
nyu_cc = cc ? cc : xa->cc;
- nyu = xa->alloc( nyu_cc, sizeof(struct _XArray) );
- if (!nyu)
- return NULL;
+ nyu = xa->alloc_fn( nyu_cc, sizeof(struct _XArray) );
+
/* Copy everything verbatim ... */
*nyu = *xa;
nyu->cc = nyu_cc;
@@ -104,46 +101,39 @@ XArray* VG_(cloneXA)( const HChar* cc, XArray* xao )
element is later added to it, unfortunately. */
nyu->totsizeE = nyu->usedsizeE;
/* and allocate .. */
- nyu->arr = nyu->alloc( nyu->cc, nyu->totsizeE * nyu->elemSzB );
- if (!nyu->arr) {
- nyu->free(nyu);
- return NULL;
- }
+ nyu->arr = nyu->alloc_fn( nyu->cc, nyu->totsizeE * nyu->elemSzB );
VG_(memcpy)( nyu->arr, xa->arr, nyu->totsizeE * nyu->elemSzB );
}
/* We're done! */
return nyu;
}
-void VG_(deleteXA) ( XArray* xao )
+void VG_(deleteXA) ( XArray* xa )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
- vg_assert(xa->free);
+ vg_assert(xa->free_fn);
if (xa->arr)
- xa->free(xa->arr);
- xa->free(xa);
+ xa->free_fn(xa->arr);
+ xa->free_fn(xa);
}
-void VG_(setCmpFnXA) ( XArray* xao, XACmpFn_t compar )
+void VG_(setCmpFnXA) ( XArray* xa, XACmpFn_t compar )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(compar);
xa->cmpFn = compar;
xa->sorted = False;
}
-inline void* VG_(indexXA) ( XArray* xao, Word n )
+inline void* VG_(indexXA) ( XArray* xa, Word n )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(n >= 0);
vg_assert(n < xa->usedsizeE);
return ((char*)xa->arr) + n * xa->elemSzB;
}
-static inline void ensureSpaceXA ( struct _XArray* xa )
+static inline void ensureSpaceXA ( XArray* xa )
{
if (xa->usedsizeE == xa->totsizeE) {
void* tmp;
@@ -167,20 +157,18 @@ static inline void ensureSpaceXA ( struct _XArray* xa )
if (0 && xa->totsizeE >= 10000)
VG_(printf)("addToXA: increasing from %ld to %ld\n",
xa->totsizeE, newsz);
- tmp = xa->alloc(xa->cc, newsz * xa->elemSzB);
- vg_assert(tmp);
+ tmp = xa->alloc_fn(xa->cc, newsz * xa->elemSzB);
if (xa->usedsizeE > 0)
VG_(memcpy)(tmp, xa->arr, xa->usedsizeE * xa->elemSzB);
if (xa->arr)
- xa->free(xa->arr);
+ xa->free_fn(xa->arr);
xa->arr = tmp;
xa->totsizeE = newsz;
}
}
-Word VG_(addToXA) ( XArray* xao, const void* elem )
+Word VG_(addToXA) ( XArray* xa, const void* elem )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(elem);
vg_assert(xa->totsizeE >= 0);
@@ -195,10 +183,9 @@ Word VG_(addToXA) ( XArray* xao, const void* elem )
return xa->usedsizeE-1;
}
-Word VG_(addBytesToXA) ( XArray* xao, const void* bytesV, Word nbytes )
+Word VG_(addBytesToXA) ( XArray* xa, const void* bytesV, Word nbytes )
{
Word r, i;
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(xa->elemSzB == 1);
vg_assert(nbytes >= 0);
@@ -216,22 +203,20 @@ Word VG_(addBytesToXA) ( XArray* xao, const void* bytesV, Word nbytes )
return r;
}
-void VG_(sortXA) ( XArray* xao )
+void VG_(sortXA) ( XArray* xa )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(xa->cmpFn);
VG_(ssort)( xa->arr, xa->usedsizeE, xa->elemSzB, xa->cmpFn );
xa->sorted = True;
}
-Bool VG_(lookupXA_UNSAFE) ( XArray* xao, const void* key,
+Bool VG_(lookupXA_UNSAFE) ( XArray* xa, const void* key,
/*OUT*/Word* first, /*OUT*/Word* last,
Int(*cmpFn)(const void*, const void*) )
{
Word lo, mid, hi, cres;
void* midv;
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
lo = 0;
hi = xa->usedsizeE-1;
@@ -264,35 +249,31 @@ Bool VG_(lookupXA_UNSAFE) ( XArray* xao, const void* key,
}
}
-Bool VG_(lookupXA) ( XArray* xao, const void* key,
+Bool VG_(lookupXA) ( XArray* xa, const void* key,
/*OUT*/Word* first, /*OUT*/Word* last )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(xa->cmpFn);
vg_assert(xa->sorted);
- return VG_(lookupXA_UNSAFE)(xao, key, first, last, xa->cmpFn);
+ return VG_(lookupXA_UNSAFE)(xa, key, first, last, xa->cmpFn);
}
-Word VG_(sizeXA) ( XArray* xao )
+Word VG_(sizeXA) ( XArray* xa )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
return xa->usedsizeE;
}
-void VG_(dropTailXA) ( XArray* xao, Word n )
+void VG_(dropTailXA) ( XArray* xa, Word n )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(n >= 0);
vg_assert(n <= xa->usedsizeE);
xa->usedsizeE -= n;
}
-void VG_(dropHeadXA) ( XArray* xao, Word n )
+void VG_(dropHeadXA) ( XArray* xa, Word n )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(n >= 0);
vg_assert(n <= xa->usedsizeE);
@@ -311,9 +292,8 @@ void VG_(dropHeadXA) ( XArray* xao, Word n )
xa->usedsizeE -= n;
}
-void VG_(removeIndexXA)( XArray* xao, Word n )
+void VG_(removeIndexXA)( XArray* xa, Word n )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(n >= 0);
vg_assert(n < xa->usedsizeE);
@@ -325,9 +305,8 @@ void VG_(removeIndexXA)( XArray* xao, Word n )
xa->usedsizeE--;
}
-void VG_(insertIndexXA)( XArray* xao, Word n, const void* elem )
+void VG_(insertIndexXA)( XArray* xa, Word n, const void* elem )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
vg_assert(n >= 0);
vg_assert(n <= xa->usedsizeE);
@@ -346,11 +325,10 @@ void VG_(insertIndexXA)( XArray* xao, Word n, const void* elem )
xa->sorted = False;
}
-void VG_(getContentsXA_UNSAFE)( XArray* xao,
+void VG_(getContentsXA_UNSAFE)( XArray* xa,
/*OUT*/void** ctsP,
/*OUT*/Word* usedP )
{
- struct _XArray* xa = (struct _XArray*)xao;
vg_assert(xa);
*ctsP = (void*)xa->arr;
*usedP = xa->usedsizeE;
diff --git a/drd/drd_error.c b/drd/drd_error.c
index 12bfeff49..7e6b5e120 100644
--- a/drd/drd_error.c
+++ b/drd/drd_error.c
@@ -171,8 +171,6 @@ void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri)
tl_assert(dri);
tl_assert(dri->addr);
tl_assert(dri->size > 0);
- tl_assert(descr1);
- tl_assert(descr2);
(void) VG_(get_data_description)(descr1, descr2, dri->addr);
/* If there's nothing in descr1/2, free them. Why is it safe to to
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index 445395420..673e41380 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -2946,7 +2946,6 @@ static void evh__HG_PTHREAD_BARRIER_INIT_PRE ( ThreadId tid,
sizeof(Thread*) );
}
- tl_assert(bar->waiting);
tl_assert(VG_(sizeXA)(bar->waiting) == 0);
bar->initted = True;
bar->resizable = resizable == 1 ? True : False;
diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c
index e1a18a7c9..3659aadfa 100644
--- a/helgrind/libhb_core.c
+++ b/helgrind/libhb_core.c
@@ -1846,7 +1846,6 @@ static void verydead_thread_table_init ( void )
= VG_(newXA)( HG_(zalloc),
"libhb.verydead_thread_table_init.1",
HG_(free), sizeof(ThrID) );
- tl_assert(verydead_thread_table);
VG_(setCmpFnXA)(verydead_thread_table, cmp__ThrID);
}
@@ -2562,12 +2561,9 @@ static Word vts_next_GC_at = 1000;
static void vts_tab_init ( void )
{
- vts_tab
- = VG_(newXA)( HG_(zalloc), "libhb.vts_tab_init.1",
- HG_(free), sizeof(VtsTE) );
- vts_tab_freelist
- = VtsID_INVALID;
- tl_assert(vts_tab);
+ vts_tab = VG_(newXA)( HG_(zalloc), "libhb.vts_tab_init.1",
+ HG_(free), sizeof(VtsTE) );
+ vts_tab_freelist = VtsID_INVALID;
}
/* Add ii to the free list, checking that it looks out-of-use. */
@@ -3677,7 +3673,6 @@ static Thr* Thr__new ( void )
if (!thrid_to_thr_map) {
thrid_to_thr_map = VG_(newXA)( HG_(zalloc), "libhb.Thr__new.4",
HG_(free), sizeof(Thr*) );
- tl_assert(thrid_to_thr_map);
}
if (thrid_counter >= ThrID_MAX_VALID) {
diff --git a/include/pub_tool_xarray.h b/include/pub_tool_xarray.h
index 086f0f4e4..73b9eab86 100644
--- a/include/pub_tool_xarray.h
+++ b/include/pub_tool_xarray.h
@@ -51,8 +51,9 @@ typedef struct _XArray XArray;
typedef Int (*XACmpFn_t)(const void *, const void *);
/* Create new XArray, using given allocation and free function, and
- for elements of the specified size. Alloc fn must not fail (that
- is, if it returns it must have succeeded.) */
+ for elements of the specified size. alloc_fn must not return NULL (that
+ is, if it returns it must have succeeded.)
+ This function never returns NULL. */
extern XArray* VG_(newXA) ( void*(*alloc_fn)(const HChar*,SizeT),
const HChar* cc,
void(*free_fn)(void*),
@@ -136,10 +137,9 @@ extern void VG_(insertIndexXA)( XArray*, Word, const void* elem );
/* Make a new, completely independent copy of the given XArray, using
the existing allocation function to allocate the new space.
- Returns NULL if the allocation function didn't manage to allocate
- space (but did return NULL rather than merely abort.) Space for
- the clone (and all additions to it) is billed to 'cc' unless that
- is NULL, in which case the parent's cost-center is used. */
+ Space for the clone (and all additions to it) is billed to 'cc' unless
+ that is NULL, in which case the parent's cost-center is used.
+ Ths function never returns NULL. */
extern XArray* VG_(cloneXA)( const HChar* cc, XArray* xa );
/* Get the raw array and size so callers can index it really fast.