|
From: <sv...@va...> - 2011-02-27 23:53:40
|
Author: sewardj
Date: 2011-02-27 23:53:32 +0000 (Sun, 27 Feb 2011)
New Revision: 11573
Log:
Back out r11568 (Add a new constructor for empty XArrays,
VG_(newSizedXA)) since r11571 removes the only use of the
functionality that r11568 introduces.
Modified:
trunk/coregrind/m_xarray.c
trunk/include/pub_tool_xarray.h
Modified: trunk/coregrind/m_xarray.c
===================================================================
--- trunk/coregrind/m_xarray.c 2011-02-27 23:39:53 UTC (rev 11572)
+++ trunk/coregrind/m_xarray.c 2011-02-27 23:53:32 UTC (rev 11573)
@@ -44,7 +44,6 @@
Int (*cmpFn) ( void*, void* ); /* cmp fn (may be NULL) */
Word elemSzB; /* element size in bytes */
void* arr; /* pointer to elements */
- Word initsizeE; /* HINT only: initial size, 0 if no hint */
Word usedsizeE; /* # used elements in arr */
Word totsizeE; /* max size of arr, in elements */
Bool sorted; /* is it sorted? */
@@ -73,7 +72,6 @@
xa->free = free_fn;
xa->cmpFn = NULL;
xa->elemSzB = elemSzB;
- xa->initsizeE = 0;
xa->usedsizeE = 0;
xa->totsizeE = 0;
xa->sorted = False;
@@ -81,19 +79,6 @@
return xa;
}
-XArray* VG_(newSizedXA) ( void*(*alloc_fn)(HChar*,SizeT),
- HChar* cc,
- void(*free_fn)(void*),
- Word elemSzB,
- Word nInitialElems )
-{
- XArray* xa;
- tl_assert(nInitialElems >= 0);
- xa = VG_(newXA)( alloc_fn, cc, free_fn, elemSzB );
- xa->initsizeE = nInitialElems;
- return xa;
-}
-
XArray* VG_(cloneXA)( HChar* cc, XArray* xao )
{
struct _XArray* xa = (struct _XArray*)xao;
@@ -160,7 +145,7 @@
static inline void ensureSpaceXA ( struct _XArray* xa )
{
- if (UNLIKELY(xa->usedsizeE == xa->totsizeE)) {
+ if (xa->usedsizeE == xa->totsizeE) {
void* tmp;
Word newsz;
if (xa->totsizeE == 0)
@@ -173,11 +158,7 @@
Hence increase the initial array size for tiny elements in
an attempt to avoid reallocations of size 2, 4, 8 if the
array does start to fill up. */
- /* Also, if there's a hinted initial size, use that instead of
- the logic in the preceding comment. */
- tl_assert(xa->initsizeE >= 0);
- if (xa->initsizeE > 0) newsz = xa->initsizeE;
- else if (xa->elemSzB == 1) newsz = 8;
+ if (xa->elemSzB == 1) newsz = 8;
else if (xa->elemSzB == 2) newsz = 4;
else newsz = 2;
} else {
Modified: trunk/include/pub_tool_xarray.h
===================================================================
--- trunk/include/pub_tool_xarray.h 2011-02-27 23:39:53 UTC (rev 11572)
+++ trunk/include/pub_tool_xarray.h 2011-02-27 23:53:32 UTC (rev 11573)
@@ -54,17 +54,6 @@
void(*free_fn)(void*),
Word elemSzB );
-/* Same as VG_(newXA), except allows specification of an initial
- number of elements for the array, so as to avoid a potentially
- large wasted cost of repeatedly resizing the array when the caller
- knows something about what the expected final size is going to
- be. */
-extern XArray* VG_(newSizedXA) ( void*(*alloc_fn)(HChar*,SizeT),
- HChar* cc,
- void(*free_fn)(void*),
- Word elemSzB,
- Word nInitialElems );
-
/* Free all memory associated with an XArray. */
extern void VG_(deleteXA) ( XArray* );
|