Skip to content

Commit efbbdd0

Browse files
committed
massive coding style fixes.
1 parent 4f38019 commit efbbdd0

12 files changed

+135
-46
lines changed

src/ngx_http_srcache_fetch.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
17
#ifndef DDEBUG
28
#define DDEBUG 0
39
#endif
410
#include "ddebug.h"
511

12+
613
#include "ngx_http_srcache_fetch.h"
714
#include "ngx_http_srcache_store.h"
815
#include "ngx_http_srcache_util.h"
@@ -437,7 +444,8 @@ ngx_http_srcache_test_not_modified(ngx_http_request_t *r)
437444
r->headers_in.if_modified_since->value.len);
438445

439446
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
440-
"http ims:%d lm:%d", ims, r->headers_out.last_modified_time);
447+
"srcache ims:%d lm:%d", ims,
448+
r->headers_out.last_modified_time);
441449

442450
if (ims != r->headers_out.last_modified_time) {
443451

@@ -472,7 +480,7 @@ ngx_http_srcache_test_precondition(ngx_http_request_t *r)
472480
r->headers_in.if_unmodified_since->value.len);
473481

474482
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
475-
"http iums:%d lm:%d", iums,
483+
"srcache iums:%d lm:%d", iums,
476484
r->headers_out.last_modified_time);
477485

478486
if (iums >= r->headers_out.last_modified_time) {
@@ -483,3 +491,4 @@ ngx_http_srcache_test_precondition(ngx_http_request_t *r)
483491
NGX_HTTP_PRECONDITION_FAILED);
484492
}
485493

494+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_fetch.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
#ifndef NGX_HTTP_SRCACHE_FETCH_H
2-
#define NGX_HTTP_SRCACHE_FETCH_H
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
7+
#ifndef _NGX_HTTP_SRCACHE_FETCH_H_INCLUDED_
8+
#define _NGX_HTTP_SRCACHE_FETCH_H_INCLUDED_
39

410

511
#include "ngx_http_srcache_filter_module.h"
@@ -11,5 +17,6 @@ ngx_int_t ngx_http_srcache_fetch_post_subrequest(ngx_http_request_t *r,
1117
void *data, ngx_int_t rc);
1218

1319

14-
#endif /* NGX_HTTP_SRCACHE_FETCH_H */
20+
#endif /* _NGX_HTTP_SRCACHE_FETCH_H_INCLUDED_ */
1521

22+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_filter_module.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
17
#ifndef DDEBUG
28
#define DDEBUG 0
39
#endif
410
#include "ddebug.h"
511

6-
/*
7-
* Copyright (C) Zhang "agentzh" Yichun
8-
*/
9-
1012

1113
#include "ngx_http_srcache_filter_module.h"
1214
#include "ngx_http_srcache_util.h"
@@ -26,10 +28,10 @@ static char *ngx_http_srcache_merge_loc_conf(ngx_conf_t *cf, void *parent,
2628
static ngx_int_t ngx_http_srcache_post_config(ngx_conf_t *cf);
2729
static char *ngx_http_srcache_conf_set_request(ngx_conf_t *cf,
2830
ngx_command_t *cmd, void *conf);
29-
30-
static void * ngx_http_srcache_create_main_conf(ngx_conf_t *cf);
31+
static void *ngx_http_srcache_create_main_conf(ngx_conf_t *cf);
3132
static char *ngx_http_srcache_init_main_conf(ngx_conf_t *cf, void *conf);
3233

34+
3335
static char *
3436
ngx_http_srcache_store_statuses(ngx_conf_t *cf, ngx_command_t *cmd,
3537
void *conf);
@@ -606,3 +608,4 @@ ngx_http_srcache_store_statuses(ngx_conf_t *cf, ngx_command_t *cmd,
606608
return NGX_CONF_OK;
607609
}
608610

611+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_filter_module.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
#ifndef NGX_HTTP_SRCACHE_FILTER_MODULE_H
2-
#define NGX_HTTP_SRCACHE_FILTER_MODULE_H
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
7+
#ifndef _NGX_HTTP_SRCACHE_FILTER_MODULE_H_INCLUDED_
8+
#define _NGX_HTTP_SRCACHE_FILTER_MODULE_H_INCLUDED_
39

410

511
#include <ngx_core.h>
@@ -137,5 +143,6 @@ struct ngx_http_srcache_postponed_request_s {
137143
};
138144

139145

140-
#endif
146+
#endif /* _NGX_HTTP_SRCACHE_FILTER_MODULE_H_INCLUDED_ */
141147

148+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_headers.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
17
#ifndef DDEBUG
28
#define DDEBUG 0
39
#endif
410
#include "ddebug.h"
511

12+
613
#include "ngx_http_srcache_headers.h"
714

815

@@ -309,3 +316,4 @@ ngx_http_srcache_process_content_encoding(ngx_http_request_t *r,
309316

310317
#endif
311318

319+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_headers.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
#ifndef NGX_HTTP_SRCACHE_HEADERS_H
2-
#define NGX_HTTP_SRCACHE_HEADERS_H
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
7+
#ifndef _NGX_HTTP_SRCACHE_HEADERS_H_INCLUDED_
8+
#define _NGX_HTTP_SRCACHE_HEADERS_H_INCLUDED_
39

410

511
#include "ngx_http_srcache_filter_module.h"
@@ -19,5 +25,6 @@ ngx_int_t ngx_http_srcache_process_header_line(ngx_http_request_t *r,
1925
ngx_table_elt_t *h, ngx_uint_t offset);
2026

2127

22-
#endif /* NGX_HTTP_SRCACHE_HEADERS_H */
28+
#endif /* _NGX_HTTP_SRCACHE_HEADERS_H_INCLUDED_ */
2329

30+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_store.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
17
#ifndef DDEBUG
28
#define DDEBUG 0
39
#endif
410
#include "ddebug.h"
511

12+
613
#include "ngx_http_srcache_store.h"
714
#include "ngx_http_srcache_fetch.h"
815
#include "ngx_http_srcache_util.h"
@@ -608,3 +615,4 @@ ngx_http_srcache_filter_init(ngx_conf_t *cf)
608615
return NGX_OK;
609616
}
610617

618+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_store.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
#ifndef NGX_HTTP_SRCACHE_STORE_H
2-
#define NGX_HTTP_SRCACHE_STORE_H
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
7+
#ifndef _NGX_HTTP_SRCACHE_STORE_H_INCLUDED_
8+
#define _NGX_HTTP_SRCACHE_STORE_H_INCLUDED_
39

410

511
#include "ngx_http_srcache_filter_module.h"
@@ -12,5 +18,6 @@ extern ngx_http_output_body_filter_pt ngx_http_srcache_next_body_filter;
1218
ngx_int_t ngx_http_srcache_filter_init(ngx_conf_t *cf);
1319

1420

15-
#endif /* NGX_HTTP_SRCACHE_STORE_H */
21+
#endif /* _NGX_HTTP_SRCACHE_STORE_H_INCLUDED_ */
1622

23+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

src/ngx_http_srcache_util.c

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
2+
/*
3+
* Copyright (C) Yichun Zhang (agentzh)
4+
*/
5+
6+
17
#ifndef DDEBUG
28
#define DDEBUG 0
39
#endif
410
#include "ddebug.h"
511

12+
613
#include "ngx_http_srcache_util.h"
714
#include "ngx_http_srcache_headers.h"
815

@@ -225,7 +232,7 @@ ngx_http_srcache_parse_method_name(ngx_str_t **method_name_ptr)
225232

226233
case 9:
227234
if (ngx_http_srcache_strcmp_const(method_name->data, "PROPPATCH")
228-
== 0)
235+
== 0)
229236
{
230237
*method_name_ptr = &ngx_http_srcache_proppatch_method;
231238
return NGX_HTTP_PROPPATCH;
@@ -243,7 +250,7 @@ ngx_http_srcache_parse_method_name(ngx_str_t **method_name_ptr)
243250

244251
ngx_int_t
245252
ngx_http_srcache_adjust_subrequest(ngx_http_request_t *sr,
246-
ngx_http_srcache_parsed_request_t *parsed_sr)
253+
ngx_http_srcache_parsed_request_t *parsed_sr)
247254
{
248255
ngx_http_core_main_conf_t *cmcf;
249256
ngx_http_request_t *r;
@@ -256,7 +263,7 @@ ngx_http_srcache_adjust_subrequest(ngx_http_request_t *sr,
256263
r = sr->parent;
257264

258265
dd("subrequest method: %d %.*s", (int) sr->method,
259-
(int) sr->method_name.len, sr->method_name.data);
266+
(int) sr->method_name.len, sr->method_name.data);
260267

261268
sr->header_in = r->header_in;
262269

@@ -270,7 +277,7 @@ ngx_http_srcache_adjust_subrequest(ngx_http_request_t *sr,
270277
/* we do not inherit the parent request's variables */
271278
cmcf = ngx_http_get_module_main_conf(sr, ngx_http_core_module);
272279
sr->variables = ngx_pcalloc(sr->pool, cmcf->variables.nelts
273-
* sizeof(ngx_http_variable_value_t));
280+
* sizeof(ngx_http_variable_value_t));
274281

275282
if (sr->variables == NULL) {
276283
return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -281,7 +288,7 @@ ngx_http_srcache_adjust_subrequest(ngx_http_request_t *sr,
281288
sr->request_body = body;
282289

283290
rc = ngx_http_srcache_set_content_length_header(sr,
284-
parsed_sr->content_length_n);
291+
parsed_sr->content_length_n);
285292

286293
if (rc != NGX_OK) {
287294
return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -350,7 +357,7 @@ ngx_http_srcache_add_copy_chain(ngx_pool_t *pool, ngx_chain_t **chain,
350357

351358
ngx_int_t
352359
ngx_http_srcache_post_request_at_head(ngx_http_request_t *r,
353-
ngx_http_posted_request_t *pr)
360+
ngx_http_posted_request_t *pr)
354361
{
355362
dd_enter();
356363

@@ -381,7 +388,9 @@ ngx_http_srcache_set_content_length_header(ngx_http_request_t *r, off_t len)
381388
r->headers_in.content_length_n = len;
382389

383390
if (ngx_list_init(&r->headers_in.headers, r->pool, 20,
384-
sizeof(ngx_table_elt_t)) != NGX_OK) {
391+
sizeof(ngx_table_elt_t))
392+
!= NGX_OK)
393+
{
385394
return NGX_ERROR;
386395
}
387396

@@ -415,8 +424,8 @@ ngx_http_srcache_set_content_length_header(ngx_http_request_t *r, off_t len)
415424
'n'), 'g'), 't'), 'h');
416425

417426
dd("r content length: %.*s",
418-
(int)r->headers_in.content_length->value.len,
419-
r->headers_in.content_length->value.data);
427+
(int)r->headers_in.content_length->value.len,
428+
r->headers_in.content_length->value.data);
420429

421430
pr = r->parent;
422431

@@ -441,9 +450,10 @@ ngx_http_srcache_set_content_length_header(ngx_http_request_t *r, off_t len)
441450
i = 0;
442451
}
443452

444-
if (header[i].key.len == sizeof("Content-Length") - 1 &&
445-
ngx_strncasecmp(header[i].key.data, (u_char *) "Content-Length",
446-
sizeof("Content-Length") - 1) == 0)
453+
if (header[i].key.len == sizeof("Content-Length") - 1
454+
&& ngx_strncasecmp(header[i].key.data,
455+
(u_char *) "Content-Length",
456+
sizeof("Content-Length") - 1) == 0)
447457
{
448458
continue;
449459
}
@@ -493,14 +503,14 @@ ngx_http_srcache_request_no_cache(ngx_http_request_t *r, unsigned *no_store)
493503

494504
if (h[i].key.len == sizeof("Cache-Control") - 1
495505
&& ngx_strncasecmp(h[i].key.data, (u_char *) "Cache-Control",
496-
sizeof("Cache-Control") - 1) == 0)
506+
sizeof("Cache-Control") - 1) == 0)
497507
{
498508
p = h[i].value.data;
499509
last = p + h[i].value.len;
500510

501511
if (!*no_store
502512
&& ngx_strlcasestrn(p, last, (u_char *) "no-store", 8 - 1)
503-
!= NULL)
513+
!= NULL)
504514
{
505515
*no_store = 1;
506516
}
@@ -515,7 +525,7 @@ ngx_http_srcache_request_no_cache(ngx_http_request_t *r, unsigned *no_store)
515525

516526
if (h[i].key.len == sizeof("Pragma") - 1
517527
&& ngx_strncasecmp(h[i].key.data, (u_char *) "Pragma",
518-
sizeof("Pragma") - 1) == 0)
528+
sizeof("Pragma") - 1) == 0)
519529
{
520530
p = h[i].value.data;
521531
last = p + h[i].value.len;
@@ -712,7 +722,7 @@ ngx_http_srcache_process_header(ngx_http_request_t *r, ngx_buf_t *b)
712722
}
713723

714724
ctx->header_buf->last = ngx_copy(ctx->header_buf->last, b->pos,
715-
(size_t) len);
725+
(size_t) len);
716726

717727
p = ctx->header_buf->pos;
718728

@@ -732,16 +742,17 @@ ngx_http_srcache_process_header(ngx_http_request_t *r, ngx_buf_t *b)
732742
header.value.len = r->header_end - r->header_start;
733743

734744
header.key.data = ngx_pnalloc(r->pool,
735-
header.key.len + 1 + header.value.len + 1
736-
+ header.key.len);
745+
header.key.len + 1
746+
+ header.value.len + 1
747+
+ header.key.len);
737748

738749
if (header.key.data == NULL) {
739750
return NGX_ERROR;
740751
}
741752

742753
header.value.data = header.key.data + header.key.len + 1;
743754
header.lowcase_key = header.key.data + header.key.len + 1
744-
+ header.value.len + 1;
755+
+ header.value.len + 1;
745756

746757
ngx_cpystrn(header.key.data, r->header_name_start,
747758
header.key.len + 1);
@@ -831,7 +842,7 @@ ngx_http_srcache_process_header(ngx_http_request_t *r, ngx_buf_t *b)
831842

832843
ngx_int_t
833844
ngx_http_srcache_store_response_header(ngx_http_request_t *r,
834-
ngx_http_srcache_ctx_t *ctx)
845+
ngx_http_srcache_ctx_t *ctx)
835846
{
836847
ngx_chain_t *cl;
837848
size_t len;
@@ -1264,3 +1275,4 @@ ngx_http_srcache_cmp_int(const void *one, const void *two)
12641275
return (*a < *b);
12651276
}
12661277

1278+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

0 commit comments

Comments
 (0)