diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-25 20:31:54 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-28 00:07:36 -0700 |
commit | b17a067929304f6d2e8d21b1afec3c13df924d29 (patch) | |
tree | 7a65d2cb7916ba2ea8a12e466ab0d6bcdadea27c /pp_ctl.c | |
parent | 72e8be865ba96e46b95723197c54710357d148a3 (diff) | |
download | perl-b17a067929304f6d2e8d21b1afec3c13df924d29.tar.gz |
Reinstate UTF8f
This format string allows char*s to be interpolated with the
utf8ness and length specified as well, avoiding the need to create
extra SVs:
Perl_croak(aTHX_ "Couldn't twiggle the twoggle in \"%"UTF8f"\"",
UTF8fARG(is_utf8, len, s));
This is the second attempt.
I screwed up in commits 1c8b67b38f0a5 and b3e714770ee1 because
I didn’t really understand how varargs functions receive their
arguments.
They are like structs, in that different members can be different
sizes. So therefore both ends--the caller and the called--*must* get
the casts right, or the data will be corrupted.
The main mistake I made was to use %u in the format for the first
argument and then retrieve it as UV (a simple typo, I meant unsigned
int or U32--I don’t remember).
To be on the safe side, I added a UTF8fARG macro (after SVfARG), which
(unlike SVfARG) takes three arguments and casts them explicitly, mak-
ing it much harder to get this wrong at call sites.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -3070,9 +3070,8 @@ PP(pp_goto) PL_lastgotoprobe = gotoprobe; } if (!retop) - DIE(aTHX_ "Can't find label %"SVf, - SVfARG(newSVpvn_flags(label, label_len, - SVs_TEMP | label_flags))); + DIE(aTHX_ "Can't find label %"UTF8f, + UTF8fARG(label_flags, label_len, label)); /* if we're leaving an eval, check before we pop any frames that we're not going to punt, otherwise the error |