summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorAdrian M. Enache <enache@rdslink.ro>2003-08-16 19:03:16 +0300
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-17 08:44:18 +0000
commitff882698b6698d58b88207970341d9a7b204c28d (patch)
tree549c08f0deb10bdcbc91fd13ef5612892be99069 /util.c
parente2ba406b0afaa3ee7f9fb58da681d29a6772e2ed (diff)
downloadperl-ff882698b6698d58b88207970341d9a7b204c28d.tar.gz
[PATCH] Re: [BUG] string loses its utf8 flag on die
Date: Sat, 16 Aug 2003 16:03:16 +0300 Message-ID: <20030816130316.GA1654@ratsnest.hole> Subject: Re: [PATCH] Re: [BUG] string loses its utf8 flag on die From: Enache Adrian <enache@rdslink.ro> Date: Sun, 17 Aug 2003 04:42:22 +0300 Message-ID: <20030817014222.GA1287@ratsnest.hole> p4raw-id: //depot/perl@20747
Diffstat (limited to 'util.c')
-rw-r--r--util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/util.c b/util.c
index aec43548f6..7f38135277 100644
--- a/util.c
+++ b/util.c
@@ -1033,6 +1033,7 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
CV *cv;
SV *msv;
STRLEN msglen;
+ I32 utf8 = 0;
DEBUG_S(PerlIO_printf(Perl_debug_log,
"%p: die: curstack = %p, mainstack = %p\n",
@@ -1047,6 +1048,7 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
}
else
message = SvPV(msv,msglen);
+ utf8 = SvUTF8(msv);
}
else {
message = Nullch;
@@ -1072,6 +1074,7 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
save_re_context();
if (message) {
msg = newSVpvn(message, msglen);
+ SvFLAGS(msg) |= utf8;
SvREADONLY_on(msg);
SAVEFREESV(msg);
}
@@ -1090,6 +1093,7 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
}
PL_restartop = die_where(message, msglen);
+ SvFLAGS(ERRSV) |= utf8;
DEBUG_S(PerlIO_printf(Perl_debug_log,
"%p: die: restartop = %p, was_in_eval = %d, top_env = %p\n",
thr, PL_restartop, was_in_eval, PL_top_env));
@@ -1132,6 +1136,7 @@ Perl_vcroak(pTHX_ const char* pat, va_list *args)
CV *cv;
SV *msv;
STRLEN msglen;
+ I32 utf8 = 0;
if (pat) {
msv = vmess(pat, args);
@@ -1142,6 +1147,7 @@ Perl_vcroak(pTHX_ const char* pat, va_list *args)
}
else
message = SvPV(msv,msglen);
+ utf8 = SvUTF8(msv);
}
else {
message = Nullch;
@@ -1167,6 +1173,7 @@ Perl_vcroak(pTHX_ const char* pat, va_list *args)
save_re_context();
if (message) {
msg = newSVpvn(message, msglen);
+ SvFLAGS(msg) |= utf8;
SvREADONLY_on(msg);
SAVEFREESV(msg);
}
@@ -1185,6 +1192,7 @@ Perl_vcroak(pTHX_ const char* pat, va_list *args)
}
if (PL_in_eval) {
PL_restartop = die_where(message, msglen);
+ SvFLAGS(ERRSV) |= utf8;
JMPENV_JUMP(3);
}
else if (!message)
@@ -1245,8 +1253,10 @@ Perl_vwarn(pTHX_ const char* pat, va_list *args)
CV *cv;
SV *msv;
STRLEN msglen;
+ I32 utf8 = 0;
msv = vmess(pat, args);
+ utf8 = SvUTF8(msv);
message = SvPV(msv, msglen);
if (PL_warnhook) {
@@ -1264,6 +1274,7 @@ Perl_vwarn(pTHX_ const char* pat, va_list *args)
ENTER;
save_re_context();
msg = newSVpvn(message, msglen);
+ SvFLAGS(msg) |= utf8;
SvREADONLY_on(msg);
SAVEFREESV(msg);
@@ -1342,9 +1353,11 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args)
CV *cv;
SV *msv;
STRLEN msglen;
+ I32 utf8 = 0;
msv = vmess(pat, args);
message = SvPV(msv, msglen);
+ utf8 = SvUTF8(msv);
if (ckDEAD(err)) {
if (PL_diehook) {
@@ -1362,6 +1375,7 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args)
ENTER;
save_re_context();
msg = newSVpvn(message, msglen);
+ SvFLAGS(msg) |= utf8;
SvREADONLY_on(msg);
SAVEFREESV(msg);
@@ -1376,6 +1390,7 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args)
}
if (PL_in_eval) {
PL_restartop = die_where(message, msglen);
+ SvFLAGS(ERRSV) |= utf8;
JMPENV_JUMP(3);
}
write_to_stderr(message, msglen);
@@ -1397,6 +1412,7 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args)
ENTER;
save_re_context();
msg = newSVpvn(message, msglen);
+ SvFLAGS(msg) |= utf8;
SvREADONLY_on(msg);
SAVEFREESV(msg);