develooper Front page | perl.perl5.porters | Postings from August 2010

[PATCH] Remove newPADOP from the public API and make it static

Thread Next
From:
Florian Ragwitz
Date:
August 23, 2010 05:26
Subject:
[PATCH] Remove newPADOP from the public API and make it static
Message ID:
1282566340-28456-1-git-send-email-rafl@debian.org
Nothing but newGVOP on threaded perls is supposed to use it.
---
 embed.fnc  |    6 +++---
 embed.h    |   20 ++++++++++++++------
 global.sym |    1 -
 makedef.pl |    1 -
 op.c       |   22 ++++------------------
 proto.h    |   17 ++++++++---------
 6 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/embed.fnc b/embed.fnc
index 7c129b5..d5b76b1 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -806,9 +806,6 @@ AmdbR	|HV*	|newHV
 ApaR	|HV*	|newHVhv	|NULLOK HV *hv
 Apabm	|IO*	|newIO
 Apda	|OP*	|newLISTOP	|I32 type|I32 flags|NULLOK OP* first|NULLOK OP* last
-#ifdef USE_ITHREADS
-Apda	|OP*	|newPADOP	|I32 type|I32 flags|NN SV* sv
-#endif
 Apda	|OP*	|newPMOP	|I32 type|I32 flags
 Apda	|OP*	|newPVOP	|I32 type|I32 flags|NULLOK char* pv
 Apa	|SV*	|newRV		|NN SV *const sv
@@ -1579,6 +1576,9 @@ s	|OP*	|scalarboolean	|NN OP *o
 sR	|OP*	|newDEFSVOP
 sR	|OP*	|search_const	|NN OP *o
 sR	|OP*	|new_logop	|I32 type|I32 flags|NN OP **firstp|NN OP **otherp
+#ifdef USE_ITHREADS
+sR	|OP*	|new_padop	|I32 type|I32 flags|NN SV* sv
+#endif
 s	|void	|simplify_sort	|NN OP *o
 s	|const char*	|gv_ename	|NN GV *gv
 sRn	|bool	|scalar_mod_type|NN const OP *o|I32 type
diff --git a/embed.h b/embed.h
index 9cde4db..cd785fc 100644
--- a/embed.h
+++ b/embed.h
@@ -628,9 +628,6 @@
 #define newHVREF		Perl_newHVREF
 #define newHVhv			Perl_newHVhv
 #define newLISTOP		Perl_newLISTOP
-#ifdef USE_ITHREADS
-#define newPADOP		Perl_newPADOP
-#endif
 #define newPMOP			Perl_newPMOP
 #define newPVOP			Perl_newPVOP
 #define newRV			Perl_newRV
@@ -1327,6 +1324,13 @@
 #define newDEFSVOP		S_newDEFSVOP
 #define search_const		S_search_const
 #define new_logop		S_new_logop
+#endif
+#ifdef USE_ITHREADS
+#ifdef PERL_CORE
+#define new_padop		S_new_padop
+#endif
+#endif
+#ifdef PERL_CORE
 #define simplify_sort		S_simplify_sort
 #define gv_ename		S_gv_ename
 #define scalar_mod_type		S_scalar_mod_type
@@ -3075,9 +3079,6 @@
 #define newHVREF(a)		Perl_newHVREF(aTHX_ a)
 #define newHVhv(a)		Perl_newHVhv(aTHX_ a)
 #define newLISTOP(a,b,c,d)	Perl_newLISTOP(aTHX_ a,b,c,d)
-#ifdef USE_ITHREADS
-#define newPADOP(a,b,c)		Perl_newPADOP(aTHX_ a,b,c)
-#endif
 #define newPMOP(a,b)		Perl_newPMOP(aTHX_ a,b)
 #define newPVOP(a,b,c)		Perl_newPVOP(aTHX_ a,b,c)
 #define newRV(a)		Perl_newRV(aTHX_ a)
@@ -3771,6 +3772,13 @@
 #define newDEFSVOP()		S_newDEFSVOP(aTHX)
 #define search_const(a)		S_search_const(aTHX_ a)
 #define new_logop(a,b,c,d)	S_new_logop(aTHX_ a,b,c,d)
+#endif
+#ifdef USE_ITHREADS
+#ifdef PERL_CORE
+#define new_padop(a,b,c)	S_new_padop(aTHX_ a,b,c)
+#endif
+#endif
+#ifdef PERL_CORE
 #define simplify_sort(a)	S_simplify_sort(aTHX_ a)
 #define gv_ename(a)		S_gv_ename(aTHX_ a)
 #define scalar_mod_type		S_scalar_mod_type
diff --git a/global.sym b/global.sym
index 3323815..a35a724 100644
--- a/global.sym
+++ b/global.sym
@@ -363,7 +363,6 @@ Perl_newHV
 Perl_newHVhv
 Perl_newIO
 Perl_newLISTOP
-Perl_newPADOP
 Perl_newPMOP
 Perl_newPVOP
 Perl_newRV
diff --git a/makedef.pl b/makedef.pl
index 810a4c8..689e3c1 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -791,7 +791,6 @@ unless ($define{'USE_ITHREADS'}) {
 		    Perl_sharedsv_unlock
 		    Perl_stashpv_hvname_match
 		    Perl_regdupe_internal
-		    Perl_newPADOP
 		    )];
 }
 
diff --git a/op.c b/op.c
index 0979fc1..ba30603 100644
--- a/op.c
+++ b/op.c
@@ -3913,27 +3913,13 @@ Perl_newSVOP(pTHX_ I32 type, I32 flags, SV *sv)
 
 #ifdef USE_ITHREADS
 
-/*
-=for apidoc Am|OP *|newPADOP|I32 type|I32 flags|SV *sv
-
-Constructs, checks, and returns an op of any type that involves a
-reference to a pad element.  I<type> is the opcode.  I<flags> gives the
-eight bits of C<op_flags>.  A pad slot is automatically allocated, and
-is populated with I<sv>; this function takes ownership of one reference
-to it.
-
-This function only exists if Perl has been compiled to use ithreads.
-
-=cut
-*/
-
-OP *
-Perl_newPADOP(pTHX_ I32 type, I32 flags, SV *sv)
+STATIC OP *
+S_new_padop(pTHX_ I32 type, I32 flags, SV *sv)
 {
     dVAR;
     PADOP *padop;
 
-    PERL_ARGS_ASSERT_NEWPADOP;
+    PERL_ARGS_ASSERT_NEW_PADOP;
 
     assert((PL_opargs[type] & OA_CLASS_MASK) == OA_SVOP
 	|| (PL_opargs[type] & OA_CLASS_MASK) == OA_PVOP_OR_SVOP
@@ -3979,7 +3965,7 @@ Perl_newGVOP(pTHX_ I32 type, I32 flags, GV *gv)
 
 #ifdef USE_ITHREADS
     GvIN_PAD_on(gv);
-    return newPADOP(type, flags, SvREFCNT_inc_simple_NN(gv));
+    return new_padop(type, flags, SvREFCNT_inc_simple_NN(gv));
 #else
     return newSVOP(type, flags, SvREFCNT_inc_simple_NN(gv));
 #endif
diff --git a/proto.h b/proto.h
index 034f673..a74ea9a 100644
--- a/proto.h
+++ b/proto.h
@@ -2319,15 +2319,6 @@ PERL_CALLCONV OP*	Perl_newLISTOP(pTHX_ I32 type, I32 flags, OP* first, OP* last)
 			__attribute__malloc__
 			__attribute__warn_unused_result__;
 
-#ifdef USE_ITHREADS
-PERL_CALLCONV OP*	Perl_newPADOP(pTHX_ I32 type, I32 flags, SV* sv)
-			__attribute__malloc__
-			__attribute__warn_unused_result__
-			__attribute__nonnull__(pTHX_3);
-#define PERL_ARGS_ASSERT_NEWPADOP	\
-	assert(sv)
-
-#endif
 PERL_CALLCONV OP*	Perl_newPMOP(pTHX_ I32 type, I32 flags)
 			__attribute__malloc__
 			__attribute__warn_unused_result__;
@@ -4879,6 +4870,14 @@ STATIC OP*	S_new_logop(pTHX_ I32 type, I32 flags, OP **firstp, OP **otherp)
 #define PERL_ARGS_ASSERT_NEW_LOGOP	\
 	assert(firstp); assert(otherp)
 
+#ifdef USE_ITHREADS
+STATIC OP*	S_new_padop(pTHX_ I32 type, I32 flags, SV* sv)
+			__attribute__warn_unused_result__
+			__attribute__nonnull__(pTHX_3);
+#define PERL_ARGS_ASSERT_NEW_PADOP	\
+	assert(sv)
+
+#endif
 STATIC void	S_simplify_sort(pTHX_ OP *o)
 			__attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_SIMPLIFY_SORT	\
-- 
1.7.1


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About