Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_transport.c @ 8867:40f2f059145a quic
QUIC: moved a variable initialization near to its use.
This tends to produce slightly more optimal code with pos == NULL
when built with Clang on low optimization levels.
Spotted by Ruslan Ermilov.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 27 Sep 2021 15:38:55 +0300 |
parents | 4009f120cad4 |
children | 126a15530136 |
comparison
equal
deleted
inserted
replaced
8866:8c163ce5b55a | 8867:40f2f059145a |
---|---|
1965 ngx_quic_build_int(&p, id); \ | 1965 ngx_quic_build_int(&p, id); \ |
1966 ngx_quic_build_int(&p, value.len); \ | 1966 ngx_quic_build_int(&p, value.len); \ |
1967 p = ngx_cpymem(p, value.data, value.len); \ | 1967 p = ngx_cpymem(p, value.data, value.len); \ |
1968 } while (0) | 1968 } while (0) |
1969 | 1969 |
1970 p = pos; | |
1971 | |
1972 len = ngx_quic_tp_len(NGX_QUIC_TP_INITIAL_MAX_DATA, tp->initial_max_data); | 1970 len = ngx_quic_tp_len(NGX_QUIC_TP_INITIAL_MAX_DATA, tp->initial_max_data); |
1973 | 1971 |
1974 len += ngx_quic_tp_len(NGX_QUIC_TP_INITIAL_MAX_STREAMS_UNI, | 1972 len += ngx_quic_tp_len(NGX_QUIC_TP_INITIAL_MAX_STREAMS_UNI, |
1975 tp->initial_max_streams_uni); | 1973 tp->initial_max_streams_uni); |
1976 | 1974 |
2024 | 2022 |
2025 if (pos == NULL) { | 2023 if (pos == NULL) { |
2026 return len; | 2024 return len; |
2027 } | 2025 } |
2028 | 2026 |
2027 p = pos; | |
2028 | |
2029 ngx_quic_tp_vint(NGX_QUIC_TP_INITIAL_MAX_DATA, | 2029 ngx_quic_tp_vint(NGX_QUIC_TP_INITIAL_MAX_DATA, |
2030 tp->initial_max_data); | 2030 tp->initial_max_data); |
2031 | 2031 |
2032 ngx_quic_tp_vint(NGX_QUIC_TP_INITIAL_MAX_STREAMS_UNI, | 2032 ngx_quic_tp_vint(NGX_QUIC_TP_INITIAL_MAX_STREAMS_UNI, |
2033 tp->initial_max_streams_uni); | 2033 tp->initial_max_streams_uni); |