From: Steve Hay Date: Tue, 21 Jun 2005 13:49:10 +0000 (+0000) Subject: Trim trailing whitespace from $! and $^E X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ad3296c668b2eed14533c1cf4b03090043289701;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/mg.c b/mg.c index 383353a..bd5acdf 100644 --- a/mg.c +++ b/mg.c @@ -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 '<':