Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.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 | a953f73273ee |
children | 5975975eedc0 |
comparison
equal
deleted
inserted
replaced
2196:fab3fa7339ff | 2197:74477ea8074f |
---|---|
1624 if (s == NULL) { | 1624 if (s == NULL) { |
1625 return NGX_OK; | 1625 return NGX_OK; |
1626 } | 1626 } |
1627 | 1627 |
1628 s->len = ngx_inet_ntop(c->listening->family, &r->in_addr, | 1628 s->len = ngx_inet_ntop(c->listening->family, &r->in_addr, |
1629 s->data, INET_ADDRSTRLEN); | 1629 s->data, NGX_INET_ADDRSTRLEN); |
1630 | 1630 |
1631 return NGX_OK; | 1631 return NGX_OK; |
1632 } | 1632 } |
1633 | 1633 |
1634 | 1634 |
2969 ls->line = cf->conf_file->line; | 2969 ls->line = cf->conf_file->line; |
2970 ls->conf.backlog = NGX_LISTEN_BACKLOG; | 2970 ls->conf.backlog = NGX_LISTEN_BACKLOG; |
2971 ls->conf.rcvbuf = -1; | 2971 ls->conf.rcvbuf = -1; |
2972 ls->conf.sndbuf = -1; | 2972 ls->conf.sndbuf = -1; |
2973 | 2973 |
2974 n = ngx_inet_ntop(AF_INET, &ls->addr, ls->conf.addr, INET_ADDRSTRLEN + 6); | 2974 n = ngx_inet_ntop(AF_INET, &ls->addr, ls->conf.addr, NGX_INET_ADDRSTRLEN); |
2975 ngx_sprintf(&ls->conf.addr[n], ":%ui", ls->port); | 2975 ngx_sprintf(&ls->conf.addr[n], ":%ui", ls->port); |
2976 | 2976 |
2977 if (cf->args->nelts == 2) { | 2977 if (cf->args->nelts == 2) { |
2978 return NGX_CONF_OK; | 2978 return NGX_CONF_OK; |
2979 } | 2979 } |