Discussion:
Change 26763: Integrate:
(too old to reply)
nwc10+ (Nicholas Clark)
2006-01-10 10:45:01 UTC
Permalink
Change 26763 by ***@nicholas-saigo on 2006/01/10 10:44:50

Integrate:
[ 24925]
Trim trailing whitespace from $! and $^E

(Fixes lib/Test/Simple/t/fail-more.t with bcc32 on Win32, and is
good for consistency anyway)

Affected files ...

... //depot/maint-5.8/perl/mg.c#94 integrate

Differences ...

==== //depot/maint-5.8/perl/mg.c#94 (text) ====
Index: perl/mg.c
--- perl/mg.c#93~26689~ 2006-01-06 15:03:51.000000000 -0800
+++ perl/mg.c 2006-01-10 02:44:50.000000000 -0800
@@ -569,6 +569,13 @@
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)
{
@@ -652,6 +659,7 @@
#endif
#endif
#endif
+ SvRTRIM(sv);
SvNOK_on(sv); /* what a wonderful hack! */
}
else if (strEQ(remaining, "NCODING"))
@@ -911,6 +919,7 @@
errno = saveerrno;
}
#endif
+ SvRTRIM(sv);
SvNOK_on(sv); /* what a wonderful hack! */
break;
case '<':
End of Patch.
Gisle Aas
2006-01-11 11:29:03 UTC
Permalink
Post by nwc10+ (Nicholas Clark)
[ 24925]
Trim trailing whitespace from $! and $^E
[...]
Post by nwc10+ (Nicholas Clark)
--- perl/mg.c#93~26689~ 2006-01-06 15:03:51.000000000 -0800
+++ perl/mg.c 2006-01-10 02:44:50.000000000 -0800
@@ -569,6 +569,13 @@
return 0;
}
+#define SvRTRIM(sv) STMT_START { \
+ STRLEN len = SvCUR(sv); \
+ while (len > 0 && isSPACE(SvPVX(sv)[len-1])) \
+ --len; \
+ SvCUR_set(sv, len); \
This ought to also NUL terminate the string:

*SvEND(sv) = '\0';
Post by nwc10+ (Nicholas Clark)
+} STMT_END
+
int
Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
{
Nicholas Clark
2006-01-11 12:11:40 UTC
Permalink
Post by Gisle Aas
Post by nwc10+ (Nicholas Clark)
--- perl/mg.c#93~26689~ 2006-01-06 15:03:51.000000000 -0800
+++ perl/mg.c 2006-01-10 02:44:50.000000000 -0800
@@ -569,6 +569,13 @@
return 0;
}
+#define SvRTRIM(sv) STMT_START { \
+ STRLEN len = SvCUR(sv); \
+ while (len > 0 && isSPACE(SvPVX(sv)[len-1])) \
+ --len; \
+ SvCUR_set(sv, len); \
*SvEND(sv) = '\0';
Ooh yes, well spotted. Fixed with change 26781

Nicholas Clark

Loading...