[patch] make op_{clear,null} public
Doug MacEachern [Thu, 10 May 2001 15:54:09 +0000 (08:54 -0700)]
Message-ID: <Pine.LNX.4.21.0105101546510.2962-100000@mako.covalent.net>

p4raw-id: //depot/perl@10076

embed.h
embed.pl
op.c
proto.h

diff --git a/embed.h b/embed.h
index ff6ffee..fce8a2e 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define leave_scope            Perl_leave_scope
 #define lex_end                        Perl_lex_end
 #define lex_start              Perl_lex_start
+#define op_null                        Perl_op_null
+#define op_clear               Perl_op_clear
 #define linklist               Perl_linklist
 #define list                   Perl_list
 #define listkids               Perl_listkids
 #define scalarboolean          S_scalarboolean
 #define too_few_arguments      S_too_few_arguments
 #define too_many_arguments     S_too_many_arguments
-#define op_clear               S_op_clear
-#define null                   S_null
 #define pad_addlex             S_pad_addlex
 #define pad_findlex            S_pad_findlex
 #define newDEFSVOP             S_newDEFSVOP
 #define leave_scope(a)         Perl_leave_scope(aTHX_ a)
 #define lex_end()              Perl_lex_end(aTHX)
 #define lex_start(a)           Perl_lex_start(aTHX_ a)
+#define op_null(a)             Perl_op_null(aTHX_ a)
+#define op_clear(a)            Perl_op_clear(aTHX_ a)
 #define linklist(a)            Perl_linklist(aTHX_ a)
 #define list(a)                        Perl_list(aTHX_ a)
 #define listkids(a)            Perl_listkids(aTHX_ a)
 #define scalarboolean(a)       S_scalarboolean(aTHX_ a)
 #define too_few_arguments(a,b) S_too_few_arguments(aTHX_ a,b)
 #define too_many_arguments(a,b)        S_too_many_arguments(aTHX_ a,b)
-#define op_clear(a)            S_op_clear(aTHX_ a)
-#define null(a)                        S_null(aTHX_ a)
 #define pad_addlex(a)          S_pad_addlex(aTHX_ a)
 #define pad_findlex(a,b,c,d,e,f,g)     S_pad_findlex(aTHX_ a,b,c,d,e,f,g)
 #define newDEFSVOP()           S_newDEFSVOP(aTHX)
 #define lex_end                        Perl_lex_end
 #define Perl_lex_start         CPerlObj::Perl_lex_start
 #define lex_start              Perl_lex_start
+#define Perl_op_null           CPerlObj::Perl_op_null
+#define op_null                        Perl_op_null
+#define Perl_op_clear          CPerlObj::Perl_op_clear
+#define op_clear               Perl_op_clear
 #define Perl_linklist          CPerlObj::Perl_linklist
 #define linklist               Perl_linklist
 #define Perl_list              CPerlObj::Perl_list
 #define too_few_arguments      S_too_few_arguments
 #define S_too_many_arguments   CPerlObj::S_too_many_arguments
 #define too_many_arguments     S_too_many_arguments
-#define S_op_clear             CPerlObj::S_op_clear
-#define op_clear               S_op_clear
-#define S_null                 CPerlObj::S_null
-#define null                   S_null
 #define S_pad_addlex           CPerlObj::S_pad_addlex
 #define pad_addlex             S_pad_addlex
 #define S_pad_findlex          CPerlObj::S_pad_findlex
index 5d3254d..e6ad867 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -1673,6 +1673,8 @@ p |I32    |keyword        |char* d|I32 len
 Ap     |void   |leave_scope    |I32 base
 p      |void   |lex_end
 p      |void   |lex_start      |SV* line
+p      |void   |op_null        |OP* o
+p      |void   |op_clear       |OP* o
 p      |OP*    |linklist       |OP* o
 p      |OP*    |list           |OP* o
 p      |OP*    |listkids       |OP* o
@@ -2296,8 +2298,6 @@ s |OP*    |no_fh_allowed  |OP *o
 s      |OP*    |scalarboolean  |OP *o
 s      |OP*    |too_few_arguments|OP *o|char* name
 s      |OP*    |too_many_arguments|OP *o|char* name
-s      |void   |op_clear       |OP* o
-s      |void   |null           |OP* o
 s      |PADOFFSET|pad_addlex   |SV* name
 s      |PADOFFSET|pad_findlex  |char* name|PADOFFSET newoff|U32 seq \
                                |CV* startcv|I32 cx_ix|I32 saweval|U32 flags
diff --git a/op.c b/op.c
index e0ca887..77a6267 100644 (file)
--- a/op.c
+++ b/op.c
@@ -735,8 +735,8 @@ Perl_op_free(pTHX_ OP *o)
 #endif
 }
 
-STATIC void
-S_op_clear(pTHX_ OP *o)
+void
+Perl_op_clear(pTHX_ OP *o)
 {
     switch (o->op_type) {
     case OP_NULL:      /* Was holding old type, if any. */
@@ -871,8 +871,8 @@ S_cop_free(pTHX_ COP* cop)
        SvREFCNT_dec(cop->cop_io);
 }
 
-STATIC void
-S_null(pTHX_ OP *o)
+void
+Perl_op_null(pTHX_ OP *o)
 {
     if (o->op_type == OP_NULL)
        return;
@@ -1156,7 +1156,7 @@ Perl_scalarvoid(pTHX_ OP *o)
                }
            }
        }
-       null(o);                /* don't execute or even remember it */
+       op_null(o);             /* don't execute or even remember it */
        break;
 
     case OP_POSTINC:
@@ -1386,7 +1386,7 @@ Perl_mod(pTHX_ OP *o, I32 type)
            o->op_type = OP_RV2CV;              /* entersub => rv2cv */
            o->op_ppaddr = PL_ppaddr[OP_RV2CV];
            assert(cUNOPo->op_first->op_type == OP_NULL);
-           null(((LISTOP*)cUNOPo->op_first)->op_first);/* disable pushmark */
+           op_null(((LISTOP*)cUNOPo->op_first)->op_first);/* disable pushmark */
            break;
        }
        else {                          /* lvalue subroutine call */
@@ -1758,7 +1758,7 @@ Perl_ref(pTHX_ OP *o, I32 type)
            o->op_type = OP_RV2CV;             /* entersub => rv2cv */
            o->op_ppaddr = PL_ppaddr[OP_RV2CV];
            assert(cUNOPo->op_first->op_type == OP_NULL);
-           null(((LISTOP*)cUNOPo->op_first)->op_first);        /* disable pushmark */
+           op_null(((LISTOP*)cUNOPo->op_first)->op_first);     /* disable pushmark */
            o->op_flags |= OPf_SPECIAL;
        }
        break;
@@ -2070,7 +2070,7 @@ Perl_scope(pTHX_ OP *o)
                o->op_ppaddr = PL_ppaddr[OP_SCOPE];
                kid = ((LISTOP*)o)->op_first;
                if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE)
-                   null(kid);
+                   op_null(kid);
            }
            else
                o = newLISTOP(OP_SCOPE, 0, o, Nullop);
@@ -2381,7 +2381,7 @@ Perl_convert(pTHX_ I32 type, I32 flags, OP *o)
        o->op_flags &= ~OPf_WANT;
 
     if (!(PL_opargs[type] & OA_MARK))
-       null(cLISTOPo->op_first);
+       op_null(cLISTOPo->op_first);
 
     o->op_type = type;
     o->op_ppaddr = PL_ppaddr[type];
@@ -2491,7 +2491,7 @@ Perl_force_list(pTHX_ OP *o)
 {
     if (!o || o->op_type != OP_LIST)
        o = newLISTOP(OP_LIST, 0, o, Nullop);
-    null(o);
+    op_null(o);
     return o;
 }
 
@@ -4100,7 +4100,7 @@ Perl_newFOROP(pTHX_ I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *blo
 
        op_free(expr);
        expr = (OP*)(listop);
-        null(expr);
+        op_null(expr);
        iterflags |= OPf_STACKED;
     }
     else {
@@ -5356,7 +5356,7 @@ Perl_ck_delete(pTHX_ OP *o)
            Perl_croak(aTHX_ "%s argument is not a HASH or ARRAY element or slice",
                  PL_op_desc[o->op_type]);
        }
-       null(kid);
+       op_null(kid);
     }
     return o;
 }
@@ -5386,7 +5386,7 @@ Perl_ck_eval(pTHX_ OP *o)
 
        if (!kid) {
            o->op_flags &= ~OPf_KIDS;
-           null(o);
+           op_null(o);
        }
        else if (kid->op_type == OP_LINESEQ) {
            LOGOP *enter;
@@ -5442,7 +5442,7 @@ Perl_ck_exec(pTHX_ OP *o)
        o = ck_fun(o);
        kid = cUNOPo->op_first->op_sibling;
        if (kid->op_type == OP_RV2GV)
-           null(kid);
+           op_null(kid);
     }
     else
        o = listkids(o);
@@ -5467,7 +5467,7 @@ Perl_ck_exists(pTHX_ OP *o)
        else if (kid->op_type != OP_HELEM)
            Perl_croak(aTHX_ "%s argument is not a HASH or ARRAY element",
                       PL_op_desc[o->op_type]);
-       null(kid);
+       op_null(kid);
     }
     return o;
 }
@@ -6302,7 +6302,7 @@ Perl_ck_sort(pTHX_ OP *o)
            }
            else if (kid->op_type == OP_LEAVE) {
                if (o->op_type == OP_SORT) {
-                   null(kid);                  /* wipe out leave */
+                   op_null(kid);                       /* wipe out leave */
                    kid->op_next = kid;
 
                    for (k = kLISTOP->op_first->op_next; k; k = k->op_next) {
@@ -6333,7 +6333,7 @@ Perl_ck_sort(pTHX_ OP *o)
            o->op_flags |= OPf_SPECIAL;
        }
        else if (kid->op_type == OP_RV2SV || kid->op_type == OP_PADSV)
-           null(firstkid);
+           op_null(firstkid);
 
        firstkid = firstkid->op_sibling;
     }
@@ -6496,7 +6496,7 @@ Perl_ck_subr(pTHX_ OP *o)
     if (cvop->op_type == OP_RV2CV) {
        SVOP* tmpop;
        o->op_private |= (cvop->op_private & OPpENTERSUB_AMPER);
-       null(cvop);             /* disable rv2cv */
+       op_null(cvop);          /* disable rv2cv */
        tmpop = (SVOP*)((UNOP*)cvop)->op_first;
        if (tmpop->op_type == OP_GV && !(o->op_private & OPpENTERSUB_AMPER)) {
            GV *gv = cGVOPx_gv(tmpop);
@@ -6758,7 +6758,7 @@ Perl_peep(pTHX_ register OP *o)
                        o->op_private |= OPpTARGET_MY;
                    }
                }
-               null(o->op_next);
+               op_null(o->op_next);
            }
          ignore_optimization:
            o->op_seq = PL_op_seqmax++;
@@ -6791,7 +6791,7 @@ Perl_peep(pTHX_ register OP *o)
        case OP_GV:
            if (o->op_next->op_type == OP_RV2SV) {
                if (!(o->op_next->op_private & OPpDEREF)) {
-                   null(o->op_next);
+                   op_null(o->op_next);
                    o->op_private |= o->op_next->op_private & (OPpLVAL_INTRO
                                                               | OPpOUR_INTRO);
                    o->op_next = o->op_next->op_next;
@@ -6812,9 +6812,9 @@ Perl_peep(pTHX_ register OP *o)
                    i >= 0)
                {
                    GV *gv;
-                   null(o->op_next);
-                   null(pop->op_next);
-                   null(pop);
+                   op_null(o->op_next);
+                   op_null(pop->op_next);
+                   op_null(pop);
                    o->op_flags |= pop->op_next->op_flags & OPf_MOD;
                    o->op_next = pop->op_next->op_next;
                    o->op_type = OP_AELEMFAST;
diff --git a/proto.h b/proto.h
index c8b5aa6..4dbee28 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -396,6 +396,8 @@ PERL_CALLCONV I32   Perl_keyword(pTHX_ char* d, I32 len);
 PERL_CALLCONV void     Perl_leave_scope(pTHX_ I32 base);
 PERL_CALLCONV void     Perl_lex_end(pTHX);
 PERL_CALLCONV void     Perl_lex_start(pTHX_ SV* line);
+PERL_CALLCONV void     Perl_op_null(pTHX_ OP* o);
+PERL_CALLCONV void     Perl_op_clear(pTHX_ OP* o);
 PERL_CALLCONV OP*      Perl_linklist(pTHX_ OP* o);
 PERL_CALLCONV OP*      Perl_list(pTHX_ OP* o);
 PERL_CALLCONV OP*      Perl_listkids(pTHX_ OP* o);
@@ -1027,8 +1029,6 @@ STATIC OP*        S_no_fh_allowed(pTHX_ OP *o);
 STATIC OP*     S_scalarboolean(pTHX_ OP *o);
 STATIC OP*     S_too_few_arguments(pTHX_ OP *o, char* name);
 STATIC OP*     S_too_many_arguments(pTHX_ OP *o, char* name);
-STATIC void    S_op_clear(pTHX_ OP* o);
-STATIC void    S_null(pTHX_ OP* o);
 STATIC PADOFFSET       S_pad_addlex(pTHX_ SV* name);
 STATIC PADOFFSET       S_pad_findlex(pTHX_ char* name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix, I32 saweval, U32 flags);
 STATIC OP*     S_newDEFSVOP(pTHX);