[nginx] Events: made posted events macros safe.

Valentin Bartenev vbart at nginx.com
Fri Mar 27 16:59:58 UTC 2015


details:   http://hg.nginx.org/nginx/rev/3d4730eada9c
branches:  
changeset: 6060:3d4730eada9c
user:      Valentin Bartenev <vbart at nginx.com>
date:      Fri Mar 27 19:57:15 2015 +0300
description:
Events: made posted events macros safe.

diffstat:

 src/event/ngx_event_posted.h |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (36 lines):

diff -r c81d79a7befd -r 3d4730eada9c src/event/ngx_event_posted.h
--- a/src/event/ngx_event_posted.h	Mon Mar 23 21:04:13 2015 +0300
+++ b/src/event/ngx_event_posted.h	Fri Mar 27 19:57:15 2015 +0300
@@ -16,24 +16,24 @@
 
 #define ngx_post_event(ev, q)                                                 \
                                                                               \
-    if (!ev->posted) {                                                        \
-        ev->posted = 1;                                                       \
-        ngx_queue_insert_tail(q, &ev->queue);                                 \
+    if (!(ev)->posted) {                                                      \
+        (ev)->posted = 1;                                                     \
+        ngx_queue_insert_tail(q, &(ev)->queue);                               \
                                                                               \
-        ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, "post event %p", ev);  \
+        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
                                                                               \
     } else  {                                                                 \
-        ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0,                        \
+        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
                        "update posted event %p", ev);                         \
     }
 
 
 #define ngx_delete_posted_event(ev)                                           \
                                                                               \
-    ev->posted = 0;                                                           \
-    ngx_queue_remove(&ev->queue);                                             \
+    (ev)->posted = 0;                                                         \
+    ngx_queue_remove(&(ev)->queue);                                           \
                                                                               \
-    ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0,                            \
+    ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                          \
                    "delete posted event %p", ev);
 
 



More information about the nginx-devel mailing list