summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-01-01 06:06:30 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-01-01 08:22:41 -0800
commit841a5e1869a65f80379c03832eaf9887546a9622 (patch)
treee7c982206678fddd09f7889143b5fcdbc0765180
parent6006ebd02a4b62ba7535f6398bbb2d33a9ef46cc (diff)
downloadperl-841a5e1869a65f80379c03832eaf9887546a9622.tar.gz
pp.c: Simplify lc and uc stringification code
Originally, lc and uc would not warn about undef, due to an implemen- tation detail. The implementation changed in 673061948, and extra code was added to keep the behaviour the same. Commit 0a0ffbced enabled the warnings about undef, but did so by added even more code in the midst of the blocks that existed solely to avoid the warning. We can just delete those blocks and put in a simple stringification.
-rw-r--r--pp.c42
1 files changed, 3 insertions, 39 deletions
diff --git a/pp.c b/pp.c
index 471fc358e9..dd4d89a403 100644
--- a/pp.c
+++ b/pp.c
@@ -3480,15 +3480,7 @@ PP(pp_ucfirst)
* UTF-8 or not, but in either case is the number of bytes */
bool tainted = FALSE;
- SvGETMAGIC(source);
- if (SvOK(source)) {
- s = (const U8*)SvPV_nomg_const(source, slen);
- } else {
- if (ckWARN(WARN_UNINITIALIZED))
- report_uninit(source);
- s = (const U8*)"";
- slen = 0;
- }
+ s = (const U8*)SvPV_const(source, slen);
/* We may be able to get away with changing only the first character, in
* place, but not if read-only, etc. Later we may discover more reasons to
@@ -3731,21 +3723,7 @@ PP(pp_uc)
dest = TARG;
- /* The old implementation would copy source into TARG at this point.
- This had the side effect that if source was undef, TARG was now
- an undefined SV with PADTMP set, and they don't warn inside
- sv_2pv_flags(). However, we're now getting the PV direct from
- source, which doesn't have PADTMP set, so it would warn. Hence the
- little games. */
-
- if (SvOK(source)) {
- s = (const U8*)SvPV_nomg_const(source, len);
- } else {
- if (ckWARN(WARN_UNINITIALIZED))
- report_uninit(source);
- s = (const U8*)"";
- len = 0;
- }
+ s = (const U8*)SvPV_nomg_const(source, len);
min = len + 1;
SvUPGRADE(dest, SVt_PV);
@@ -3975,21 +3953,7 @@ PP(pp_lc)
dest = TARG;
- /* The old implementation would copy source into TARG at this point.
- This had the side effect that if source was undef, TARG was now
- an undefined SV with PADTMP set, and they don't warn inside
- sv_2pv_flags(). However, we're now getting the PV direct from
- source, which doesn't have PADTMP set, so it would warn. Hence the
- little games. */
-
- if (SvOK(source)) {
- s = (const U8*)SvPV_nomg_const(source, len);
- } else {
- if (ckWARN(WARN_UNINITIALIZED))
- report_uninit(source);
- s = (const U8*)"";
- len = 0;
- }
+ s = (const U8*)SvPV_nomg_const(source, len);
min = len + 1;
SvUPGRADE(dest, SVt_PV);