Philippe M. Chiasson [Thu, 26 Jan 2006 13:39:59 +0000 (05:39 -0800)]
From: "Philippe M. Chiasson" <gozer@ActiveState.com>
Message-ID: <
43D941AF.1060503@ActiveState.com>
Date: Thu, 26 Jan 2006 13:39:59 -0800
p4raw-id: //depot/perl@26952
#define SvRTRIM(sv) STMT_START { \
STRLEN len = SvCUR(sv); \
char * const p = SvPVX(sv); \
- while (len > 0 && isSPACE(p[len-1])) \
- --len; \
- SvCUR_set(sv, len); \
- p[len] = '\0'; \
+ if (p) { \
+ while (len > 0 && isSPACE(p[len-1])) \
+ --len; \
+ SvCUR_set(sv, len); \
+ p[len] = '\0'; \
+ } \
} STMT_END
int