Skip to content

Commit

Permalink
Avoid double stringification in pp_complement
Browse files Browse the repository at this point in the history
Commit 91bba34 made targets exempt from uninit warnings.  The com-
mit message only says it has something to do with fixing warnings on
bitwise ops.

Commit a1afd10 worked around that by doing an extra stringifica-
tion before assigning to the target, to produce an uninit warning
on purpose.

As far as I can tell, the only purpose of 91bba34 was to avoid the
warning for ~undef.  (I haven’t actually tried building the commit
before that to confirm.)

In any case, the uninit warning has been long tested for and is now
expected behaviour.

Since I am about to remove the uninit warning exemption for targets,
stop relying on that.

This speed ups the code slightly, as we avoid a double string-
ification.
  • Loading branch information
Father Chrysostomos committed Aug 20, 2013
1 parent 3a6ce63 commit 85b0ee6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2315,9 +2315,8 @@ PP(pp_complement)
I32 anum;
STRLEN len;

(void)SvPV_nomg_const(sv,len); /* force check for uninit var */
sv_setsv_nomg(TARG, sv);
tmps = (U8*)SvPV_force_nomg(TARG, len);
sv_copypv_nomg(TARG, sv);
tmps = (U8*)SvPV_nomg(TARG, len);
anum = len;
if (SvUTF8(TARG)) {
/* Calculate exact length, let's not estimate. */
Expand Down

0 comments on commit 85b0ee6

Please sign in to comment.