Var: Refactored nxt_var_ref_get()
This commit is contained in:
@@ -132,18 +132,13 @@ nxt_var_ref_get(nxt_tstr_state_t *state, nxt_str_t *name)
|
|||||||
|
|
||||||
ref->index = state->var_refs->nelts - 1;
|
ref->index = state->var_refs->nelts - 1;
|
||||||
|
|
||||||
ref->name = nxt_str_dup(state->pool, NULL, name);
|
|
||||||
if (nxt_slow_path(ref->name == NULL)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
decl = nxt_var_hash_find(name);
|
decl = nxt_var_hash_find(name);
|
||||||
|
|
||||||
if (decl != NULL) {
|
if (decl != NULL) {
|
||||||
ref->handler = decl->handler;
|
ref->handler = decl->handler;
|
||||||
ref->cacheable = decl->cacheable;
|
ref->cacheable = decl->cacheable;
|
||||||
|
|
||||||
return ref;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nxt_http_unknown_var_ref(state, ref, name);
|
ret = nxt_http_unknown_var_ref(state, ref, name);
|
||||||
@@ -151,6 +146,13 @@ nxt_var_ref_get(nxt_tstr_state_t *state, nxt_str_t *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
|
||||||
|
ref->name = nxt_str_dup(state->pool, NULL, name);
|
||||||
|
if (nxt_slow_path(ref->name == NULL)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user