Skip to content

Commit 776f829

Browse files
style: fixed some of the code style issues and add code style checking for the ci. (#1916)
1 parent 3820d0e commit 776f829

8 files changed

+22
-11
lines changed

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ before_script:
9696
- mysql -uroot -e 'create database ngx_test; grant all on ngx_test.* to "ngx_test"@"%" identified by "ngx_test"; flush privileges;'
9797

9898
script:
99+
- export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
100+
- ngx-releng > check.txt || true
101+
- lines=`wc -l check.txt | awk '{print $1}'`; if [ $lines -gt 13 ]; then cat check.txt; exit 1; fi
99102
- sudo iptables -I OUTPUT 1 -p udp --dport 10086 -j REJECT
100103
- sudo iptables -I OUTPUT -p tcp --dst 127.0.0.2 --dport 12345 -j DROP
101104
- sudo iptables -I OUTPUT -p udp --dst 127.0.0.2 --dport 12345 -j DROP
@@ -123,7 +126,6 @@ script:
123126
- make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
124127
- sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1)
125128
- cd ..
126-
- export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
127129
- export NGX_BUILD_CC=$CC
128130
- sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1)
129131
- nginx -V

src/ngx_http_lua_bodyfilterby.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ ngx_http_lua_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
272272
}
273273

274274
if (in != NULL
275-
&& ngx_chain_add_copy(r->pool, &ctx->filter_in_bufs, in) != NGX_OK) {
275+
&& ngx_chain_add_copy(r->pool, &ctx->filter_in_bufs, in) != NGX_OK)
276+
{
276277
return NGX_ERROR;
277278
}
278279

@@ -301,7 +302,8 @@ ngx_http_lua_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
301302
if (rc != NGX_OK
302303
&& ctx->filter_busy_bufs != NULL
303304
&& (r->connection->buffered
304-
& (NGX_HTTP_LOWLEVEL_BUFFERED | NGX_LOWLEVEL_BUFFERED))) {
305+
& (NGX_HTTP_LOWLEVEL_BUFFERED | NGX_LOWLEVEL_BUFFERED)))
306+
{
305307
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
306308
"waiting body filter busy buffer to be sent");
307309
return NGX_AGAIN;

src/ngx_http_lua_module.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,8 @@ ngx_http_lua_set_ssl(ngx_conf_t *cf, ngx_http_lua_loc_conf_t *llcf)
14591459

14601460
#if (nginx_version >= 1019004)
14611461
if (ngx_ssl_conf_commands(cf, llcf->ssl, llcf->ssl_conf_commands)
1462-
!= NGX_OK) {
1462+
!= NGX_OK)
1463+
{
14631464
return NGX_ERROR;
14641465
}
14651466
#endif

src/ngx_http_lua_pipe.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ static int
550550
ngx_http_lua_execvpe(const char *program, char * const argv[],
551551
char * const envp[])
552552
{
553+
int rc;
553554
char **saved = environ;
554-
int rc;
555555

556556
environ = (char **) envp;
557557
rc = execvp(program, argv);

src/ngx_http_lua_ssl_session_fetchby.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ ngx_http_lua_log_ssl_sess_fetch_error(ngx_log_t *log, u_char *buf, size_t len)
450450
}
451451

452452
if (c->listening && c->listening->addr_text.len) {
453-
p = ngx_snprintf(buf, len, ", server: %V", \
453+
p = ngx_snprintf(buf, len, ", server: %V",
454454
&c->listening->addr_text);
455455
buf = p;
456456
}

src/ngx_http_lua_ssl_session_storeby.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ ngx_http_lua_log_ssl_sess_store_error(ngx_log_t *log, u_char *buf, size_t len)
336336
}
337337

338338
if (c->listening && c->listening->addr_text.len) {
339-
p = ngx_snprintf(buf, len, ", server: %V", \
339+
p = ngx_snprintf(buf, len, ", server: %V",
340340
&c->listening->addr_text);
341341
buf = p;
342342
}

src/ngx_http_lua_util.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,10 @@ ngx_http_lua_new_thread(ngx_http_request_t *r, lua_State *L, int *ref)
376376
if (!lua_isnil(L, -1) && !lua_isnil(L, -2)) {
377377
n++;
378378
}
379+
379380
lua_pop(L, 1);
380381
}
382+
381383
lua_pop(L, 1);
382384

383385
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -2199,6 +2201,7 @@ ngx_http_lua_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type)
21992201
return (uintptr_t) dst;
22002202
}
22012203

2204+
22022205
static int
22032206
ngx_http_lua_util_hex2int(char xdigit)
22042207
{
@@ -2214,14 +2217,15 @@ ngx_http_lua_util_hex2int(char xdigit)
22142217
return -1;
22152218
}
22162219

2220+
22172221
/* XXX we also decode '+' to ' ' */
22182222
void
22192223
ngx_http_lua_unescape_uri(u_char **dst, u_char **src, size_t size,
22202224
ngx_uint_t type)
22212225
{
2222-
u_char *d = *dst, *s = *src, *de = (*dst+size);
2223-
int isuri = type & NGX_UNESCAPE_URI;
2224-
int isredirect = type & NGX_UNESCAPE_REDIRECT;
2226+
u_char *d = *dst, *s = *src, *de = (*dst + size);
2227+
int isuri = type & NGX_UNESCAPE_URI;
2228+
int isredirect = type & NGX_UNESCAPE_REDIRECT;
22252229

22262230
while (size--) {
22272231
u_char curr = *s++;
@@ -2245,10 +2249,12 @@ ngx_http_lua_unescape_uri(u_char **dst, u_char **src, size_t size,
22452249
if ((isuri || isredirect) && ch == '?') {
22462250
*d++ = ch;
22472251
break;
2252+
22482253
} else if (isredirect && (ch <= '%' || ch >= 0x7f)) {
22492254
*d++ = '%';
22502255
continue;
22512256
}
2257+
22522258
*d++ = ch;
22532259
s += 2;
22542260
size -= 2;

src/ngx_http_lua_worker_thread.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ ngx_http_lua_free_task_ctx(ngx_http_lua_task_ctx_t *ctx)
153153

154154
static int
155155
ngx_http_lua_xcopy(lua_State *from, lua_State *to, int idx,
156-
const int allow_nil)
156+
const int allow_nil)
157157
{
158158
size_t len = 0;
159159
const char *str;

0 commit comments

Comments
 (0)