perl 5.003_01: pp.h
Perl 5 Porters [Fri, 5 Jul 1996 02:31:26 +0000 (02:31 +0000)]
Revise SETsv() and tryAMAGICun() macros
Rename global symbol to eliminate collision with system header files

pp.h

diff --git a/pp.h b/pp.h
index 44a3ebe..7dc918c 100644 (file)
--- a/pp.h
+++ b/pp.h
 #define SETn(n)                STMT_START { sv_setnv(TARG, (double)(n)); SETTARG; } STMT_END
 #define SETi(i)                STMT_START { sv_setiv(TARG, (IV)(i)); SETTARG; } STMT_END
 
-#ifdef OVERLOAD
-#define SETsv(sv)      STMT_START { sv_setsv(TARG, (sv)); SETTARG; } STMT_END
-#endif /* OVERLOAD */
-
 #define dTOPss         SV *sv = TOPs
 #define dPOPss         SV *sv = POPs
 #define dTOPnv         double value = TOPn
                                stack_base = AvARRAY(t);                \
                                stack_max = stack_base + AvMAX(t);      \
                                sp = stack_sp = stack_base + AvFILL(t); \
-                               stack = t;
+                               curstack = t;
 
 #ifdef OVERLOAD
 
          } \
        } STMT_END
 
-#define tryAMAGICun(meth) tryAMAGICunW(meth,SETsv)
+#define tryAMAGICun    tryAMAGICunSET
 #define tryAMAGICunSET(meth) tryAMAGICunW(meth,SETs)
 
 #define opASSIGN (op->op_flags & OPf_STACKED)
+#define SETsv(sv)      STMT_START {                                    \
+               if (opASSIGN) { sv_setsv(TARG, (sv)); SETTARG; }        \
+               else SETs(sv); } STMT_END
 
 /* newSVsv does not behave as advertised, so we copy missing
  * information by hand */