develooper Front page | perl.perl5.porters | Postings from August 2010

[PATCH] Re: [perl #76814] FETCH called twice.

Thread Next
From:
Father Chrysostomos
Date:
August 1, 2010 12:15
Subject:
[PATCH] Re: [perl #76814] FETCH called twice.
Message ID:
7F1488E4-14FF-4426-B478-7CBE2EC3ABE3@cpan.org
• The first patch fixes string comparison operators. It changes sv_eq, sv_cmp, sv_cmp_locale and sv_collxfrm to _flags forms, with macros under the old names for sv_eq and sv_collxfrm, but functions for sv_cmp* since pp_sort.c needs them.

• The second patch fixes ! by doing the same thing to sv_2bool and adding SvTRUE_nomg. It also corrects the docs that state incorrectly that SvTRUE does not handle magic.

• The third patch fixes m and s. It modifies pp_regcomp to avoid extra magic. It also corrects a bug in sv_catsv_flags, which would still call mg_get(ssv) even without the SV_GMAGIC flag set.

• The fourth patch fixes y. (This has caused double magick at least as far back as 5.6.2.)

• The || case is not a bug, as there are two separate operators operating on it in the test script. In

  $dummy = $x || $y

The || does mg_get($x). If it’s true it returns it and the = does mg_get($x). If $x is false, then $y is returned, so magic is called once on each of $x and $y. Similarly, && will seemingly call mg_get($x) twice if $x is false.

If you just write:

  $x || $y

then magic is only called once on $x.

The fifth patch attached hereto corrects the test.

• The sixth attachment is not a patch, but a text file of entries to be copied and pasted into perldelta, patches for which go stale too quickly.

Let’s see whether I remember the attachments....


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About