]> git.kaiwu.me - nginx.git/commitdiff
QUIC: moved a variable initialization near to its use.
authorSergey Kandaurov <pluknet@nginx.com>
Mon, 27 Sep 2021 12:38:55 +0000 (15:38 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Mon, 27 Sep 2021 12:38:55 +0000 (15:38 +0300)
This tends to produce slightly more optimal code with pos == NULL
when built with Clang on low optimization levels.

Spotted by Ruslan Ermilov.

src/event/quic/ngx_event_quic_transport.c

index 94d516fc795e548c3c12f1883095bde95e9fb78f..85418d1e8fe34bd60667cdbf67d8841ab639c2b7 100644 (file)
@@ -1967,8 +1967,6 @@ ngx_quic_create_transport_params(u_char *pos, u_char *end, ngx_quic_tp_t *tp,
         p = ngx_cpymem(p, value.data, value.len);                             \
     } while (0)
 
-    p = pos;
-
     len = ngx_quic_tp_len(NGX_QUIC_TP_INITIAL_MAX_DATA, tp->initial_max_data);
 
     len += ngx_quic_tp_len(NGX_QUIC_TP_INITIAL_MAX_STREAMS_UNI,
@@ -2026,6 +2024,8 @@ ngx_quic_create_transport_params(u_char *pos, u_char *end, ngx_quic_tp_t *tp,
         return len;
     }
 
+    p = pos;
+
     ngx_quic_tp_vint(NGX_QUIC_TP_INITIAL_MAX_DATA,
                      tp->initial_max_data);