Welcome! Log In Create A New Profile

Advanced

Re: [nginx] Improved code readablity.

Junwang Zhao
March 07, 2018 07:44PM
I'm a little bit confused why the diffs are equal to each other,
ASAICS, the changed code removed the effect of 'flags'?

Can you explain a little bit since I just began to read the code base :)

2018-03-07 23:29 GMT+08:00 Ruslan Ermilov <ru@nginx.com>:
> details: http://hg.nginx.org/nginx/rev/0b1eb40de6da
> branches:
> changeset: 7226:0b1eb40de6da
> user: Ruslan Ermilov <ru@nginx.com>
> date: Wed Mar 07 18:28:12 2018 +0300
> description:
> Improved code readablity.
>
> No functional changes.
>
> diffstat:
>
> src/http/ngx_http_variables.c | 8 ++++++--
> src/stream/ngx_stream_variables.c | 8 ++++++--
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diffs (50 lines):
>
> diff -r e80930e5e422 -r 0b1eb40de6da src/http/ngx_http_variables.c
> --- a/src/http/ngx_http_variables.c Mon Mar 05 21:35:13 2018 +0300
> +++ b/src/http/ngx_http_variables.c Wed Mar 07 18:28:12 2018 +0300
> @@ -429,7 +429,9 @@ ngx_http_add_variable(ngx_conf_t *cf, ng
> return NULL;
> }
>
> - v->flags &= flags | ~NGX_HTTP_VAR_WEAK;
> + if (!(flags & NGX_HTTP_VAR_WEAK)) {
> + v->flags &= ~NGX_HTTP_VAR_WEAK;
> + }
>
> return v;
> }
> @@ -494,7 +496,9 @@ ngx_http_add_prefix_variable(ngx_conf_t
> return NULL;
> }
>
> - v->flags &= flags | ~NGX_HTTP_VAR_WEAK;
> + if (!(flags & NGX_HTTP_VAR_WEAK)) {
> + v->flags &= ~NGX_HTTP_VAR_WEAK;
> + }
>
> return v;
> }
> diff -r e80930e5e422 -r 0b1eb40de6da src/stream/ngx_stream_variables.c
> --- a/src/stream/ngx_stream_variables.c Mon Mar 05 21:35:13 2018 +0300
> +++ b/src/stream/ngx_stream_variables.c Wed Mar 07 18:28:12 2018 +0300
> @@ -161,7 +161,9 @@ ngx_stream_add_variable(ngx_conf_t *cf,
> return NULL;
> }
>
> - v->flags &= flags | ~NGX_STREAM_VAR_WEAK;
> + if (!(flags & NGX_STREAM_VAR_WEAK)) {
> + v->flags &= ~NGX_STREAM_VAR_WEAK;
> + }
>
> return v;
> }
> @@ -227,7 +229,9 @@ ngx_stream_add_prefix_variable(ngx_conf_
> return NULL;
> }
>
> - v->flags &= flags | ~NGX_STREAM_VAR_WEAK;
> + if (!(flags & NGX_STREAM_VAR_WEAK)) {
> + v->flags &= ~NGX_STREAM_VAR_WEAK;
> + }
>
> return v;
> }
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Improved code readablity.

ru@nginx.com 643 March 07, 2018 10:30AM

Re: [nginx] Improved code readablity.

Junwang Zhao 330 March 07, 2018 07:44PM

Re: [nginx] Improved code readablity.

ru@nginx.com 468 March 08, 2018 12:14AM

Re: [nginx] Improved code readablity.

Junwang Zhao 383 March 08, 2018 12:32AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 134
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready