[nginx] Referer: fixed error type usage inconsistency for ngx_ht...
Sergey Kandaurov
pluknet at nginx.com
Thu Aug 29 18:37:54 UTC 2013
details: http://hg.nginx.org/nginx/rev/9b8a634e348a
branches:
changeset: 5349:9b8a634e348a
user: Sergey Kandaurov <pluknet at nginx.com>
date: Thu Aug 29 22:35:26 2013 +0400
description:
Referer: fixed error type usage inconsistency for ngx_http_add*().
diffstat:
src/http/modules/ngx_http_referer_module.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diffs (113 lines):
diff -r 317e0893a1e6 -r 9b8a634e348a src/http/modules/ngx_http_referer_module.c
--- a/src/http/modules/ngx_http_referer_module.c Wed Aug 28 00:19:07 2013 +0800
+++ b/src/http/modules/ngx_http_referer_module.c Thu Aug 29 22:35:26 2013 +0400
@@ -41,9 +41,9 @@ static char * ngx_http_referer_merge_con
void *child);
static char *ngx_http_valid_referers(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
-static char *ngx_http_add_referer(ngx_conf_t *cf, ngx_hash_keys_arrays_t *keys,
- ngx_str_t *value, ngx_str_t *uri);
-static char *ngx_http_add_regex_referer(ngx_conf_t *cf,
+static ngx_int_t ngx_http_add_referer(ngx_conf_t *cf,
+ ngx_hash_keys_arrays_t *keys, ngx_str_t *value, ngx_str_t *uri);
+static ngx_int_t ngx_http_add_regex_referer(ngx_conf_t *cf,
ngx_http_referer_conf_t *rlcf, ngx_str_t *name, ngx_regex_t *regex);
static int ngx_libc_cdecl ngx_http_cmp_referer_wildcards(const void *one,
const void *two);
@@ -497,7 +497,7 @@ ngx_http_valid_referers(ngx_conf_t *cf,
}
-static char *
+static ngx_int_t
ngx_http_add_referer(ngx_conf_t *cf, ngx_hash_keys_arrays_t *keys,
ngx_str_t *value, ngx_str_t *uri)
{
@@ -510,7 +510,7 @@ ngx_http_add_referer(ngx_conf_t *cf, ngx
} else {
u = ngx_palloc(cf->pool, sizeof(ngx_str_t));
if (u == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*u = *uri;
@@ -519,7 +519,7 @@ ngx_http_add_referer(ngx_conf_t *cf, ngx
rc = ngx_hash_add_key(keys, value, u, NGX_HASH_WILDCARD_KEY);
if (rc == NGX_OK) {
- return NGX_CONF_OK;
+ return NGX_OK;
}
if (rc == NGX_DECLINED) {
@@ -532,11 +532,11 @@ ngx_http_add_referer(ngx_conf_t *cf, ngx
"conflicting parameter \"%V\"", value);
}
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
-static char *
+static ngx_int_t
ngx_http_add_regex_referer(ngx_conf_t *cf, ngx_http_referer_conf_t *rlcf,
ngx_str_t *name, ngx_regex_t *regex)
{
@@ -547,26 +547,26 @@ ngx_http_add_regex_referer(ngx_conf_t *c
if (name->len == 1) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "empty regex in \"%V\"", name);
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
if (rlcf->regex == NGX_CONF_UNSET_PTR) {
rlcf->regex = ngx_array_create(cf->pool, 2, sizeof(ngx_regex_elt_t));
if (rlcf->regex == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
}
re = ngx_array_push(rlcf->regex);
if (re == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
if (regex) {
re->regex = regex;
re->name = name->data;
- return NGX_CONF_OK;
+ return NGX_OK;
}
name->len--;
@@ -582,13 +582,13 @@ ngx_http_add_regex_referer(ngx_conf_t *c
if (ngx_regex_compile(&rc) != NGX_OK) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc.err);
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
re->regex = rc.regex;
re->name = name->data;
- return NGX_CONF_OK;
+ return NGX_OK;
#else
@@ -596,7 +596,7 @@ ngx_http_add_regex_referer(ngx_conf_t *c
"the using of the regex \"%V\" requires PCRE library",
name);
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
#endif
}
More information about the nginx-devel
mailing list