Skip to content

style: fixed some of the code style issues and add style check for ci. #1916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ before_script:
- mysql -uroot -e 'create database ngx_test; grant all on ngx_test.* to "ngx_test"@"%" identified by "ngx_test"; flush privileges;'

script:
- export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
- ngx-releng > check.txt || true
- lines=`wc -l check.txt | awk '{print $1}'`; if [ $lines -gt 13 ]; then cat check.txt; exit 1; fi
- sudo iptables -I OUTPUT 1 -p udp --dport 10086 -j REJECT
- sudo iptables -I OUTPUT -p tcp --dst 127.0.0.2 --dport 12345 -j DROP
- sudo iptables -I OUTPUT -p udp --dst 127.0.0.2 --dport 12345 -j DROP
Expand Down Expand Up @@ -123,7 +126,6 @@ script:
- make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
- sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1)
- cd ..
- export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
- export NGX_BUILD_CC=$CC
- sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1)
- nginx -V
Expand Down
6 changes: 4 additions & 2 deletions src/ngx_http_lua_bodyfilterby.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ ngx_http_lua_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
}

if (in != NULL
&& ngx_chain_add_copy(r->pool, &ctx->filter_in_bufs, in) != NGX_OK) {
&& ngx_chain_add_copy(r->pool, &ctx->filter_in_bufs, in) != NGX_OK)
{
return NGX_ERROR;
}

Expand Down Expand Up @@ -301,7 +302,8 @@ ngx_http_lua_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
if (rc != NGX_OK
&& ctx->filter_busy_bufs != NULL
&& (r->connection->buffered
& (NGX_HTTP_LOWLEVEL_BUFFERED | NGX_LOWLEVEL_BUFFERED))) {
& (NGX_HTTP_LOWLEVEL_BUFFERED | NGX_LOWLEVEL_BUFFERED)))
{
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"waiting body filter busy buffer to be sent");
return NGX_AGAIN;
Expand Down
3 changes: 2 additions & 1 deletion src/ngx_http_lua_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,8 @@ ngx_http_lua_set_ssl(ngx_conf_t *cf, ngx_http_lua_loc_conf_t *llcf)

#if (nginx_version >= 1019004)
if (ngx_ssl_conf_commands(cf, llcf->ssl, llcf->ssl_conf_commands)
!= NGX_OK) {
!= NGX_OK)
{
return NGX_ERROR;
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/ngx_http_lua_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ static int
ngx_http_lua_execvpe(const char *program, char * const argv[],
char * const envp[])
{
int rc;
char **saved = environ;
int rc;

environ = (char **) envp;
rc = execvp(program, argv);
Expand Down
2 changes: 1 addition & 1 deletion src/ngx_http_lua_ssl_session_fetchby.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ ngx_http_lua_log_ssl_sess_fetch_error(ngx_log_t *log, u_char *buf, size_t len)
}

if (c->listening && c->listening->addr_text.len) {
p = ngx_snprintf(buf, len, ", server: %V", \
p = ngx_snprintf(buf, len, ", server: %V",
&c->listening->addr_text);
buf = p;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ngx_http_lua_ssl_session_storeby.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ ngx_http_lua_log_ssl_sess_store_error(ngx_log_t *log, u_char *buf, size_t len)
}

if (c->listening && c->listening->addr_text.len) {
p = ngx_snprintf(buf, len, ", server: %V", \
p = ngx_snprintf(buf, len, ", server: %V",
&c->listening->addr_text);
buf = p;
}
Expand Down
12 changes: 9 additions & 3 deletions src/ngx_http_lua_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@ ngx_http_lua_new_thread(ngx_http_request_t *r, lua_State *L, int *ref)
if (!lua_isnil(L, -1) && !lua_isnil(L, -2)) {
n++;
}

lua_pop(L, 1);
}

lua_pop(L, 1);

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


static int
ngx_http_lua_util_hex2int(char xdigit)
{
Expand All @@ -2214,14 +2217,15 @@ ngx_http_lua_util_hex2int(char xdigit)
return -1;
}


/* XXX we also decode '+' to ' ' */
void
ngx_http_lua_unescape_uri(u_char **dst, u_char **src, size_t size,
ngx_uint_t type)
{
u_char *d = *dst, *s = *src, *de = (*dst+size);
int isuri = type & NGX_UNESCAPE_URI;
int isredirect = type & NGX_UNESCAPE_REDIRECT;
u_char *d = *dst, *s = *src, *de = (*dst + size);
int isuri = type & NGX_UNESCAPE_URI;
int isredirect = type & NGX_UNESCAPE_REDIRECT;

while (size--) {
u_char curr = *s++;
Expand All @@ -2245,10 +2249,12 @@ ngx_http_lua_unescape_uri(u_char **dst, u_char **src, size_t size,
if ((isuri || isredirect) && ch == '?') {
*d++ = ch;
break;

} else if (isredirect && (ch <= '%' || ch >= 0x7f)) {
*d++ = '%';
continue;
}

*d++ = ch;
s += 2;
size -= 2;
Expand Down
2 changes: 1 addition & 1 deletion src/ngx_http_lua_worker_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ngx_http_lua_free_task_ctx(ngx_http_lua_task_ctx_t *ctx)

static int
ngx_http_lua_xcopy(lua_State *from, lua_State *to, int idx,
const int allow_nil)
const int allow_nil)
{
size_t len = 0;
const char *str;
Expand Down