Fix warning (turning error) when compiling with -O3

In file included from /home/jmayer/work/wireshark/git/epan/wslua/lrexlib_glib.c:199:0:
/home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h: In function ‘generic_find_func’:
/home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h:486:14: error: ‘ud’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   TUserdata *ud;
              ^
/home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h: In function ‘algf_gsub’:
/home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h:281:14: error: ‘ud’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   TUserdata *ud;
              ^

Change-Id: I835103ea562ced44bc3cce5fadf6115476a78d0e
Reviewed-on: https://code.wireshark.org/review/3568
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
This commit is contained in:
Joerg Mayer 2014-08-13 07:59:35 +02:00 committed by Jörg Mayer
parent d9e5021fe7
commit f59e69489d
1 changed files with 3 additions and 1 deletions

View File

@ -260,10 +260,12 @@ static int compile_regex (lua_State *L, const TArgComp *argC, TGrgx **pud) {
ud->pr = g_regex_new (argC->pattern,
(GRegexCompileFlags)(argC->cflags | G_REGEX_RAW), (GRegexMatchFlags)0, &ud->error);
if (pud) *pud = ud;
if (!ud->pr)
return luaL_error (L, "%s (code: %d)", ud->error->message, ud->error->code);
if (pud) *pud = ud;
return 1;
}