diff src/core/ngx_inet.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents f0b350454894
children 74b1868dd3cd
line wrap: on
line diff
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -9,6 +9,17 @@
 #include <ngx_core.h>
 
 
+/*
+ * ngx_sock_ntop() and ngx_inet_ntop() may be implemented as
+ * "ngx_sprintf(text, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3])",
+ * however, they were implemented long before the ngx_sprintf() appeared
+ * and they are faster by 1.5-2.5 times, so it is worth to keep them.
+ *
+ * By the way, the implementation using ngx_sprintf() is faster by 2.5-3 times
+ * than using FreeBSD libc's snrpintf().
+ */
+
+
 ngx_inline static size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len)
 {
     size_t      n;
@@ -105,15 +116,8 @@ size_t ngx_sock_ntop(int family, struct 
     text[n] = '\0';
 
     return n;
-
-#if 0
-    return ngx_snprintf((char *) text,
-                        len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
-                        "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
-#endif
 }
 
-
 size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len)
 {
     u_char      *p;
@@ -163,12 +167,6 @@ size_t ngx_inet_ntop(int family, void *a
     text[n] = '\0';
 
     return n;
-
-#if 0
-    return ngx_snprintf((char *) text,
-                        len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
-                        "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
-#endif
 }