From: Robert Haas Date: Wed, 26 Mar 2014 23:55:43 +0000 (-0700) Subject: test_sballoc improvements. X-Git-Url: http://git.postgresql.org/gitweb/static/close/reject?a=commitdiff_plain;h=146f7479733cb26c80f4deee328128c9c19e799a;p=users%2Frhaas%2Fpostgres.git test_sballoc improvements. --- diff --git a/contrib/test_sballoc/test_sballoc.c b/contrib/test_sballoc/test_sballoc.c index 2357625084..8a64fd9305 100644 --- a/contrib/test_sballoc/test_sballoc.c +++ b/contrib/test_sballoc/test_sballoc.c @@ -30,11 +30,16 @@ alloc(PG_FUNCTION_ARGS) int64 size = PG_GETARG_INT64(0); int64 count = PG_GETARG_INT64(1); int64 i; + int64 *p; sb_allocator *a; a = sb_create_private_allocator(); for (i = 0; i < count; ++i) - (void) sb_alloc(a, size, 0); + { + p = sb_alloc(a, size, 0); + *p = i; + } + sb_reset_allocator(a); PG_RETURN_VOID(); } @@ -45,6 +50,7 @@ alloc_with_palloc(PG_FUNCTION_ARGS) int64 size = PG_GETARG_INT64(0); int64 count = PG_GETARG_INT64(1); int64 i; + int64 *p; MemoryContext context; context = AllocSetContextCreate(CurrentMemoryContext, @@ -53,7 +59,10 @@ alloc_with_palloc(PG_FUNCTION_ARGS) ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); for (i = 0; i < count; ++i) - (void) MemoryContextAlloc(context, size); + { + p = MemoryContextAlloc(context, size); + *p = i; + } PG_RETURN_VOID(); }