changeset 7053:7f480434c7f2

Variables: use ngx_http_variable_null_value where appropriate.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 07 Jul 2017 14:34:21 +0300
parents 70e65bf8dfd7
children e02555553d0b
files src/http/ngx_http_variables.c
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -1463,17 +1463,15 @@ static ngx_int_t
 ngx_http_variable_is_args(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data)
 {
-    v->valid = 1;
-    v->no_cacheable = 0;
-    v->not_found = 0;
-
     if (r->args.len == 0) {
-        v->len = 0;
-        v->data = NULL;
+        *v = ngx_http_variable_null_value;
         return NGX_OK;
     }
 
     v->len = 1;
+    v->valid = 1;
+    v->no_cacheable = 0;
+    v->not_found = 0;
     v->data = (u_char *) "?";
 
     return NGX_OK;
@@ -1990,11 +1988,7 @@ ngx_http_variable_request_completion(ngx
         return NGX_OK;
     }
 
-    v->len = 0;
-    v->valid = 1;
-    v->no_cacheable = 0;
-    v->not_found = 0;
-    v->data = (u_char *) "";
+    *v = ngx_http_variable_null_value;
 
     return NGX_OK;
 }