Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more coding style fixes.

  • Loading branch information...
commit 845ff0765618f6b3803eb2fe34104c2359797dd4 1 parent cea7499
@agentzh agentzh authored
Showing with 43 additions and 43 deletions.
  1. +43 −43 src/ngx_http_memc_handler.c
View
86 src/ngx_http_memc_handler.c
@@ -12,10 +12,11 @@
static ngx_int_t ngx_http_memc_flags_as_http_time_variable(
- ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data);
+ ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data);
static ngx_http_variable_t ngx_http_memc_variables[] = {
+
{ ngx_string("memc_flags_as_http_time"), NULL,
ngx_http_memc_flags_as_http_time_variable, 0,
0, 0 },
@@ -115,20 +116,19 @@ ngx_http_memc_handler(ngx_http_request_t *r)
} else {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_memc: $memc_cmd variable requires explicit "
- "assignment for HTTP request method %V",
- &r->method_name);
+ "ngx_memc: $memc_cmd variable requires explicit "
+ "assignment for HTTP request method %V",
+ &r->method_name);
return NGX_HTTP_BAD_REQUEST;
}
} else {
memc_cmd = ngx_http_memc_parse_cmd(cmd_vv->data, cmd_vv->len,
- &is_storage_cmd);
+ &is_storage_cmd);
if (memc_cmd == ngx_http_memc_cmd_unknown) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_memc: unknown $memc_cmd \"%v\"", cmd_vv);
-
+ "ngx_memc: unknown $memc_cmd \"%v\"", cmd_vv);
return NGX_HTTP_BAD_REQUEST;
}
}
@@ -137,10 +137,10 @@ ngx_http_memc_handler(ngx_http_request_t *r)
dd("XXX connect timeout %d", (int) mlcf->upstream.connect_timeout);
- if ( ! ngx_http_memc_in_cmds_allowed(mlcf, memc_cmd) ) {
+ if (!ngx_http_memc_in_cmds_allowed(mlcf, memc_cmd)) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_memc: User requests to run memcached command "
- "\"%v\"", cmd_vv);
+ "ngx_memc: User requests to run memcached command "
+ "\"%v\"", cmd_vv);
return NGX_HTTP_FORBIDDEN;
}
@@ -179,7 +179,7 @@ ngx_http_memc_handler(ngx_http_request_t *r)
if (mlcf->complex_target) {
/* variables used in the memc_pass directive */
if (ngx_http_complex_value(r, mlcf->complex_target, &target)
- != NGX_OK)
+ != NGX_OK)
{
dd("failed to compile");
return NGX_ERROR;
@@ -187,7 +187,7 @@ ngx_http_memc_handler(ngx_http_request_t *r)
if (target.len == 0) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "memc: handler: empty \"memc_pass\" target");
+ "memc: handler: empty \"memc_pass\" target");
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -199,8 +199,7 @@ ngx_http_memc_handler(ngx_http_request_t *r)
if (mlcf->upstream.upstream == NULL) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "memc: upstream \"%V\" not found", &target);
-
+ "memc: upstream \"%V\" not found", &target);
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
}
@@ -300,7 +299,7 @@ ngx_http_memc_handler(ngx_http_request_t *r)
|| memc_cmd == ngx_http_memc_cmd_delete)
{
exptime_vv = ngx_http_get_indexed_variable(r,
- ngx_http_memc_exptime_index);
+ ngx_http_memc_exptime_index);
if (exptime_vv == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -308,10 +307,10 @@ ngx_http_memc_handler(ngx_http_request_t *r)
ctx->memc_exptime_vv = exptime_vv;
- if ( ! exptime_vv->not_found
- && exptime_vv->len
- && ! ngx_http_memc_valid_uint32_str(
- exptime_vv->data, exptime_vv->len))
+ if (!exptime_vv->not_found
+ && exptime_vv->len
+ && !ngx_http_memc_valid_uint32_str(exptime_vv->data,
+ exptime_vv->len))
{
return NGX_HTTP_BAD_REQUEST;
}
@@ -326,38 +325,38 @@ ngx_http_memc_handler(ngx_http_request_t *r)
ctx->memc_flags_vv = flags_vv;
- if ( is_storage_cmd
- && ! flags_vv->not_found
- && flags_vv->len
- && ! ngx_http_memc_valid_uint32_str(
- flags_vv->data, flags_vv->len))
+ if (is_storage_cmd
+ && !flags_vv->not_found
+ && flags_vv->len
+ && !ngx_http_memc_valid_uint32_str(flags_vv->data, flags_vv->len))
{
return NGX_HTTP_BAD_REQUEST;
}
}
- if (is_storage_cmd || memc_cmd == ngx_http_memc_cmd_incr
- || memc_cmd == ngx_http_memc_cmd_decr)
+ if (is_storage_cmd
+ || memc_cmd == ngx_http_memc_cmd_incr
+ || memc_cmd == ngx_http_memc_cmd_decr)
{
value_vv = ngx_http_get_indexed_variable(r,
- ngx_http_memc_value_index);
+ ngx_http_memc_value_index);
if (value_vv == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
if (memc_cmd == ngx_http_memc_cmd_incr
- || memc_cmd == ngx_http_memc_cmd_decr)
+ || memc_cmd == ngx_http_memc_cmd_decr)
{
if (value_vv->not_found || value_vv->len == 0) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "The \"$memc_value\" variable is required for "
- "command \"%V\"", &ctx->cmd_str);
+ "the \"$memc_value\" variable is required for "
+ "command \"%V\"", &ctx->cmd_str);
return NGX_HTTP_BAD_REQUEST;
}
- if (!ngx_http_memc_valid_uint64_str(
- value_vv->data, value_vv->len))
+ if (!ngx_http_memc_valid_uint64_str(value_vv->data,
+ value_vv->len))
{
return NGX_HTTP_BAD_REQUEST;
}
@@ -471,26 +470,27 @@ ngx_http_memc_init(ngx_conf_t *cf)
return NGX_OK;
}
- if ((ngx_http_memc_key_index = ngx_http_memc_add_variable(
- cf, &ngx_http_memc_key)) == NGX_ERROR)
- {
+ ngx_http_memc_key_index = ngx_http_memc_add_variable(cf,
+ &ngx_http_memc_key);
+ if (ngx_http_memc_key_index == NGX_ERROR) {
return NGX_ERROR;
}
- if ((ngx_http_memc_cmd_index = ngx_http_memc_add_variable(
- cf, &ngx_http_memc_cmd)) == NGX_ERROR)
- {
+ ngx_http_memc_cmd_index = ngx_http_memc_add_variable(cf,
+ &ngx_http_memc_cmd);
+ if (ngx_http_memc_cmd_index == NGX_ERROR) {
return NGX_ERROR;
}
- if ((ngx_http_memc_flags_index = ngx_http_memc_add_variable(
- cf, &ngx_http_memc_flags)) == NGX_ERROR)
- {
+ ngx_http_memc_flags_index = ngx_http_memc_add_variable(cf,
+ &ngx_http_memc_flags);
+ if (ngx_http_memc_flags_index == NGX_ERROR) {
return NGX_ERROR;
}
- if ((ngx_http_memc_exptime_index = ngx_http_memc_add_variable(
- cf, &ngx_http_memc_exptime)) == NGX_ERROR)
+ ngx_http_memc_exptime_index = ngx_http_memc_add_variable(cf,
+ &ngx_http_memc_exptime);
+ if (ngx_http_memc_exptime_index == NGX_ERROR)
{
return NGX_ERROR;
}
Please sign in to comment.
Something went wrong with that request. Please try again.