[PATCH] Improved code readablity of ngx_cache_manager_process_cycle.

Zexuan Luo spacewanderlzx at gmail.com
Thu Apr 5 04:37:19 UTC 2018


# HG changeset patch
# User spacewander <spacewanderlzx at gmail.com>
# Date 1522902794 -28800
#      Thu Apr 05 12:33:14 2018 +0800
# Branch ident
# Node ID e0834ca20c9c68c4f0728f85efb3651732134ee2
# Parent  d4cc2edb4ff8391d0c7419e91e6fcc988c510654
Improved code readablity of ngx_cache_manager_process_cycle.

diff -r d4cc2edb4ff8 -r e0834ca20c9c src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c   Tue Apr 03 17:38:10 2018 +0300
+++ b/src/os/unix/ngx_process_cycle.c   Thu Apr 05 12:33:14 2018 +0800
@@ -1128,7 +1128,7 @@
 {
     ngx_cache_manager_ctx_t *ctx = data;

-    void         *ident[4];
+   u_char            ident[offsetof(ngx_connection_t, fd) +
sizeof(ngx_socket_t)];
     ngx_event_t   ev;

     /*
@@ -1148,7 +1148,7 @@
     ev.handler = ctx->handler;
     ev.data = ident;
     ev.log = cycle->log;
-    ident[3] = (void *) -1;
+   *(ngx_socket_t *)(ident + offsetof(ngx_connection_t, fd)) = -1;

     ngx_use_accept_mutex = 0;


More information about the nginx-devel mailing list