Skip to content

Commit

Permalink
now we renamed ngx_http_echo_init_ctx to ngx_http_echo_create_ctx and…
Browse files Browse the repository at this point in the history
… changed its prototype.
  • Loading branch information
agentzh committed Feb 7, 2011
1 parent 010b8a8 commit 5f3c77b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/ngx_http_echo_filter.c
Expand Up @@ -49,7 +49,6 @@ ngx_http_echo_header_filter(ngx_http_request_t *r)
{
ngx_http_echo_loc_conf_t *conf;
ngx_http_echo_ctx_t *ctx;
ngx_int_t rc;

dd("We're in the header filter...");

Expand All @@ -75,8 +74,8 @@ ngx_http_echo_header_filter(ngx_http_request_t *r)
}

if (ctx == NULL) {
rc = ngx_http_echo_init_ctx(r, &ctx);
if (rc != NGX_OK) {
ctx = ngx_http_echo_create_ctx(r);
if (ctx == NULL) {
return NGX_ERROR;
}

Expand Down
6 changes: 3 additions & 3 deletions src/ngx_http_echo_handler.c
Expand Up @@ -157,9 +157,9 @@ ngx_http_echo_run_cmds(ngx_http_request_t *r)

ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module);
if (ctx == NULL) {
rc = ngx_http_echo_init_ctx(r, &ctx);
if (rc != NGX_OK) {
return rc;
ctx = ngx_http_echo_create_ctx(r);
if (ctx == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}

ngx_http_set_ctx(r, ctx, ngx_http_echo_module);
Expand Down
14 changes: 6 additions & 8 deletions src/ngx_http_echo_util.c
Expand Up @@ -5,23 +5,21 @@
#include "ngx_http_echo_sleep.h"


ngx_int_t
ngx_http_echo_init_ctx(ngx_http_request_t *r, ngx_http_echo_ctx_t **ctx_ptr)
ngx_http_echo_ctx_t *
ngx_http_echo_create_ctx(ngx_http_request_t *r)
{
ngx_http_echo_ctx_t *ctx;

*ctx_ptr = ngx_pcalloc(r->pool, sizeof(ngx_http_echo_ctx_t));
if (*ctx_ptr == NULL) {
return NGX_ERROR;
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_echo_ctx_t));
if (ctx == NULL) {
return NULL;
}

ctx = *ctx_ptr;

ctx->sleep.handler = ngx_http_echo_sleep_event_handler;
ctx->sleep.data = r;
ctx->sleep.log = r->connection->log;

return NGX_OK;
return ctx;
}


Expand Down
3 changes: 1 addition & 2 deletions src/ngx_http_echo_util.h
Expand Up @@ -9,8 +9,7 @@
ngx_strncmp(a, b, sizeof(b) - 1)


ngx_int_t ngx_http_echo_init_ctx(ngx_http_request_t *r,
ngx_http_echo_ctx_t **ctx_ptr);
ngx_http_echo_ctx_t * ngx_http_echo_create_ctx(ngx_http_request_t *r);
ngx_int_t ngx_http_echo_eval_cmd_args(ngx_http_request_t *r,
ngx_http_echo_cmd_t *cmd, ngx_array_t *computed_args,
ngx_array_t *opts);
Expand Down

0 comments on commit 5f3c77b

Please sign in to comment.