From: Nicholas Clark Date: Sun, 30 Nov 2008 23:45:20 +0000 (+0000) Subject: Refactor all of the code of the form X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1409bc0658469580630ba458c85fe9cc3cb2d78c;p=p5sagit%2Fp5-mst-13.2.git Refactor all of the code of the form SSCHECK(3); SSPUSHINT(i); SSPUSHPTR(ptr); SSPUSHINT(type); into a static function S_save_pushi32ptr(). p4raw-id: //depot/perl@34959 --- diff --git a/embed.fnc b/embed.fnc index 4b470e3..e205c90 100644 --- a/embed.fnc +++ b/embed.fnc @@ -924,6 +924,7 @@ Ap |void |save_sptr |NN SV** sptr Ap |SV* |save_svref |NN SV** sptr Ap |void |save_pushptr |NULLOK void *const ptr|const int type #if defined(PERL_IN_SCOPE_C) +s |void |save_pushi32ptr|I32 i|NULLOK void *const ptr|const int type s |void |save_pushptrptr|NULLOK void *const ptr1 \ |NULLOK void *const ptr2|const int type #endif diff --git a/embed.h b/embed.h index f3faa89..9320030 100644 --- a/embed.h +++ b/embed.h @@ -808,6 +808,7 @@ #define save_pushptr Perl_save_pushptr #if defined(PERL_IN_SCOPE_C) #ifdef PERL_CORE +#define save_pushi32ptr S_save_pushi32ptr #define save_pushptrptr S_save_pushptrptr #endif #endif @@ -3157,6 +3158,7 @@ #define save_pushptr(a,b) Perl_save_pushptr(aTHX_ a,b) #if defined(PERL_IN_SCOPE_C) #ifdef PERL_CORE +#define save_pushi32ptr(a,b,c) S_save_pushi32ptr(aTHX_ a,b,c) #define save_pushptrptr(a,b,c) S_save_pushptrptr(aTHX_ a,b,c) #endif #endif diff --git a/proto.h b/proto.h index ad7b577..869bd0a 100644 --- a/proto.h +++ b/proto.h @@ -2914,6 +2914,7 @@ PERL_CALLCONV SV* Perl_save_svref(pTHX_ SV** sptr) PERL_CALLCONV void Perl_save_pushptr(pTHX_ void *const ptr, const int type); #if defined(PERL_IN_SCOPE_C) +STATIC void S_save_pushi32ptr(pTHX_ I32 i, void *const ptr, const int type); STATIC void S_save_pushptrptr(pTHX_ void *const ptr1, void *const ptr2, const int type); #endif PERL_CALLCONV OP* Perl_sawparens(pTHX_ OP* o); diff --git a/scope.c b/scope.c index 4020c57..ab2d1ff 100644 --- a/scope.c +++ b/scope.c @@ -348,29 +348,36 @@ Perl_save_item(pTHX_ register SV *item) } void -Perl_save_int(pTHX_ int *intp) +Perl_save_bool(pTHX_ bool *boolp) { dVAR; - PERL_ARGS_ASSERT_SAVE_INT; + PERL_ARGS_ASSERT_SAVE_BOOL; SSCHECK(3); - SSPUSHINT(*intp); - SSPUSHPTR(intp); - SSPUSHINT(SAVEt_INT); + SSPUSHBOOL(*boolp); + SSPUSHPTR(boolp); + SSPUSHINT(SAVEt_BOOL); +} + +static void +S_save_pushi32ptr(pTHX_ const I32 i, void *const ptr, const int type) +{ + dVAR; + SSCHECK(3); + SSPUSHINT(i); + SSPUSHPTR(ptr); + SSPUSHINT(type); } void -Perl_save_bool(pTHX_ bool *boolp) +Perl_save_int(pTHX_ int *intp) { dVAR; - PERL_ARGS_ASSERT_SAVE_BOOL; + PERL_ARGS_ASSERT_SAVE_INT; - SSCHECK(3); - SSPUSHBOOL(*boolp); - SSPUSHPTR(boolp); - SSPUSHINT(SAVEt_BOOL); + save_pushi32ptr(*intp, intp, SAVEt_INT); } void @@ -380,10 +387,7 @@ Perl_save_I8(pTHX_ I8 *bytep) PERL_ARGS_ASSERT_SAVE_I8; - SSCHECK(3); - SSPUSHINT(*bytep); - SSPUSHPTR(bytep); - SSPUSHINT(SAVEt_I8); + save_pushi32ptr(*bytep, bytep, SAVEt_I8); } void @@ -393,10 +397,7 @@ Perl_save_I16(pTHX_ I16 *intp) PERL_ARGS_ASSERT_SAVE_I16; - SSCHECK(3); - SSPUSHINT(*intp); - SSPUSHPTR(intp); - SSPUSHINT(SAVEt_I16); + save_pushi32ptr(*intp, intp, SAVEt_I16); } void @@ -406,10 +407,7 @@ Perl_save_I32(pTHX_ I32 *intp) PERL_ARGS_ASSERT_SAVE_I32; - SSCHECK(3); - SSPUSHINT(*intp); - SSPUSHPTR(intp); - SSPUSHINT(SAVEt_I32); + save_pushi32ptr(*intp, intp, SAVEt_I32); } /* Cannot use save_sptr() to store a char* since the SV** cast will