This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regmatch(): avoid 'may be used uninitialized' msg
authorDavid Mitchell <davem@iabyn.com>
Sun, 10 Jun 2012 21:29:08 +0000 (22:29 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 13 Jun 2012 12:32:57 +0000 (13:32 +0100)
Hoist a NULL assignment into a wider scope than is strictly necessary,
in order to avoid a spurious compiler warning.

regexec.c

index 41331e7..702a5c7 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -4411,6 +4411,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
 
                PL_op = NULL;
 
+                re_sv = NULL;
                if (logical == 0)        /*   (?{})/   */
                    sv_setsv(save_scalar(PL_replgv), ret); /* $^R */
                else if (logical == 1) { /*   /(?(?{...})X|Y)/    */
@@ -4418,7 +4419,6 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
                    logical = 0;
                }
                else {                   /*  /(??{})  */
-                   re_sv = NULL;
                    /*  if its overloaded, let the regex compiler handle
                     *  it; otherwise extract regex, or stringify  */
                    if (!SvAMAGIC(ret)) {