summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-06-25 20:31:54 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-06-28 00:07:36 -0700
commitb17a067929304f6d2e8d21b1afec3c13df924d29 (patch)
tree7a65d2cb7916ba2ea8a12e466ab0d6bcdadea27c /pp_ctl.c
parent72e8be865ba96e46b95723197c54710357d148a3 (diff)
downloadperl-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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index f68336afe3..d8f63b7356 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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