S_pmtrans(): always use op_private flag variables
authorDavid Mitchell <davem@iabyn.com>
Mon, 8 Jan 2018 15:42:23 +0000 (15:42 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 19 Jan 2018 11:24:55 +0000 (11:24 +0000)
Various flag vars are set early on, such as:

    const I32 complement = o->op_private & OPpTRANS_COMPLEMENT;

but sometimes these vars weren't being used, and op_private was being
tested again.

op.c

diff --git a/op.c b/op.c
index dd44311..6504ef0 100644 (file)
--- a/op.c
+++ b/op.c
@@ -6632,9 +6632,8 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
     tbl = (short*)PerlMemShared_calloc(
                     /* one slot for 'extra len' count and one slot
                      * for possible storing of last replacement char */
-       (o->op_private & OPpTRANS_COMPLEMENT) &&
-           !(o->op_private & OPpTRANS_DELETE) ? 258 : 256,
-       sizeof(short));
+                    (complement && !del) ? 258 : 256,
+                    sizeof(short));
     cPVOPo->op_pv = (char*)tbl;
 
     if (complement) {