diff options
author | Steve Hay <SteveHay@planit.com> | 2005-06-21 13:49:10 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2005-06-21 13:49:10 +0000 |
commit | ad3296c668b2eed14533c1cf4b03090043289701 (patch) | |
tree | 04b008c28d1626e32499c5468b55d0d3d81ae1b9 /mg.c | |
parent | 6a76db8b55b6281740baab9e0ef221938c776ccd (diff) | |
download | perl-ad3296c668b2eed14533c1cf4b03090043289701.tar.gz |
Trim trailing whitespace from $! and $^E
(Fixes lib/Test/Simple/t/fail-more.t with bcc32 on Win32, and is
good for consistency anyway)
p4raw-id: //depot/perl@24925
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -563,6 +563,13 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) return 0; } +#define SvRTRIM(sv) STMT_START { \ + STRLEN len = SvCUR(sv); \ + while (len > 0 && isSPACE(SvPVX(sv)[len-1])) \ + --len; \ + SvCUR_set(sv, len); \ +} STMT_END + int Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) { @@ -648,6 +655,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) #endif #endif #endif + SvRTRIM(sv); SvNOK_on(sv); /* what a wonderful hack! */ } else if (strEQ(mg->mg_ptr+1, "NCODING")) @@ -896,6 +904,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) errno = saveerrno; } #endif + SvRTRIM(sv); SvNOK_on(sv); /* what a wonderful hack! */ break; case '<': |