Mercurial > hg > nginx
comparison src/mail/ngx_mail.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 | 109849282793 |
comparison
equal
deleted
inserted
replaced
2196:fab3fa7339ff | 2197:74477ea8074f |
---|---|
356 for (i = 0; i < imip->naddrs; i++) { | 356 for (i = 0; i < imip->naddrs; i++) { |
357 imip->addrs[i].addr = in_addr[i].addr; | 357 imip->addrs[i].addr = in_addr[i].addr; |
358 imip->addrs[i].ctx = in_addr[i].ctx; | 358 imip->addrs[i].ctx = in_addr[i].ctx; |
359 | 359 |
360 text = ngx_pnalloc(cf->pool, | 360 text = ngx_pnalloc(cf->pool, |
361 INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); | 361 NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1); |
362 if (text == NULL) { | 362 if (text == NULL) { |
363 return NGX_CONF_ERROR; | 363 return NGX_CONF_ERROR; |
364 } | 364 } |
365 | 365 |
366 len = ngx_inet_ntop(AF_INET, &in_addr[i].addr, text, | 366 len = ngx_inet_ntop(AF_INET, &in_addr[i].addr, text, |
367 INET_ADDRSTRLEN); | 367 NGX_INET_ADDRSTRLEN); |
368 | 368 |
369 len = ngx_sprintf(text + len, ":%d", in_port[p].port) - text; | 369 len = ngx_sprintf(text + len, ":%d", in_port[p].port) - text; |
370 | 370 |
371 imip->addrs[i].addr_text.len = len; | 371 imip->addrs[i].addr_text.len = len; |
372 imip->addrs[i].addr_text.data = text; | 372 imip->addrs[i].addr_text.data = text; |