Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 4802:6fc86fe0b586 stable-1.2
Merge of r4766, r4767: ngx_http_upstream_add() changes.
*) Fixed to return NULL if an error occurs.
*) Microoptimization: replaced an expression known to be constant with
the constant value.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 Aug 2012 17:20:01 +0000 |
parents | 1eab1a2c661e |
children | 56fcb5767f06 |
comparison
equal
deleted
inserted
replaced
4801:8f2f71233f5b | 4802:6fc86fe0b586 |
---|---|
4420 | 4420 |
4421 if (u->naddrs == 1) { | 4421 if (u->naddrs == 1) { |
4422 uscf->servers = ngx_array_create(cf->pool, 1, | 4422 uscf->servers = ngx_array_create(cf->pool, 1, |
4423 sizeof(ngx_http_upstream_server_t)); | 4423 sizeof(ngx_http_upstream_server_t)); |
4424 if (uscf->servers == NULL) { | 4424 if (uscf->servers == NULL) { |
4425 return NGX_CONF_ERROR; | 4425 return NULL; |
4426 } | 4426 } |
4427 | 4427 |
4428 us = ngx_array_push(uscf->servers); | 4428 us = ngx_array_push(uscf->servers); |
4429 if (us == NULL) { | 4429 if (us == NULL) { |
4430 return NGX_CONF_ERROR; | 4430 return NULL; |
4431 } | 4431 } |
4432 | 4432 |
4433 ngx_memzero(us, sizeof(ngx_http_upstream_server_t)); | 4433 ngx_memzero(us, sizeof(ngx_http_upstream_server_t)); |
4434 | 4434 |
4435 us->addrs = u->addrs; | 4435 us->addrs = u->addrs; |
4436 us->naddrs = u->naddrs; | 4436 us->naddrs = 1; |
4437 } | 4437 } |
4438 | 4438 |
4439 uscfp = ngx_array_push(&umcf->upstreams); | 4439 uscfp = ngx_array_push(&umcf->upstreams); |
4440 if (uscfp == NULL) { | 4440 if (uscfp == NULL) { |
4441 return NULL; | 4441 return NULL; |