aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_inet.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-11-11 14:07:14 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-11-11 14:07:14 +0000
commit1b73583ba2c0e4b72d951218827e0c621427d389 (patch)
tree9e4d204e2cce91560d5cb8908b8a1a9f2c1d92ee /src/core/ngx_inet.c
parentd6f24959428caed68a509a19ca4fd866d978a69c (diff)
downloadnginx-1b73583ba2c0e4b72d951218827e0c621427d389.tar.gz
nginx-1b73583ba2c0e4b72d951218827e0c621427d389.zip
nginx-0.1.5-RELEASE importrelease-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.
Diffstat (limited to 'src/core/ngx_inet.c')
-rw-r--r--src/core/ngx_inet.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index bf8a788ea..5cabb49b5 100644
--- 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 sockaddr *addr, u_char *text,
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 *addr, u_char *text, size_t len)
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
}