Skip to content

Commit 89cedfd

Browse files
committed
Fix compiler warnings
1 parent 261b242 commit 89cedfd

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/ngx_http_lua_regex.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,10 +1926,27 @@ ngx_http_lua_ngx_re_sub_helper(lua_State *L, unsigned global)
19261926
}
19271927

19281928

1929+
void
1930+
ngx_http_lua_set_jit_stack_size(int size)
1931+
{
1932+
ngx_http_lua_main_conf_t *lmcf;
1933+
1934+
if (size < NGX_LUA_RE_MIN_JIT_STACK_SIZE) {
1935+
size = NGX_LUA_RE_MIN_JIT_STACK_SIZE;
1936+
}
1937+
1938+
lmcf = ngx_http_cycle_get_module_main_conf(ngx_cycle,
1939+
ngx_http_lua_module);
1940+
// pcre_jit_stack_free(lmcf->jit_stack); // Y U NO WORK?
1941+
lmcf->jit_stack = pcre_jit_stack_alloc(NGX_LUA_RE_MIN_JIT_STACK_SIZE,
1942+
size);
1943+
}
1944+
1945+
19291946
static int
19301947
ngx_http_lua_ngx_re_opt(lua_State *L)
19311948
{
1932-
ngx_str_t option;
1949+
const char *option;
19331950
int nargs;
19341951
int value = 0;
19351952

@@ -1938,10 +1955,10 @@ ngx_http_lua_ngx_re_opt(lua_State *L)
19381955
return luaL_error(L, "expecting two arguments, but got %d", nargs);
19391956
}
19401957

1941-
option.data = (u_char *) luaL_checklstring(L, 1, &option.len);
1958+
option = luaL_checklstring(L, 1, NULL);
19421959
value = luaL_checkint(L, 2);
19431960

1944-
if (strcmp(option.data, "jit_stack_size") == 0) {
1961+
if (strcmp(option, "jit_stack_size") == 0) {
19451962
ngx_http_lua_set_jit_stack_size(value);
19461963
}
19471964

@@ -2515,23 +2532,6 @@ ngx_http_lua_ffi_max_regex_cache_size(void)
25152532
#endif /* NGX_LUA_NO_FFI_API */
25162533

25172534

2518-
void
2519-
ngx_http_lua_set_jit_stack_size(int size)
2520-
{
2521-
ngx_http_lua_main_conf_t *lmcf;
2522-
2523-
if (size < NGX_LUA_RE_MIN_JIT_STACK_SIZE) {
2524-
size = NGX_LUA_RE_MIN_JIT_STACK_SIZE;
2525-
}
2526-
2527-
lmcf = ngx_http_cycle_get_module_main_conf(ngx_cycle,
2528-
ngx_http_lua_module);
2529-
// pcre_jit_stack_free(lmcf->jit_stack); // Y U NO WORK?
2530-
lmcf->jit_stack = pcre_jit_stack_alloc(NGX_LUA_RE_MIN_JIT_STACK_SIZE,
2531-
size);
2532-
}
2533-
2534-
25352535
#endif /* NGX_PCRE */
25362536

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

0 commit comments

Comments
 (0)