From: Florian Krohm Date: Sat, 18 Oct 2014 20:56:13 +0000 (+0000) Subject: Constify. X-Git-Tag: svn/VALGRIND_3_11_0~907 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa351c61c1b25615847d433265f33d7e18c3937e;p=thirdparty%2Fvalgrind.git Constify. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14641 --- diff --git a/coregrind/m_xarray.c b/coregrind/m_xarray.c index 74ee63102c..18e3f6cb99 100644 --- a/coregrind/m_xarray.c +++ b/coregrind/m_xarray.c @@ -78,7 +78,7 @@ XArray* VG_(newXA) ( void*(*alloc_fn)(const HChar*,SizeT), return xa; } -XArray* VG_(cloneXA)( const HChar* cc, XArray* xa ) +XArray* VG_(cloneXA)( const HChar* cc, const XArray* xa ) { XArray* nyu; const HChar* nyu_cc; @@ -125,7 +125,7 @@ void VG_(setCmpFnXA) ( XArray* xa, XACmpFn_t compar ) xa->sorted = False; } -inline void* VG_(indexXA) ( XArray* xa, Word n ) +inline void* VG_(indexXA) ( const XArray* xa, Word n ) { vg_assert(xa); vg_assert(n >= 0); @@ -211,7 +211,7 @@ void VG_(sortXA) ( XArray* xa ) xa->sorted = True; } -Bool VG_(lookupXA_UNSAFE) ( XArray* xa, const void* key, +Bool VG_(lookupXA_UNSAFE) ( const XArray* xa, const void* key, /*OUT*/Word* first, /*OUT*/Word* last, Int(*cmpFn)(const void*, const void*) ) { @@ -249,7 +249,7 @@ Bool VG_(lookupXA_UNSAFE) ( XArray* xa, const void* key, } } -Bool VG_(lookupXA) ( XArray* xa, const void* key, +Bool VG_(lookupXA) ( const XArray* xa, const void* key, /*OUT*/Word* first, /*OUT*/Word* last ) { vg_assert(xa); @@ -258,7 +258,7 @@ Bool VG_(lookupXA) ( XArray* xa, const void* key, return VG_(lookupXA_UNSAFE)(xa, key, first, last, xa->cmpFn); } -Word VG_(sizeXA) ( XArray* xa ) +Word VG_(sizeXA) ( const XArray* xa ) { vg_assert(xa); return xa->usedsizeE; diff --git a/include/pub_tool_xarray.h b/include/pub_tool_xarray.h index 73b9eab869..2f429e4c61 100644 --- a/include/pub_tool_xarray.h +++ b/include/pub_tool_xarray.h @@ -86,7 +86,7 @@ extern void VG_(sortXA) ( XArray* ); value found. If any values are found, return True, else return False, and don't change *first or *last. first and/or last may be NULL. Bomb if the array is not sorted. */ -extern Bool VG_(lookupXA) ( XArray*, const void* key, +extern Bool VG_(lookupXA) ( const XArray*, const void* key, /*OUT*/Word* first, /*OUT*/Word* last ); /* A version of VG_(lookupXA) in which you can specify your own @@ -97,12 +97,12 @@ extern Bool VG_(lookupXA) ( XArray*, const void* key, VG_(lookupXA), which refuses to do anything (asserts) unless the array has first been sorted using the same comparison function as is being used for the lookup. */ -extern Bool VG_(lookupXA_UNSAFE) ( XArray* xao, const void* key, +extern Bool VG_(lookupXA_UNSAFE) ( const XArray* xao, const void* key, /*OUT*/Word* first, /*OUT*/Word* last, XACmpFn_t cmpFn ); /* How elements are there in this XArray now? */ -extern Word VG_(sizeXA) ( XArray* ); +extern Word VG_(sizeXA) ( const XArray* ); /* Index into the XArray. Checks bounds and bombs if the index is invalid. What this returns is the address of the specified element @@ -111,7 +111,7 @@ extern Word VG_(sizeXA) ( XArray* ); insertIndexXA, so you should copy it out immediately and not regard its address as unchanging. Note also that indexXA will of course not return NULL if it succeeds. */ -extern void* VG_(indexXA) ( XArray*, Word ); +extern void* VG_(indexXA) ( const XArray*, Word ); /* Drop the last n elements of an XArray. Bombs if there are less than n elements in the array. This is an O(1) operation. */ @@ -140,7 +140,7 @@ extern void VG_(insertIndexXA)( XArray*, Word, const void* elem ); 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 ); +extern XArray* VG_(cloneXA)( const HChar* cc, const XArray* xa ); /* Get the raw array and size so callers can index it really fast. This is dangerous in the sense that there's no range or