diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-01-13 20:58:56 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-01-13 20:58:56 +0000 |
commit | 656266fc5211f7fea3afa655730ed10f45b205ea (patch) | |
tree | df8da2d4aa9f99e52257fb4e461fc575b0a0e7ce /pp.c | |
parent | 7637cd0734b6068e23bb0804d6e84410ea017c73 (diff) | |
download | perl-656266fc5211f7fea3afa655730ed10f45b205ea.tar.gz |
Re-order so that the !SvOK() case is last (which should be rare)
Remove the FIXME comment as I had already fixed it.
p4raw-id: //depot/perl@32971
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -3018,11 +3018,7 @@ PP(pp_length) dVAR; dSP; dTARGET; SV * const sv = TOPs; - if (!SvOK(sv) && !SvGMAGICAL(sv)) { - /* FIXME - this doesn't allow GMAGIC to return undef for consistency. - */ - SETs(&PL_sv_undef); - } else if (SvGAMAGIC(sv)) { + if (SvGAMAGIC(sv)) { /* For an overloaded or magic scalar, we can't know in advance if it's going to be UTF-8 or not. Also, we can't call sv_len_utf8 as it likes to cache the length. Maybe that should be a documented @@ -3040,12 +3036,14 @@ PP(pp_length) } else SETi(len); - } else { + } else if (SvOK(sv)) { /* Neither magic nor overloaded. */ if (DO_UTF8(sv)) SETi(sv_len_utf8(sv)); else SETi(sv_len(sv)); + } else { + SETs(&PL_sv_undef); } RETURN; } |