summaryrefslogtreecommitdiff
path: root/src/parse/parse.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-07-22 23:54:29 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-07-22 23:54:29 +0000
commit55e88e6d1a77b874fe8f0f54207d4f0af9bafe17 (patch)
tree3b3ec24322e1c890951487d931edfb3e4cbcfbee /src/parse/parse.c
parentdeb988f5cf59891ccbb943c02afe2d781b28d86e (diff)
downloadlibcss-55e88e6d1a77b874fe8f0f54207d4f0af9bafe17.tar.gz
libcss-55e88e6d1a77b874fe8f0f54207d4f0af9bafe17.tar.bz2
Purge use of alloca()
svn path=/trunk/libcss/; revision=8715
Diffstat (limited to 'src/parse/parse.c')
-rw-r--r--src/parse/parse.c12
1 files changed, 10 insertions, 2 deletions
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 */