From: Julian Seward Date: Wed, 7 Jul 2004 12:00:42 +0000 (+0000) Subject: Enable valgrind checking of vex (ugly hack). X-Git-Tag: svn/VALGRIND_3_0_1^2~1275 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e4ad4637178b48d74e59e9c0124f0ef6a83918b;p=thirdparty%2Fvalgrind.git Enable valgrind checking of vex (ugly hack). git-svn-id: svn://svn.valgrind.org/vex/trunk@59 --- diff --git a/VEX/priv/main/vex_util.c b/VEX/priv/main/vex_util.c index 055f1d3658..1c91ab8521 100644 --- a/VEX/priv/main/vex_util.c +++ b/VEX/priv/main/vex_util.c @@ -42,14 +42,20 @@ void* LibVEX_Alloc ( Int nbytes ) { vassert(vex_initdone); vassert(nbytes > 0); - nbytes = (nbytes + 7) & ~7; - if (storage_used + nbytes > N_STORAGE_BYTES) - vpanic("VEX storage exhausted.\n" - "Increase N_STORAGE_BYTES and recompile."); - storage_count_allocs++; - storage_bytes_allocd += nbytes; - storage_used += nbytes; - return (void*)(&storage[storage_used - nbytes]); + if (vex_valgrind_support) { + /* ugly hack */ + extern void* malloc ( int ); + return malloc(nbytes); + } else { + nbytes = (nbytes + 7) & ~7; + if (storage_used + nbytes > N_STORAGE_BYTES) + vpanic("VEX storage exhausted.\n" + "Increase N_STORAGE_BYTES and recompile."); + storage_count_allocs++; + storage_bytes_allocd += nbytes; + storage_used += nbytes; + return (void*)(&storage[storage_used - nbytes]); + } } /* Exported to library client. */ diff --git a/VEX/test_main.c b/VEX/test_main.c index 0e1e20042a..95e1717b8b 100644 --- a/VEX/test_main.c +++ b/VEX/test_main.c @@ -61,7 +61,7 @@ int main ( int argc, char** argv ) } LibVEX_Init ( &failure_exit, &log_bytes, - 1, 1, False, 100 ); + 1, 1, True, 100 ); while (!feof(f)) { fgets(linebuf, N_LINEBUF,f);