This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
doop.c: (Coverity) found a bug but not quite what Coverity thought it did (try valgri...
[perl5.git] / cc_runtime.h
index 5b6d2c7..cb8c4ca 100644 (file)
@@ -1,4 +1,14 @@
-#define DOOP(ppname) PUTBACK; PL_op = ppname(ARGS); SPAGAIN
+/*    cc_runtime.h
+ *
+ *    Copyright (C) 1999, 2000, 2001, by Larry Wall and others
+ *
+ *    You may distribute under the terms of either the GNU General Public
+ *    License or the Artistic License, as specified in the README file.
+ *
+ */
+
+#define DOOP(ppname) PUTBACK; PL_op = ppname(aTHX); SPAGAIN
+#define CCPP(s)   OP * s(pTHX)
 
 #define PP_LIST(g) do {                        \
        dMARK;                          \
@@ -13,7 +23,7 @@
 
 #define MAYBE_TAINT_SASSIGN_SRC(sv) \
     if (PL_tainting && PL_tainted && (!SvGMAGICAL(left) || !SvSMAGICAL(left) || \
-                                !((mg=mg_find(left, 't')) && mg->mg_len & 1)))\
+        !((mg=mg_find(left, PERL_MAGIC_taint)) && mg->mg_len & 1)))\
         TAINT_NOT
 
 #define PP_PREINC(sv) do {     \
        JMPENV_PUSH(ret);                       \
        switch (ret) {                          \
        case 0:                                 \
-           PL_op = ppaddr(ARGS);                       \
-           PL_retstack[PL_retstack_ix - 1] = Nullop;   \
-           if (PL_op != nxt) CALLRUNOPS();             \
+           PL_op = ppaddr(aTHX);               \
+           if (PL_op != nxt) CALLRUNOPS();     \
            JMPENV_POP;                         \
            break;                              \
        case 1: JMPENV_POP; JMPENV_JUMP(1);     \
        case 2: JMPENV_POP; JMPENV_JUMP(2);     \
        case 3:                                 \
            JMPENV_POP;                         \
-           if (PL_restartop != nxt)            \
+           if (PL_restartop && PL_restartop != nxt)            \
                JMPENV_JUMP(3);                 \
        }                                       \
        PL_op = nxt;                            \
        SPAGAIN;                                \
     } while (0)
 
-#define B_JMPENV_PUSH(cur_env,v) \
-    STMT_START {                                        \
-        cur_env.je_prev = PL_top_env;                   \
-        OP_REG_TO_MEM;                                  \
-        cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, 1);    \
-        OP_MEM_TO_REG;                                  \
-        PL_top_env = &cur_env;                          \
-        cur_env.je_mustcatch = FALSE;                   \
-        (v) = cur_env.je_ret;                           \
-    } STMT_END
-#define B_JMPENV_POP(cur_env) \
-    STMT_START { PL_top_env = cur_env.je_prev; } STMT_END
-
-#define B_JMPENV_JUMP(cur_env,v) \
-    STMT_START {                                                \
-        OP_REG_TO_MEM;                                          \
-        if (PL_top_env->je_prev)                                        \
-            PerlProc_longjmp(PL_top_env->je_buf, (v));                  \
-        if ((v) == 2)                                           \
-            PerlProc_exit(STATUS_NATIVE_EXPORT);                                \
-        PerlIO_printf(PerlIO_stderr(), "panic: top_env\n");     \
-        PerlProc_exit(1);                                               \
-    } STMT_END    
-
-
-#define PP_ENTERTRY(jmpbuf,label)  {           \
-       int ret;                                \
-       B_JMPENV_PUSH(jmpbuf,ret);                      \
-       switch (ret) {                          \
-       case 1: B_JMPENV_POP(jmpbuf); B_JMPENV_JUMP(jmpbuf,1);  \
-       case 2: B_JMPENV_POP(jmpbuf); B_JMPENV_JUMP(jmpbuf,2);  \
-       case 3: B_JMPENV_POP(jmpbuf); SPAGAIN; goto label;\
-       }                                       \
-    } while (0)
 
-#define PP_LEAVETRY PL_top_env=PL_top_env->je_prev
+#define PP_ENTERTRY(jmpbuf,label)  \
+       STMT_START {                    \
+               int ret;                \
+               JMPENV_PUSH_ENV(jmpbuf,ret);                    \
+               switch (ret) {                          \
+                       case 1: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(1);\
+                       case 2: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(2);\
+                       case 3: JMPENV_POP_ENV(jmpbuf); SPAGAIN; goto label;\
+               }                                       \
+       } STMT_END
+#define PP_LEAVETRY \
+       STMT_START{ PL_top_env=PL_top_env->je_prev; }STMT_END