regcomp.c: Use an equivalent 'if' condition
authorKarl Williamson <khw@cpan.org>
Sun, 14 Oct 2018 22:02:09 +0000 (16:02 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 20 Oct 2018 06:09:55 +0000 (00:09 -0600)
By inspection of the code, I see that this 'if' won't get executed
unless the variable is non-null.  The function whose return sets it
will raise an error if it would otherwise return NULL unexpectedly.

regcomp.c

index b5f7bb4..299ab21 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10719,10 +10719,10 @@ S_handle_named_backref(pTHX_ RExC_state_t *pRExC_state,
         vFAIL2("Sequence %.3s... not terminated", parse_start);
     }
 
-    if (!SIZE_ONLY) {
+    if (sv_dat) {
         num = add_data( pRExC_state, STR_WITH_LEN("S"));
         RExC_rxi->data->data[num]=(void*)sv_dat;
-        SvREFCNT_inc_simple_void(sv_dat);
+        SvREFCNT_inc_simple_void_NN(sv_dat);
     }
     RExC_sawback = 1;
     ret = reganode(pRExC_state,