Browse Source

fix for string to be key (implicit convert integer to string when needed).

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@731 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.6
Xuefer 16 years ago
parent
commit
5e2a796a19
  1. 13
      src/configparser.y

13
src/configparser.y

@ -301,7 +301,7 @@ aelement(A) ::= expression(B). {
A = B;
B = NULL;
}
aelement(A) ::= STRING(B) ARRAY_ASSIGN expression(C). {
aelement(A) ::= stringop(B) ARRAY_ASSIGN expression(C). {
buffer_copy_string_buffer(C->key, B);
buffer_free(B);
B = NULL;
@ -338,7 +338,7 @@ condline(A) ::= context LCURLY metalines RCURLY. {
A = cur;
}
context ::= DOLLAR SRVVARNAME(B) LBRACKET STRING(C) RBRACKET cond(E) expression(D). {
context ::= DOLLAR SRVVARNAME(B) LBRACKET stringop(C) RBRACKET cond(E) expression(D). {
data_config *dc;
buffer *b, *rvalue, *op;
@ -488,11 +488,14 @@ cond(A) ::= NOMATCH. {
stringop(A) ::= expression(B). {
A = NULL;
if (ctx->ok) {
if (B->type != TYPE_STRING) {
if (B->type == TYPE_STRING) {
A = buffer_init_buffer(((data_string*)B)->value);
} else if (B->type == TYPE_INTEGER) {
A = buffer_init();
buffer_copy_long(A, ((data_integer *)B)->value);
} else {
fprintf(stderr, "operand must be string");
ctx->ok = 0;
} else {
A = buffer_init_buffer(((data_string*)B)->value);
}
}
B->free(B);

Loading…
Cancel
Save