Skip to content

Commit

Permalink
style: use forward declaration.
Browse files Browse the repository at this point in the history
Co-authored-by: timzrhuang <timzrhuang@tencent.com>
  • Loading branch information
rodman10 and timzrhuang committed Jan 27, 2023
1 parent 1a48599 commit 992bfc3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ngx_http_lua_socket_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4744,6 +4744,7 @@ ngx_http_lua_socket_read_until(void *data, ssize_t bytes)
u_char c;
u_char *pat;
size_t pat_len;
size_t pending_len;
int i;
int state;
int old_state = 0; /* just to make old
Expand Down Expand Up @@ -4872,13 +4873,12 @@ ngx_http_lua_socket_read_until(void *data, ssize_t bytes)

/* matched */

int pending_bytes = old_state + 1 - state;
pending_len = old_state + 1 - state;

dd("adding pending data: %.*s", (int) pending_bytes,
(char *) pat);
dd("adding pending data: %.*s", (int) pending_len, (char *) pat);

rc = ngx_http_lua_socket_add_pending_data(r, u, b->pos, i, pat,
pending_bytes,
pending_len,
old_state);

if (rc != NGX_OK) {
Expand All @@ -4889,14 +4889,14 @@ ngx_http_lua_socket_read_until(void *data, ssize_t bytes)
i++;

if (u->length) {
if (u->rest <= (size_t) pending_bytes) {
if (u->rest <= pending_len) {
u->rest = 0;
cp->state = state;
b->pos += i;
return NGX_OK;

} else {
u->rest -= pending_bytes;
u->rest -= pending_len;
}
}

Expand Down

0 comments on commit 992bfc3

Please sign in to comment.