]> git.kaiwu.me - nginx.git/commitdiff
remove useless copy: key name should be just copied before value length
authorIgor Sysoev <igor@sysoev.ru>
Tue, 1 Jun 2010 17:25:36 +0000 (17:25 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 1 Jun 2010 17:25:36 +0000 (17:25 +0000)
src/http/modules/ngx_http_uwsgi_module.c

index 42a169e61bf2d556d9e365f85fb0b2ce4461f073..94feee3546a0b99a2965a5b7cdfdf21a0b042506 100644 (file)
@@ -451,7 +451,7 @@ ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf)
 static ngx_int_t
 ngx_http_uwsgi_create_request(ngx_http_request_t *r)
 {
-    u_char                        ch, *pos, tmp[2];
+    u_char                        ch;
     size_t                        key_len, val_len, len;
     ngx_uint_t                    i, n;
     ngx_buf_t                    *b;
@@ -564,25 +564,17 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
             *e.pos++ = (u_char) (key_len & 0xff);
             *e.pos++ = (u_char) ((key_len >> 8) & 0xff);
 
+            code = *(ngx_http_script_code_pt *) e.ip;
+            code((ngx_http_script_engine_t *) & e);
+
+            *e.pos++ = (u_char) (val_len & 0xff);
+            *e.pos++ = (u_char) ((val_len >> 8) & 0xff);
+
             while (*(uintptr_t *) e.ip) {
                 code = *(ngx_http_script_code_pt *) e.ip;
                 code((ngx_http_script_engine_t *) & e);
             }
 
-            pos = e.pos - val_len;
-            /* move memory */
-            for (i = 0; i < val_len; i += 2) {
-                e.pos = ngx_cpymem(tmp, pos + i + 2, 2);
-                e.pos = ngx_cpymem(pos + i + 2, pos, 2);
-                e.pos = ngx_cpymem(pos, tmp, 2);
-            }
-
-            e.pos = pos;
-
-            *e.pos++ = (u_char) (val_len & 0xff);
-            *e.pos++ = (u_char) ((val_len >> 8) & 0xff);
-            e.pos += val_len;
-
             e.ip += sizeof(uintptr_t);
         }