fixed a gcc compilation warning for pcre < 8.20.

This commit is contained in:
agentzh (章亦春) 2011-11-20 23:06:42 +08:00
Родитель 99f45c46c4
Коммит 4db4603b17
4 изменённых файлов: 28 добавлений и 10 удалений

Просмотреть файл

@ -34,7 +34,9 @@ static int ngx_http_lua_ngx_re_match(lua_State *L);
static int ngx_http_lua_ngx_re_gmatch(lua_State *L);
static int ngx_http_lua_ngx_re_sub(lua_State *L);
static int ngx_http_lua_ngx_re_gsub(lua_State *L);
#if LUA_HAVE_PCRE_JIT
static void ngx_http_lua_cleanup_pcre_study_data(void *data);
#endif
#define NGX_LUA_RE_COMPILE_ONCE (1<<0)
@ -1698,6 +1700,7 @@ ngx_http_lua_inject_regex_api(lua_State *L)
}
#if LUA_HAVE_PCRE_JIT
static void
ngx_http_lua_cleanup_pcre_study_data(void *data)
{
@ -1719,11 +1722,7 @@ ngx_http_lua_cleanup_pcre_study_data(void *data)
old_pool = ngx_http_lua_pcre_pool;
ngx_http_lua_pcre_pool = pool;
#if LUA_HAVE_PCRE_JIT
pcre_free_study(sd);
#else
pcre_free(sd);
#endif
ngx_http_lua_pcre_pool = old_pool;
return;
@ -1739,6 +1738,7 @@ ngx_http_lua_cleanup_pcre_study_data(void *data)
ngx_http_lua_pcre_malloc_done();
}
#endif /* LUA_HAVE_PCRE_JIT */
#endif /* NGX_PCRE */

Просмотреть файл

@ -198,7 +198,11 @@ hello
--- config
location /re {
content_by_lua '
m = ngx.re.match("hello章亦春", "HELLO.{2}", "iou")
local rc, m = pcall(ngx.re.match, "hello章亦春", "HELLO.{2}", "iou")
if not rc then
ngx.say("error: ", m)
return
end
if m then
ngx.say(m[0])
else
@ -208,8 +212,8 @@ hello
}
--- request
GET /re
--- response_body
hello章亦
--- response_body_like chop
this version of PCRE is not compiled with PCRE_UTF8 support|^hello章亦$

Просмотреть файл

@ -9,7 +9,7 @@ use Test::Nginx::Socket;
repeat_each(2);
plan tests => repeat_each() * (blocks() * 2 + 1);
plan tests => repeat_each() * (blocks() * 2 + 8);
#no_diff();
#no_long_string();
@ -61,6 +61,8 @@ pcre JIT compiling result: 1
nil
nil
nil
--- error_log
pcre JIT compiling result: 1
@ -76,6 +78,8 @@ nil
GET /re
--- response_body
done
--- error_log
pcre JIT compiling result: 1
@ -96,6 +100,8 @@ done
GET /re
--- response_body
hello
--- error_log
pcre JIT compiling result: 1
@ -117,6 +123,8 @@ hello
--- response_body
hello
world
--- error_log
pcre JIT compiling result: 1
@ -141,6 +149,8 @@ world
nil
nil
nil
--- error_log
pcre JIT compiling result: 1
@ -156,6 +166,8 @@ nil
GET /re
--- response_body
done
--- error_log
pcre JIT compiling result: 1
@ -176,6 +188,8 @@ done
GET /re
--- response_body
hello
--- error_log
pcre JIT compiling result: 1

Просмотреть файл

@ -16,8 +16,8 @@ ngx-build $force $version \
--with-http_ssl_module \
--add-module=$root/../ndk-nginx-module \
--add-module=$root/../set-misc-nginx-module \
--with-cc-opt=$'-O0 -I/opt/pcre820jit/include' \
--with-ld-opt="-L/opt/pcre820jit/lib -Wl,-rpath,/opt/pcre820jit/lib:/opt/drizzle/lib:/usr/local/lib:/home/lz/lib:/usr/local/openresty/luajit/lib" \
--with-cc-opt=$'-O0 -I/opt/pcre60/include' \
--with-ld-opt="-L/opt/pcre60/lib -Wl,-rpath,/opt/pcre60/lib:/opt/drizzle/lib:/usr/local/lib:/home/lz/lib:/usr/local/openresty/luajit/lib" \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \