diff src/http/ngx_http_upstream_round_robin.c @ 2197:74477ea8074f

*) remove zero termination in ngx_inet_ntop() and ngx_sock_ntop() *) use ngx_snprintf() in ngx_inet_ntop() and ngx_sock_ntop() as they are called just once per connection *) NGX_INET_ADDRSTRLEN
author Igor Sysoev <igor@sysoev.ru>
date Thu, 21 Aug 2008 18:47:23 +0000
parents 2a92804f4109
children 70a2bcc7e307
line wrap: on
line diff
--- a/src/http/ngx_http_upstream_round_robin.c
+++ b/src/http/ngx_http_upstream_round_robin.c
@@ -281,14 +281,14 @@ ngx_http_upstream_create_round_robin_pee
 
     for (i = 0; i < ur->naddrs; i++) {
 
-        len = INET_ADDRSTRLEN - 1 + 1 + sizeof(":65536") - 1;
+        len = NGX_INET_ADDRSTRLEN + sizeof(":65536") - 1;
 
         p = ngx_pnalloc(r->pool, len);
         if (p == NULL) {
             return NGX_ERROR;
         }
 
-        len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, INET_ADDRSTRLEN);
+        len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, NGX_INET_ADDRSTRLEN);
         len = ngx_sprintf(&p[len], ":%d", ur->port) - p;
 
         sin = ngx_pcalloc(r->pool, sizeof(struct sockaddr_in));