diff options
author | Gisle Aas <gisle@activestate.com> | 2006-01-27 08:49:34 +0000 |
---|---|---|
committer | Gisle Aas <gisle@activestate.com> | 2006-01-27 08:49:34 +0000 |
commit | eae92ea03dd0fc112e5aeae640f2e5f76eddcd7e (patch) | |
tree | ec5af003bfeaecd9ef531d33383f22333170abcb /mg.c | |
parent | 8e6b4db615e712f1ce0853278b06e6a52c1c0df2 (diff) | |
download | perl-eae92ea03dd0fc112e5aeae640f2e5f76eddcd7e.tar.gz |
Safer implementation of RTRIM().
Don't rely on SvCUR to be sane unless SvPOK.
p4raw-id: //depot/perl@26953
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -641,9 +641,9 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) } #define SvRTRIM(sv) STMT_START { \ - STRLEN len = SvCUR(sv); \ - char * const p = SvPVX(sv); \ - if (p) { \ + if (SvPOK(sv)) { \ + STRLEN len = SvCUR(sv); \ + char * const p = SvPVX(sv); \ while (len > 0 && isSPACE(p[len-1])) \ --len; \ SvCUR_set(sv, len); \ |