From 55e88e6d1a77b874fe8f0f54207d4f0af9bafe17 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 22 Jul 2009 23:54:29 +0000 Subject: Purge use of alloca() svn path=/trunk/libcss/; revision=8715 --- src/parse/parse.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/parse/parse.c b/src/parse/parse.c index 361ba84..b0e7dad 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -651,11 +651,15 @@ css_error getToken(css_parser *parser, const css_token **token) * too? lwc_strings can easily be compared case * insensitively */ if (t->type < CSS_TOKEN_LAST_INTERN_LOWER) { - /** \todo Don't use alloca */ - uint8_t *temp = alloca(t->data.len); + uint8_t *temp; bool lower = false; size_t i; + temp = parser->alloc(NULL, t->data.len, + parser->pw); + if (temp == NULL) + return CSS_NOMEM; + for (i = 0; i < t->data.len; i++) { uint8_t c = t->data.data[i]; @@ -675,10 +679,14 @@ css_error getToken(css_parser *parser, const css_token **token) t->data.len, &t->ilower); if (lerror != lwc_error_ok) { + parser->alloc(temp, 0, + parser->pw); return css_error_from_lwc_error( lerror); } } + + parser->alloc(temp, 0, parser->pw); } /* Insert token text into the dictionary */ -- cgit v1.2.3