diff options
author | Anthony J. Bentley <anthony@cathet.us> | 2013-04-26 19:01:52 -0600 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2013-04-27 13:28:47 +0100 |
commit | a4e3ccd6abb97d05121635112bdca44fc0e440b0 (patch) | |
tree | 699ad88c55b44c3e82f2180b6096666919127f19 /test/cscodec-utf8.c | |
parent | a6fd64ee6ca004627cefc7d80e036707bea22bf9 (diff) | |
download | libparserutils-a4e3ccd6abb97d05121635112bdca44fc0e440b0.tar.gz libparserutils-a4e3ccd6abb97d05121635112bdca44fc0e440b0.tar.bz2 |
Don't use the nonportable alloca() during tests.
Diffstat (limited to 'test/cscodec-utf8.c')
-rw-r--r-- | test/cscodec-utf8.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/cscodec-utf8.c b/test/cscodec-utf8.c index c36961e..6b1d4de 100644 --- a/test/cscodec-utf8.c +++ b/test/cscodec-utf8.c @@ -180,7 +180,7 @@ void run_test(line_ctx *ctx) { static int testnum; size_t destlen = ctx->bufused * 4; - uint8_t *dest = alloca(destlen); + uint8_t *dest = malloc(destlen); uint8_t *pdest = dest; const uint8_t *psrc = ctx->buf; size_t srclen = ctx->bufused; @@ -196,7 +196,7 @@ void run_test(line_ctx *ctx) &pdest, &destlen) == ctx->exp_ret); } else { size_t templen = ctx->bufused * 4; - uint8_t *temp = alloca(templen); + uint8_t *temp = malloc(templen); uint8_t *ptemp = temp; const uint8_t *ptemp2; size_t templen2; @@ -220,6 +220,8 @@ void run_test(line_ctx *ctx) assert(templen2 == 0); assert(temp + (ctx->bufused * 4 - templen) == ptemp2); } + + free(temp); } if (ctx->exp_ret == PARSERUTILS_OK) { assert(srclen == 0); @@ -242,5 +244,7 @@ void run_test(line_ctx *ctx) assert(pdest == dest + ctx->expused); assert(memcmp(dest, ctx->exp, ctx->expused) == 0); + + free(dest); } |