Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 2536:a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 24 Feb 2009 10:42:23 +0000 |
parents | c843171d5dc2 |
children | e73f70b4ca5c |
comparison
equal
deleted
inserted
replaced
2535:ec5825afc7eb | 2536:a6d6d762c554 |
---|---|
1553 | 1553 |
1554 if (c >= 'A' && c <= 'Z') { | 1554 if (c >= 'A' && c <= 'Z') { |
1555 | 1555 |
1556 exten = ngx_pnalloc(r->pool, r->exten.len); | 1556 exten = ngx_pnalloc(r->pool, r->exten.len); |
1557 if (exten == NULL) { | 1557 if (exten == NULL) { |
1558 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 1558 return NGX_ERROR; |
1559 } | 1559 } |
1560 | 1560 |
1561 hash = ngx_hash_strlow(exten, r->exten.data, r->exten.len); | 1561 hash = ngx_hash_strlow(exten, r->exten.data, r->exten.len); |
1562 | 1562 |
1563 r->exten.data = exten; | 1563 r->exten.data = exten; |
1682 == NULL) | 1682 == NULL) |
1683 { | 1683 { |
1684 return NULL; | 1684 return NULL; |
1685 } | 1685 } |
1686 | 1686 |
1687 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path, 0)== NGX_ERROR) | 1687 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path, 0) != NGX_OK) { |
1688 { | |
1689 return NULL; | 1688 return NULL; |
1690 } | 1689 } |
1691 | 1690 |
1692 *root_length = path->len - reserved; | 1691 *root_length = path->len - reserved; |
1693 last = path->data + *root_length; | 1692 last = path->data + *root_length; |
2004 return NGX_ERROR; | 2003 return NGX_ERROR; |
2005 } | 2004 } |
2006 | 2005 |
2007 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, | 2006 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, |
2008 sizeof(ngx_table_elt_t)) | 2007 sizeof(ngx_table_elt_t)) |
2009 == NGX_ERROR) | 2008 != NGX_OK) |
2010 { | 2009 { |
2011 return NGX_ERROR; | 2010 return NGX_ERROR; |
2012 } | 2011 } |
2013 | 2012 |
2014 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); | 2013 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2592 value = cf->args->elts; | 2591 value = cf->args->elts; |
2593 | 2592 |
2594 if (ngx_strcmp(value[0].data, "include") == 0) { | 2593 if (ngx_strcmp(value[0].data, "include") == 0) { |
2595 file = value[1]; | 2594 file = value[1]; |
2596 | 2595 |
2597 if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR){ | 2596 if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { |
2598 return NGX_CONF_ERROR; | 2597 return NGX_CONF_ERROR; |
2599 } | 2598 } |
2600 | 2599 |
2601 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); | 2600 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); |
2602 | 2601 |
2726 * conf->client_large_buffers.num = 0; | 2725 * conf->client_large_buffers.num = 0; |
2727 */ | 2726 */ |
2728 | 2727 |
2729 if (ngx_array_init(&cscf->listen, cf->temp_pool, 4, | 2728 if (ngx_array_init(&cscf->listen, cf->temp_pool, 4, |
2730 sizeof(ngx_http_listen_t)) | 2729 sizeof(ngx_http_listen_t)) |
2731 == NGX_ERROR) | 2730 != NGX_OK) |
2732 { | 2731 { |
2733 return NGX_CONF_ERROR; | 2732 return NGX_CONF_ERROR; |
2734 } | 2733 } |
2735 | 2734 |
2736 if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4, | 2735 if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4, |
2737 sizeof(ngx_http_server_name_t)) | 2736 sizeof(ngx_http_server_name_t)) |
2738 == NGX_ERROR) | 2737 != NGX_OK) |
2739 { | 2738 { |
2740 return NGX_CONF_ERROR; | 2739 return NGX_CONF_ERROR; |
2741 } | 2740 } |
2742 | 2741 |
2743 cscf->connection_pool_size = NGX_CONF_UNSET_SIZE; | 2742 cscf->connection_pool_size = NGX_CONF_UNSET_SIZE; |
2952 | 2951 |
2953 if (prev->root.data == NULL) { | 2952 if (prev->root.data == NULL) { |
2954 conf->root.len = sizeof("html") - 1; | 2953 conf->root.len = sizeof("html") - 1; |
2955 conf->root.data = (u_char *) "html"; | 2954 conf->root.data = (u_char *) "html"; |
2956 | 2955 |
2957 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) == NGX_ERROR) { | 2956 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) { |
2958 return NGX_CONF_ERROR; | 2957 return NGX_CONF_ERROR; |
2959 } | 2958 } |
2960 } | 2959 } |
2961 } | 2960 } |
2962 | 2961 |
3524 if (!alias && lcf->root.data[lcf->root.len - 1] == '/') { | 3523 if (!alias && lcf->root.data[lcf->root.len - 1] == '/') { |
3525 lcf->root.len--; | 3524 lcf->root.len--; |
3526 } | 3525 } |
3527 | 3526 |
3528 if (lcf->root.data[0] != '$') { | 3527 if (lcf->root.data[0] != '$') { |
3529 if (ngx_conf_full_name(cf->cycle, &lcf->root, 0) == NGX_ERROR) { | 3528 if (ngx_conf_full_name(cf->cycle, &lcf->root, 0) != NGX_OK) { |
3530 return NGX_CONF_ERROR; | 3529 return NGX_CONF_ERROR; |
3531 } | 3530 } |
3532 } | 3531 } |
3533 | 3532 |
3534 n = ngx_http_script_variables_count(&lcf->root); | 3533 n = ngx_http_script_variables_count(&lcf->root); |