sanitize some macros - based on Chip Salzenberg suggestions and
Adrian M. Enache [Mon, 22 Dec 2003 23:19:25 +0000 (23:19 +0000)]
on the way GNU people use the gcc-ish 'blocks in parens'

p4raw-id: //depot/perl@21950

XSUB.h
sv.h

diff --git a/XSUB.h b/XSUB.h
index 4a1079f..af42f9c 100644 (file)
--- a/XSUB.h
+++ b/XSUB.h
@@ -213,23 +213,23 @@ C<xsubpp>.  See L<perlxs/"The VERSIONCHECK: Keyword">.
 #ifdef XS_VERSION
 #  define XS_VERSION_BOOTCHECK \
     STMT_START {                                                       \
-       SV *tmpsv; STRLEN n_a;                                          \
+       SV *_sv; STRLEN n_a;                                            \
        char *vn = Nullch, *module = SvPV(ST(0),n_a);                   \
        if (items >= 2)  /* version supplied as bootstrap arg */        \
-           tmpsv = ST(1);                                              \
+           _sv = ST(1);                                                \
        else {                                                          \
            /* XXX GV_ADDWARN */                                        \
-           tmpsv = get_sv(Perl_form(aTHX_ "%s::%s", module,            \
+           _sv = get_sv(Perl_form(aTHX_ "%s::%s", module,              \
                                vn = "XS_VERSION"), FALSE);             \
-           if (!tmpsv || !SvOK(tmpsv))                                 \
-               tmpsv = get_sv(Perl_form(aTHX_ "%s::%s", module,        \
+           if (!_sv || !SvOK(_sv))                                     \
+               _sv = get_sv(Perl_form(aTHX_ "%s::%s", module,  \
                                    vn = "VERSION"), FALSE);            \
        }                                                               \
-       if (tmpsv && (!SvOK(tmpsv) || strNE(XS_VERSION, SvPV(tmpsv, n_a))))     \
+       if (_sv && (!SvOK(_sv) || strNE(XS_VERSION, SvPV(_sv, n_a))))   \
            Perl_croak(aTHX_ "%s object version %s does not match %s%s%s%s %"SVf,\
                  module, XS_VERSION,                                   \
                  vn ? "$" : "", vn ? module : "", vn ? "::" : "",      \
-                 vn ? vn : "bootstrap parameter", tmpsv);              \
+                 vn ? vn : "bootstrap parameter", _sv);                \
     } STMT_END
 #else
 #  define XS_VERSION_BOOTCHECK
diff --git a/sv.h b/sv.h
index a9a57df..b31cb14 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -129,10 +129,10 @@ perform the upgrade if necessary.  See C<svtype>.
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(PERL_GCC_PEDANTIC)
 #  define SvREFCNT_inc(sv)             \
     ({                                 \
-       SV *nsv = (SV*)(sv);            \
-       if (nsv)                        \
-            (SvREFCNT(nsv))++;         \
-       nsv;                            \
+       SV *_sv = (SV*)(sv);            \
+       if (_sv)                        \
+            (SvREFCNT(_sv))++;         \
+       _sv;                            \
     })
 #else
 #  define SvREFCNT_inc(sv)     \
@@ -142,13 +142,13 @@ perform the upgrade if necessary.  See C<svtype>.
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(PERL_GCC_PEDANTIC)
 #  define SvREFCNT_dec(sv)             \
     ({                                 \
-       SV *nsv = (SV*)(sv);            \
-       if (nsv) {                      \
-           if (SvREFCNT(nsv)) {        \
-               if (--(SvREFCNT(nsv)) == 0) \
-                   Perl_sv_free2(aTHX_ nsv);   \
+       SV *_sv = (SV*)(sv);            \
+       if (_sv) {                      \
+           if (SvREFCNT(_sv)) {        \
+               if (--(SvREFCNT(_sv)) == 0) \
+                   Perl_sv_free2(aTHX_ _sv);   \
            } else {                    \
-               sv_free(nsv);           \
+               sv_free(_sv);           \
            }                           \
        }                               \
     })
@@ -1006,12 +1006,12 @@ scalar.
 
 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
 
-#  define SvIVx(sv) ({SV *nsv = (SV*)(sv); SvIV(nsv); })
-#  define SvUVx(sv) ({SV *nsv = (SV*)(sv); SvUV(nsv); })
-#  define SvNVx(sv) ({SV *nsv = (SV*)(sv); SvNV(nsv); })
-#  define SvPVx(sv, lp) ({SV *nsv = (sv); SvPV(nsv, lp); })
-#  define SvPVutf8x(sv, lp) ({SV *nsv = (sv); SvPVutf8(nsv, lp); })
-#  define SvPVbytex(sv, lp) ({SV *nsv = (sv); SvPVbyte(nsv, lp); })
+#  define SvIVx(sv) ({SV *_sv = (SV*)(sv); SvIV(_sv); })
+#  define SvUVx(sv) ({SV *_sv = (SV*)(sv); SvUV(_sv); })
+#  define SvNVx(sv) ({SV *_sv = (SV*)(sv); SvNV(_sv); })
+#  define SvPVx(sv, lp) ({SV *_sv = (sv); SvPV(_sv, lp); })
+#  define SvPVutf8x(sv, lp) ({SV *_sv = (sv); SvPVutf8(_sv, lp); })
+#  define SvPVbytex(sv, lp) ({SV *_sv = (sv); SvPVbyte(_sv, lp); })
 #  define SvTRUE(sv) (                                         \
     !sv                                                                \
     ? 0                                                                \
@@ -1028,7 +1028,7 @@ scalar.
            :   SvNOK(sv)                                       \
                ? SvNVX(sv) != 0.0                              \
                : sv_2bool(sv) )
-#  define SvTRUEx(sv) ({SV *nsv = (sv); SvTRUE(nsv); })
+#  define SvTRUEx(sv) ({SV *_sv = (sv); SvTRUE(_sv); })
 
 #else /* __GNUC__ */