regcomp.c: Reorder if to silence valgrind
authorKarl Williamson <public@khwilliamson.com>
Fri, 18 Mar 2011 16:24:04 +0000 (10:24 -0600)
committerKarl Williamson <public@khwilliamson.com>
Fri, 18 Mar 2011 16:36:01 +0000 (10:36 -0600)
It is better to test that a pointer is in bounds before dereferencing it
even though in this case it doesn't lead to an actual error.

regcomp.c

index addc0d0..1e11827 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -9921,8 +9921,10 @@ parseit:
        }
        else {
            prevvalue = value; /* save the beginning of the range */
-           if (*RExC_parse == '-' && RExC_parse+1 < RExC_end &&
-               RExC_parse[1] != ']') {
+           if (RExC_parse+1 < RExC_end
+               && *RExC_parse == '-'
+               && RExC_parse[1] != ']')
+           {
                RExC_parse++;
 
                /* a bad range like \w-, [:word:]- ? */