Klaus Demo nginx / 2953f4a
Merge of r4815: map: fixed optimization of variables as values. Previous code incorrectly used ctx->var_values as an array of pointers to ngx_http_variable_value_t, but the array contains structures, not pointers. Additionally, ctx->var_values inspection failed to properly set var on match. Maxim Dounin 9 years ago
1 changed file(s) with 2 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
415415
416416 for (i = 0; i < ctx->var_values.nelts; i++) {
417417 if (index == (ngx_int_t) var[i].data) {
418 var = &var[i];
418419 goto found;
419420 }
420421 }
421422
422 var = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_variable_value_t));
423 var = ngx_array_push(&ctx->var_values);
423424 if (var == NULL) {
424425 return NGX_CONF_ERROR;
425426 }
430431 var->len = 0;
431432 var->data = (u_char *) index;
432433
433 vp = ngx_array_push(&ctx->var_values);
434 if (vp == NULL) {
435 return NGX_CONF_ERROR;
436 }
437
438 *vp = var;
439
440434 goto found;
441435 }
442436