Mercurial > hg > nginx
comparison src/stream/ngx_stream_script.h @ 7503:b82162b8496a
Added ngx_http_set_complex_value_size_slot().
If a complex value is expected to be of type size_t, and the compiled
value is constant, the constant size_t value is remembered at compile
time.
The value is accessed through ngx_http_complex_value_size() which
either returns the remembered constant or evaluates the expression
and parses it as size_t.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 24 Apr 2019 16:38:51 +0300 |
parents | 0125b151c9a5 |
children | 3ab8e1e2f0f7 |
comparison
equal
deleted
inserted
replaced
7502:b7a7c02aea3a | 7503:b82162b8496a |
---|---|
54 typedef struct { | 54 typedef struct { |
55 ngx_str_t value; | 55 ngx_str_t value; |
56 ngx_uint_t *flushes; | 56 ngx_uint_t *flushes; |
57 void *lengths; | 57 void *lengths; |
58 void *values; | 58 void *values; |
59 | |
60 union { | |
61 size_t size; | |
62 } u; | |
59 } ngx_stream_complex_value_t; | 63 } ngx_stream_complex_value_t; |
60 | 64 |
61 | 65 |
62 typedef struct { | 66 typedef struct { |
63 ngx_conf_t *cf; | 67 ngx_conf_t *cf; |
100 | 104 |
101 void ngx_stream_script_flush_complex_value(ngx_stream_session_t *s, | 105 void ngx_stream_script_flush_complex_value(ngx_stream_session_t *s, |
102 ngx_stream_complex_value_t *val); | 106 ngx_stream_complex_value_t *val); |
103 ngx_int_t ngx_stream_complex_value(ngx_stream_session_t *s, | 107 ngx_int_t ngx_stream_complex_value(ngx_stream_session_t *s, |
104 ngx_stream_complex_value_t *val, ngx_str_t *value); | 108 ngx_stream_complex_value_t *val, ngx_str_t *value); |
109 size_t ngx_stream_complex_value_size(ngx_stream_session_t *s, | |
110 ngx_stream_complex_value_t *val, size_t default_value); | |
105 ngx_int_t ngx_stream_compile_complex_value( | 111 ngx_int_t ngx_stream_compile_complex_value( |
106 ngx_stream_compile_complex_value_t *ccv); | 112 ngx_stream_compile_complex_value_t *ccv); |
107 char *ngx_stream_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd, | 113 char *ngx_stream_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd, |
114 void *conf); | |
115 char *ngx_stream_set_complex_value_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, | |
108 void *conf); | 116 void *conf); |
109 | 117 |
110 | 118 |
111 ngx_uint_t ngx_stream_script_variables_count(ngx_str_t *value); | 119 ngx_uint_t ngx_stream_script_variables_count(ngx_str_t *value); |
112 ngx_int_t ngx_stream_script_compile(ngx_stream_script_compile_t *sc); | 120 ngx_int_t ngx_stream_script_compile(ngx_stream_script_compile_t *sc); |