Permalink
Browse files

various coding style fixes.

  • Loading branch information...
1 parent c60f580 commit cea7499072c0da0d507dd4c6c4f41374a48b68b1 @agentzh agentzh committed Sep 2, 2013
Showing with 30 additions and 35 deletions.
  1. +14 −17 src/ngx_http_memc_handler.c
  2. +8 −9 src/ngx_http_memc_response.c
  3. +8 −9 src/ngx_http_memc_response.rl
@@ -3,15 +3,18 @@
#endif
#include "ddebug.h"
+
#include "ngx_http_memc_handler.h"
#include "ngx_http_memc_module.h"
#include "ngx_http_memc_request.h"
#include "ngx_http_memc_response.h"
#include "ngx_http_memc_util.h"
+
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);
+
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,
@@ -20,8 +23,8 @@ static ngx_http_variable_t ngx_http_memc_variables[] = {
{ ngx_null_string, NULL, NULL, 0, 0, 0 }
};
-static ngx_int_t ngx_http_memc_add_more_variables(ngx_conf_t *cf);
+static ngx_int_t ngx_http_memc_add_more_variables(ngx_conf_t *cf);
static ngx_flag_t ngx_http_memc_enabled = 0;
static ngx_str_t ngx_http_memc_key = ngx_string("memc_key");
@@ -38,19 +41,14 @@ static ngx_int_t ngx_http_memc_exptime_index;
static ngx_int_t ngx_http_memc_variable_not_found(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
-
static ngx_int_t ngx_http_memc_add_variable(ngx_conf_t *cf, ngx_str_t *name);
-
static ngx_flag_t ngx_http_memc_in_cmds_allowed(ngx_http_memc_loc_conf_t *mlcf,
ngx_http_memc_cmd_t memc_cmd);
-
static ngx_int_t ngx_http_memc_reinit_request(ngx_http_request_t *r);
static void ngx_http_memc_abort_request(ngx_http_request_t *r);
static void ngx_http_memc_finalize_request(ngx_http_request_t *r,
ngx_int_t rc);
-
static ngx_flag_t ngx_http_memc_valid_uint32_str(u_char *data, size_t len);
-
static ngx_flag_t ngx_http_memc_valid_uint64_str(u_char *data, size_t len);
@@ -405,7 +403,7 @@ ngx_http_memc_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
static ngx_flag_t
ngx_http_memc_in_cmds_allowed(ngx_http_memc_loc_conf_t *mlcf,
- ngx_http_memc_cmd_t memc_cmd)
+ ngx_http_memc_cmd_t memc_cmd)
{
ngx_uint_t i;
ngx_http_memc_cmd_t *value;
@@ -497,9 +495,9 @@ ngx_http_memc_init(ngx_conf_t *cf)
return NGX_ERROR;
}
- if ((ngx_http_memc_value_index = ngx_http_memc_add_variable(
- cf, &ngx_http_memc_value)) == NGX_ERROR)
- {
+ ngx_http_memc_value_index = ngx_http_memc_add_variable(cf,
+ &ngx_http_memc_value);
+ if (ngx_http_memc_value_index == NGX_ERROR) {
return NGX_ERROR;
}
@@ -508,7 +506,8 @@ ngx_http_memc_init(ngx_conf_t *cf)
static ngx_int_t
-ngx_http_memc_add_variable(ngx_conf_t *cf, ngx_str_t *name) {
+ngx_http_memc_add_variable(ngx_conf_t *cf, ngx_str_t *name)
+{
ngx_http_variable_t *v;
v = ngx_http_add_variable(cf, name, NGX_HTTP_VAR_CHANGEABLE);
@@ -517,7 +516,6 @@ ngx_http_memc_add_variable(ngx_conf_t *cf, ngx_str_t *name) {
}
v->get_handler = ngx_http_memc_variable_not_found;
-
return ngx_http_get_variable_index(cf, name);
}
@@ -530,15 +528,16 @@ ngx_http_memc_set_module_enabled() {
static ngx_int_t
ngx_http_memc_variable_not_found(ngx_http_request_t *r,
- ngx_http_variable_value_t *v, uintptr_t data)
+ ngx_http_variable_value_t *v, uintptr_t data)
{
v->not_found = 1;
return NGX_OK;
}
static ngx_int_t
-ngx_http_memc_add_more_variables(ngx_conf_t *cf) {
+ngx_http_memc_add_more_variables(ngx_conf_t *cf)
+{
ngx_http_variable_t *var, *v;
for (v = ngx_http_memc_variables; v->name.len; v++) {
var = ngx_http_add_variable(cf, &v->name, v->flags);
@@ -554,8 +553,7 @@ ngx_http_memc_add_more_variables(ngx_conf_t *cf) {
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)
{
u_char *p;
size_t len;
@@ -607,4 +605,3 @@ ngx_http_memc_flags_as_http_time_variable(
return NGX_OK;
}
-
@@ -626,8 +626,8 @@ ngx_http_memc_process_get_cmd_header(ngx_http_request_t *r)
static ngx_int_t
ngx_http_memc_write_simple_response(ngx_http_request_t *r,
- ngx_http_upstream_t *u, ngx_http_memc_ctx_t *ctx,
- ngx_uint_t status, ngx_str_t *resp)
+ ngx_http_upstream_t *u, ngx_http_memc_ctx_t *ctx, ngx_uint_t status,
+ ngx_str_t *resp)
{
ngx_chain_t *cl, **ll;
@@ -668,7 +668,7 @@ ngx_http_memc_write_simple_response(ngx_http_request_t *r,
static u_char *
parse_memc_storage(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -1188,7 +1188,7 @@ case 53:
static u_char *
parse_memc_flush_all(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -1484,7 +1484,7 @@ case 29:
static u_char *
parse_memc_version(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -1863,7 +1863,7 @@ case 38:
static u_char *
parse_memc_stats(int *cs_addr, u_char *p, u_char *pe, ngx_uint_t *status_addr,
- unsigned *done_addr)
+ unsigned *done_addr)
{
int cs = *cs_addr;
@@ -2294,7 +2294,7 @@ case 42:
static u_char *
parse_memc_delete(int *cs_addr, u_char *p, u_char *pe, ngx_uint_t *status_addr,
- unsigned *done_addr)
+ unsigned *done_addr)
{
int cs = *cs_addr;
@@ -2724,7 +2724,7 @@ case 44:
static u_char *
parse_memc_incr_decr(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -3442,4 +3442,3 @@ case 39:
return p;
}
-
@@ -522,8 +522,8 @@ no_valid:
static ngx_int_t
ngx_http_memc_write_simple_response(ngx_http_request_t *r,
- ngx_http_upstream_t *u, ngx_http_memc_ctx_t *ctx,
- ngx_uint_t status, ngx_str_t *resp)
+ ngx_http_upstream_t *u, ngx_http_memc_ctx_t *ctx, ngx_uint_t status,
+ ngx_str_t *resp)
{
ngx_chain_t *cl, **ll;
@@ -564,7 +564,7 @@ ngx_http_memc_write_simple_response(ngx_http_request_t *r,
static u_char *
parse_memc_storage(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -580,7 +580,7 @@ parse_memc_storage(int *cs_addr, u_char *p, u_char *pe,
static u_char *
parse_memc_flush_all(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -596,7 +596,7 @@ parse_memc_flush_all(int *cs_addr, u_char *p, u_char *pe,
static u_char *
parse_memc_version(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -612,7 +612,7 @@ parse_memc_version(int *cs_addr, u_char *p, u_char *pe,
static u_char *
parse_memc_stats(int *cs_addr, u_char *p, u_char *pe, ngx_uint_t *status_addr,
- unsigned *done_addr)
+ unsigned *done_addr)
{
int cs = *cs_addr;
@@ -628,7 +628,7 @@ parse_memc_stats(int *cs_addr, u_char *p, u_char *pe, ngx_uint_t *status_addr,
static u_char *
parse_memc_delete(int *cs_addr, u_char *p, u_char *pe, ngx_uint_t *status_addr,
- unsigned *done_addr)
+ unsigned *done_addr)
{
int cs = *cs_addr;
@@ -644,7 +644,7 @@ parse_memc_delete(int *cs_addr, u_char *p, u_char *pe, ngx_uint_t *status_addr,
static u_char *
parse_memc_incr_decr(int *cs_addr, u_char *p, u_char *pe,
- ngx_uint_t *status_addr, unsigned *done_addr)
+ ngx_uint_t *status_addr, unsigned *done_addr)
{
int cs = *cs_addr;
@@ -656,4 +656,3 @@ parse_memc_incr_decr(int *cs_addr, u_char *p, u_char *pe,
return p;
}
-

0 comments on commit cea7499

Please sign in to comment.