changeset 2389:ad08367a257b

compact win32 errno logging
author Igor Sysoev <igor@sysoev.ru>
date Tue, 09 Dec 2008 17:41:17 +0000
parents 722b5aff05ae
children 27ccc4b54fa6
files src/core/ngx_log.c src/os/win32/ngx_gui.c
diffstat 2 files changed, 4 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -127,18 +127,10 @@ ngx_log_error_core(ngx_uint_t level, ngx
         }
 
 #if (NGX_WIN32)
-
-        if ((unsigned) err >= 0x80000000) {
-            p = ngx_snprintf(p, last - p, " (%Xd: ", err);
-
-        } else {
-            p = ngx_snprintf(p, last - p, " (%d: ", err);
-        }
-
+        p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)
+                                           ? " (%d: " : " (%Xd: ", err);
 #else
-
         p = ngx_snprintf(p, last - p, " (%d: ", err);
-
 #endif
 
         p = ngx_strerror_r(err, p, last - p);
--- a/src/os/win32/ngx_gui.c
+++ b/src/os/win32/ngx_gui.c
@@ -36,13 +36,8 @@ ngx_message_box(char *title, ngx_uint_t 
             *p++ = '.';
         }
 
-        if ((unsigned) err >= 0x80000000) {
-            p = ngx_snprintf(p, last - p, " (%Xd: ", err);
-
-        } else {
-            p = ngx_snprintf(p, last - p, " (%d: ", err);
-        }
-
+        p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)
+                                           ? " (%d: " : " (%Xd: ", err);
         p = ngx_strerror_r(err, p, last - p);
 
         if (p < last) {