comparison src/http/modules/ngx_http_geo_module.c @ 4967:a9d60fafaa85

Geo: improved ngx_http_geo_block() code readability.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 14 Dec 2012 19:35:37 +0000
parents 9f4cdc7a8578
children 90d8c3400769
comparison
equal deleted inserted replaced
4966:c821975c9068 4967:a9d60fafaa85
301 301
302 static char * 302 static char *
303 ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 303 ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
304 { 304 {
305 char *rv; 305 char *rv;
306 void **p;
307 size_t len; 306 size_t len;
308 ngx_str_t *value, name; 307 ngx_str_t *value, name;
309 ngx_uint_t i; 308 ngx_uint_t i;
310 ngx_conf_t save; 309 ngx_conf_t save;
311 ngx_pool_t *pool; 310 ngx_pool_t *pool;
400 ctx.high.low[i] = ngx_palloc(cf->pool, len + sizeof(void *)); 399 ctx.high.low[i] = ngx_palloc(cf->pool, len + sizeof(void *));
401 if (ctx.high.low[i] == NULL) { 400 if (ctx.high.low[i] == NULL) {
402 return NGX_CONF_ERROR; 401 return NGX_CONF_ERROR;
403 } 402 }
404 403
405 p = (void **) ngx_cpymem(ctx.high.low[i], a->elts, len); 404 ngx_memcpy(ctx.high.low[i], a->elts, len);
406 *p = NULL; 405 ctx.high.low[i][a->nelts].value = NULL;
407 ctx.data_size += len + sizeof(void *); 406 ctx.data_size += len + sizeof(void *);
408 } 407 }
409 408
410 if (ctx.allow_binary_include 409 if (ctx.allow_binary_include
411 && !ctx.outside_entries 410 && !ctx.outside_entries