[nginx] Make macros safe.

Gleb Smirnoff glebius at nginx.com
Fri Jul 5 09:45:27 UTC 2013


details:   http://hg.nginx.org/nginx/rev/626f288fa5ed
branches:  
changeset: 5262:626f288fa5ed
user:      Gleb Smirnoff <glebius at nginx.com>
date:      Fri Jul 05 11:42:25 2013 +0400
description:
Make macros safe.

diffstat:

 src/core/ngx_config.h           |   4 ++--
 src/os/unix/ngx_files.h         |  10 +++++-----
 src/os/win32/ngx_win32_config.h |   6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (63 lines):

diff -r af60a210cb78 -r 626f288fa5ed src/core/ngx_config.h
--- a/src/core/ngx_config.h	Wed Jul 03 12:04:13 2013 +0400
+++ b/src/core/ngx_config.h	Fri Jul 05 11:42:25 2013 +0400
@@ -80,8 +80,8 @@ typedef uintptr_t       ngx_uint_t;
 typedef intptr_t        ngx_flag_t;
 
 
-#define NGX_INT32_LEN   sizeof("-2147483648") - 1
-#define NGX_INT64_LEN   sizeof("-9223372036854775808") - 1
+#define NGX_INT32_LEN   (sizeof("-2147483648") - 1)
+#define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
 
 #if (NGX_PTR_SIZE == 4)
 #define NGX_INT_T_LEN   NGX_INT32_LEN
diff -r af60a210cb78 -r 626f288fa5ed src/os/unix/ngx_files.h
--- a/src/os/unix/ngx_files.h	Wed Jul 03 12:04:13 2013 +0400
+++ b/src/os/unix/ngx_files.h	Fri Jul 05 11:42:25 2013 +0400
@@ -72,8 +72,8 @@ typedef struct {
 #define NGX_FILE_RDWR            O_RDWR
 #define NGX_FILE_CREATE_OR_OPEN  O_CREAT
 #define NGX_FILE_OPEN            0
-#define NGX_FILE_TRUNCATE        O_CREAT|O_TRUNC
-#define NGX_FILE_APPEND          O_WRONLY|O_APPEND
+#define NGX_FILE_TRUNCATE        (O_CREAT|O_TRUNC)
+#define NGX_FILE_APPEND          (O_WRONLY|O_APPEND)
 #define NGX_FILE_NONBLOCK        O_NONBLOCK
 
 #if (NGX_HAVE_OPENAT)
@@ -86,13 +86,13 @@ typedef struct {
 #endif
 
 #if defined(O_SEARCH)
-#define NGX_FILE_SEARCH          O_SEARCH|NGX_FILE_DIRECTORY
+#define NGX_FILE_SEARCH          (O_SEARCH|NGX_FILE_DIRECTORY)
 
 #elif defined(O_EXEC)
-#define NGX_FILE_SEARCH          O_EXEC|NGX_FILE_DIRECTORY
+#define NGX_FILE_SEARCH          (O_EXEC|NGX_FILE_DIRECTORY)
 
 #else
-#define NGX_FILE_SEARCH          O_RDONLY|NGX_FILE_DIRECTORY
+#define NGX_FILE_SEARCH          (O_RDONLY|NGX_FILE_DIRECTORY)
 #endif
 
 #endif /* NGX_HAVE_OPENAT */
diff -r af60a210cb78 -r 626f288fa5ed src/os/win32/ngx_win32_config.h
--- a/src/os/win32/ngx_win32_config.h	Wed Jul 03 12:04:13 2013 +0400
+++ b/src/os/win32/ngx_win32_config.h	Fri Jul 05 11:42:25 2013 +0400
@@ -142,11 +142,11 @@ typedef int                 sig_atomic_t
 
 
 #define NGX_PTR_SIZE            4
-#define NGX_SIZE_T_LEN          sizeof("-2147483648") - 1
+#define NGX_SIZE_T_LEN          (sizeof("-2147483648") - 1)
 #define NGX_MAX_SIZE_T_VALUE    2147483647
-#define NGX_TIME_T_LEN          sizeof("-2147483648") - 1
+#define NGX_TIME_T_LEN          (sizeof("-2147483648") - 1)
 #define NGX_TIME_T_SIZE         4
-#define NGX_OFF_T_LEN           sizeof("-9223372036854775807") - 1
+#define NGX_OFF_T_LEN           (sizeof("-9223372036854775807") - 1)
 #define NGX_MAX_OFF_T_VALUE     9223372036854775807
 #define NGX_SIG_ATOMIC_T_SIZE   4
 



More information about the nginx-devel mailing list