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
This commit is contained in:
parent
40fb6ffec1
commit
5e2a796a19
|
@ -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…
Reference in New Issue