changeset 3547:c2da61796410

remove useless copy: key name should be just copied before value length
author Igor Sysoev <igor@sysoev.ru>
date Tue, 01 Jun 2010 17:25:36 +0000
parents 3a9fca8cbdfc
children fc7541a6959d
files src/http/modules/ngx_http_uwsgi_module.c
diffstat 1 files changed, 7 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -451,7 +451,7 @@ ngx_http_uwsgi_eval(ngx_http_request_t *
 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_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);
         }