Skip to content
Browse files

fix error C2057: expected constant expression

  • Loading branch information...
1 parent b3399a9 commit 16ec2d7f2d8b07cef4c092ac2addffb4168b39bf @weltling weltling committed Sep 13, 2013
Showing with 11 additions and 3 deletions.
  1. +11 −3 uri_template_parser.c
View
14 uri_template_parser.c
@@ -21,11 +21,19 @@ static uri_template_expr *build_expr(char *tpl, int len);
inline static int extract_num(char *str, int len)
{
- char buff[len + 1];
+ char *buff;
+ int ret;
+
+ buff = emalloc(sizeof(char) * (len+1));
+
strncpy(buff, str, len);
buff[len] = 0;
- return atoi(buff);
+ ret = atoi(buff);
+
+ efree(buff);
+
+ return ret;
}
static uri_template_expr *build_expr(char *tpl, int len)
@@ -252,4 +260,4 @@ void uri_template_parse(char *tpl, zval *return_value, zval *vars, zval *capture
zval_dtor(&vars_ptr);
smart_str_free(&result);
-}
+}

0 comments on commit 16ec2d7

Please sign in to comment.
Something went wrong with that request. Please try again.