From: Andy Lester Date: Thu, 28 Jul 2005 14:09:56 +0000 (-0500) Subject: More embed.fnc goodness X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d03de9c8d99c75ed163fdcdde85a243a29ccc8c;p=p5sagit%2Fp5-mst-13.2.git More embed.fnc goodness Message-ID: <20050728190956.GB607@petdance.com> p4raw-id: //depot/perl@25243 --- diff --git a/doio.c b/doio.c index 73217bf..39c0480 100644 --- a/doio.c +++ b/doio.c @@ -747,7 +747,7 @@ Perl_nextargv(pTHX_ register GV *gv) #endif Uid_t fileuid; Gid_t filegid; - IO *io = GvIOp(gv); + IO * const io = GvIOp(gv); if (!PL_argvoutgv) PL_argvoutgv = gv_fetchpv("ARGVOUT",TRUE,SVt_PVIO); @@ -802,9 +802,9 @@ Perl_nextargv(pTHX_ register GV *gv) continue; } if (*PL_inplace) { - char *star = strchr(PL_inplace, '*'); + const char *star = strchr(PL_inplace, '*'); if (star) { - char *begin = PL_inplace; + const char *begin = PL_inplace; sv_setpvn(sv, "", 0); do { sv_catpvn(sv, begin, star - begin); @@ -2333,7 +2333,7 @@ PerlIO * Perl_start_glob (pTHX_ SV *tmpglob, IO *io) { dVAR; - SV *tmpcmd = NEWSV(55, 0); + SV * const tmpcmd = NEWSV(55, 0); PerlIO *fp; ENTER; SAVEFREESV(tmpcmd); diff --git a/embed.fnc b/embed.fnc index f209bb3..9e38ed8 100644 --- a/embed.fnc +++ b/embed.fnc @@ -239,7 +239,7 @@ ApdR |char* |fbm_instr |NN unsigned char* big|NN unsigned char* bigend \ |NN SV* littlesv|U32 flags p |char* |find_script |const char *scriptname|bool dosearch \ |const char **search_ext|I32 flags -p |OP* |force_list |NN OP* arg +p |OP* |force_list |NULLOK OP* arg p |OP* |fold_constants |NN OP* arg Afpd |char* |form |NN const char* pat|... Ap |char* |vform |NN const char* pat|NULLOK va_list* args @@ -297,7 +297,7 @@ Apd |SV** |hv_store |HV* tb|const char* key|I32 klen|SV* val \ Apd |HE* |hv_store_ent |HV* tb|SV* key|SV* val|U32 hash ApM |SV** |hv_store_flags |HV* tb|const char* key|I32 klen|SV* val \ |U32 hash|int flags -Apd |void |hv_undef |HV* tb +Apd |void |hv_undef |NULLOK HV* tb ApP |I32 |ibcmp |NN const char* a|NN const char* b|I32 len ApP |I32 |ibcmp_locale |NN const char* a|NN const char* b|I32 len Apd |I32 |ibcmp_utf8 |NN const char* a|char **pe1|UV l1|bool u1|NN const char* b|char **pe2|UV l2|bool u2 @@ -309,7 +309,7 @@ Ap |void |init_tm |struct tm *ptm pd |U32 |intro_my ApPR |char* |instr |NN const char* big|NN const char* little pR |bool |io_close |NN IO* io|bool not_implicit -pR |OP* |invert |OP* cmd +pR |OP* |invert |NULLOK OP* cmd dpR |bool |is_gv_magical |NN const char *name|STRLEN len|U32 flags ApR |I32 |is_lvalue_sub ApPR |U32 |to_uni_upper_lc|U32 c @@ -502,7 +502,7 @@ Apa |OP* |newCONDOP |I32 flags|NN OP* first|NULLOK OP* trueop|NULLOK OP* falseop Apd |CV* |newCONSTSUB |NULLOK HV* stash|NULLOK const char* name|NULLOK SV* sv Ap |void |newFORM |I32 floor|NULLOK OP* o|NULLOK OP* block Apa |OP* |newFOROP |I32 flags|char* label|line_t forline \ - |OP* sclr|OP* expr|OP*block|OP*cont + |NULLOK OP* sv|OP* expr|OP*block|OP*cont Apa |OP* |newLOGOP |I32 optype|I32 flags|OP* left|OP* right Apa |OP* |newLOOPEX |I32 type|OP* label Apa |OP* |newLOOPOP |I32 flags|I32 debuggable|OP* expr|OP* block @@ -510,15 +510,15 @@ Apa |OP* |newNULLLIST Apa |OP* |newOP |I32 optype|I32 flags Ap |void |newPROG |NN OP* o Apa |OP* |newRANGE |I32 flags|OP* left|OP* right -Apa |OP* |newSLICEOP |I32 flags|OP* subscript|OP* listop -Apa |OP* |newSTATEOP |I32 flags|char* label|OP* o +Apa |OP* |newSLICEOP |I32 flags|NULLOK OP* subscript|NULLOK OP* listop +Apa |OP* |newSTATEOP |I32 flags|NULLOK char* label|NULLOK OP* o Ap |CV* |newSUB |I32 floor|OP* o|OP* proto|OP* block Apd |CV* |newXS |NN const char* name|NN XSUBADDR_t f|NN const char* filename Apda |AV* |newAV Apa |OP* |newAVREF |NN OP* o Apa |OP* |newBINOP |I32 type|I32 flags|OP* first|OP* last -Apa |OP* |newCVREF |I32 flags|OP* o -Apa |OP* |newGVOP |I32 type|I32 flags|GV* gv +Apa |OP* |newCVREF |I32 flags|NULLOK OP* o +Apa |OP* |newGVOP |I32 type|I32 flags|NN GV* gv Apa |GV* |newGVgen |const char* pack Apa |OP* |newGVREF |I32 type|OP* o ApaR |OP* |newHVREF |NN OP* o @@ -540,30 +540,30 @@ Apda |SV* |newSVnv |NV n Apda |SV* |newSVpv |const char* s|STRLEN len Apda |SV* |newSVpvn |const char* s|STRLEN len Apda |SV* |newSVhek |const HEK *hek -Apda |SV* |newSVpvn_share |const char* s|I32 len|U32 hash +Apda |SV* |newSVpvn_share |NULLOK const char* s|I32 len|U32 hash Afpda |SV* |newSVpvf |NN const char* pat|... Apa |SV* |vnewSVpvf |NN const char* pat|NULLOK va_list* args Apda |SV* |newSVrv |NN SV* rv|NULLOK const char* classname Apda |SV* |newSVsv |NULLOK SV* old -Apa |OP* |newUNOP |I32 type|I32 flags|OP* first -Apa |OP* |newWHILEOP |I32 flags|I32 debuggable|LOOP* loop \ - |I32 whileline|OP* expr|OP* block|OP* cont \ +Apa |OP* |newUNOP |I32 type|I32 flags|NULLOK OP* first +Apa |OP* |newWHILEOP |I32 flags|I32 debuggable|NULLOK LOOP* loop \ + |I32 whileline|NULLOK OP* expr|NULLOK OP* block|NULLOK OP* cont \ |I32 has_my Apa |PERL_SI*|new_stackinfo|I32 stitems|I32 cxitems Ap |char* |scan_vstring |NN const char *vstr|NN SV *sv Apd |const char* |scan_version |NN const char *vstr|NN SV *sv|bool qv -Apd |SV* |new_version |SV *ver -Apd |SV* |upg_version |SV *ver -Apd |SV* |vnumify |SV *vs -Apd |SV* |vnormal |SV *vs -Apd |SV* |vstringify |SV *vs +Apd |SV* |new_version |NN SV *ver +Apd |SV* |upg_version |NN SV *ver +Apd |SV* |vnumify |NN SV *vs +Apd |SV* |vnormal |NN SV *vs +Apd |SV* |vstringify |NN SV *vs Apd |int |vcmp |NN SV *lvs|NN SV *rvs -p |PerlIO*|nextargv |GV* gv -ApP |char* |ninstr |const char* big|const char* bigend \ - |const char* little|const char* lend -pr |OP* |oopsCV |OP* o -Ap |void |op_free |OP* arg -p |void |package |OP* o +p |PerlIO*|nextargv |NN GV* gv +ApP |char* |ninstr |NN const char* big|NN const char* bigend \ + |NN const char* little|NN const char* lend +pr |OP* |oopsCV |NN OP* o +Ap |void |op_free |NN OP* arg +p |void |package |NN OP* o pd |PADOFFSET|pad_alloc |I32 optype|U32 tmptype p |PADOFFSET|allocmy |NN char* name pdR |PADOFFSET|pad_findmy |NN const char* name @@ -575,8 +575,8 @@ Apd |SV* |pad_sv |PADOFFSET po pd |void |pad_free |PADOFFSET po pd |void |pad_reset pd |void |pad_swipe |PADOFFSET po|bool refadjust -p |void |peep |OP* o -dopM |PerlIO*|start_glob |SV* pattern|IO *io +p |void |peep |NULLOK OP* o +dopM |PerlIO*|start_glob |NN SV* pattern|NN IO *io #if defined(USE_REENTRANT_API) Ap |void |reentrant_size Ap |void |reentrant_init @@ -604,33 +604,34 @@ Ap |void |set_numeric_local Ap |void |set_numeric_radix Ap |void |set_numeric_standard Apd |void |require_pv |NN const char* pv -Apd |void |pack_cat |SV *cat|const char *pat|const char *patend|SV **beglist|SV **endlist|SV ***next_in_list|U32 flags -Apd |void |packlist |SV *cat|const char *pat|const char *patend|SV **beglist|SV **endlist +Apd |void |pack_cat |NN SV *cat|NN const char *pat|NN const char *patend \ + |NN SV **beglist|NN SV **endlist|NN SV ***next_in_list|U32 flags +Apd |void |packlist |NN SV *cat|NN const char *pat|NN const char *patend|NN SV **beglist|NN SV **endlist p |void |pidgone |Pid_t pid|int status Ap |void |pmflag |NN U32* pmfl|int ch p |OP* |pmruntime |NN OP* pm|NN OP* expr|bool isreg -p |OP* |pmtrans |NN OP* o|NN OP* expr|OP* repl +p |OP* |pmtrans |NN OP* o|NN OP* expr|NN OP* repl Ap |void |pop_scope -p |OP* |prepend_elem |I32 optype|OP* head|OP* tail +p |OP* |prepend_elem |I32 optype|NULLOK OP* head|NULLOK OP* tail Ap |void |push_scope p |OP* |ref |NULLOK OP* o|I32 type p |OP* |refkids |NULLOK OP* o|I32 type Ap |void |regdump |NN regexp* r -Ap |SV* |regclass_swash |const struct regnode *n|bool doinit|SV **listsvp|SV **altsvp +Ap |SV* |regclass_swash |NN const struct regnode *n|bool doinit|NULLOK SV **listsvp|NULLOK SV **altsvp Ap |I32 |pregexec |NN regexp* prog|NN char* stringarg \ |NN char* strend|NN char* strbeg|I32 minend \ |NN SV* screamer|U32 nosave Ap |void |pregfree |NULLOK struct regexp* r Ap |regexp*|pregcomp |NN char* exp|NN char* xend|NN PMOP* pm -Ap |char* |re_intuit_start|regexp* prog|SV* sv|char* strpos \ - |char* strend|U32 flags \ - |struct re_scream_pos_data_s *data -Ap |SV* |re_intuit_string|regexp* prog +Ap |char* |re_intuit_start|NN regexp* prog|NULLOK SV* sv|NN char* strpos \ + |NN char* strend|U32 flags \ + |NULLOK struct re_scream_pos_data_s *data +Ap |SV* |re_intuit_string|NN regexp* prog Ap |I32 |regexec_flags |NN regexp* prog|NN char* stringarg \ |NN char* strend|NN char* strbeg|I32 minend \ |SV* screamer|void* data|U32 flags ApR |regnode*|regnext |NN regnode* p -Ep |void |regprop |SV* sv|const regnode* o +Ep |void |regprop |NN SV* sv|NN const regnode* o Ap |void |repeatcpy |NN char* to|NN const char* from|I32 len|I32 count ApP |char* |rninstr |NN const char* big|NN const char* bigend \ |NN const char* little|NN const char* lend @@ -772,10 +773,10 @@ Apd |int |sv_isa |NULLOK SV* sv|NN const char* name Apd |int |sv_isobject |NULLOK SV* sv Apd |STRLEN |sv_len |NULLOK SV* sv Apd |STRLEN |sv_len_utf8 |NULLOK SV* sv -Apd |void |sv_magic |NN SV* sv|NULLOK SV* obj|int how|const char* name \ +Apd |void |sv_magic |NN SV* sv|NULLOK SV* obj|int how|NULLOK const char* name \ |I32 namlen Apd |MAGIC *|sv_magicext |NN SV* sv|NULLOK SV* obj|int how|const MGVTBL *vtbl \ - |const char* name|I32 namlen + |NULLOK const char* name|I32 namlen ApdaR |SV* |sv_mortalcopy |NULLOK SV* oldsv ApdR |SV* |sv_newmortal Apd |SV* |sv_newref |NULLOK SV* sv @@ -815,10 +816,10 @@ Apd |void |sv_untaint |NN SV* sv Apd |void |sv_upgrade |NN SV* sv|U32 mt Apd |void |sv_usepvn |NN SV* sv|NULLOK char* ptr|STRLEN len Apd |void |sv_vcatpvfn |NN SV* sv|NN const char* pat|STRLEN patlen \ - |NULLOK va_list* args|SV** svargs|I32 svmax \ + |NULLOK va_list* args|NULLOK SV** svargs|I32 svmax \ |NULLOK bool *maybe_tainted Apd |void |sv_vsetpvfn |NN SV* sv|NN const char* pat|STRLEN patlen \ - |NULLOK va_list* args|SV** svargs|I32 svmax \ + |NULLOK va_list* args|NULLOK SV** svargs|I32 svmax \ |NULLOK bool *maybe_tainted ApR |NV |str_to_version |NN SV *sv Ap |SV* |swash_init |NN const char* pkg|NN const char* name|NN SV* listsv|I32 minbits|I32 none @@ -896,7 +897,7 @@ Ap |void |free_global_struct|struct perl_vars* Ap |int |runops_standard Ap |int |runops_debug Afpd |void |sv_catpvf_mg |NN SV *sv|NN const char* pat|... -Apd |void |sv_vcatpvf_mg |NN SV* sv|NN const char* pat|va_list* args +Apd |void |sv_vcatpvf_mg |NN SV* sv|NN const char* pat|NULLOK va_list* args Apd |void |sv_catpv_mg |NN SV *sv|NN const char *ptr Apd |void |sv_catpvn_mg |NN SV *sv|NN const char *ptr|STRLEN len Apd |void |sv_catsv_mg |NN SV *dstr|NULLOK SV *sstr @@ -1321,10 +1322,6 @@ s |int |tokereport |NN const char *s|I32 rv s |int |ao |int toketype s |void |depcom s |const char*|incl_perldb -#if 0 -s |I32 |utf16_textfilter|int idx|SV *sv|int maxlen -s |I32 |utf16rev_textfilter|int idx|SV *sv|int maxlen -#endif # if defined(PERL_CR_FILTER) s |I32 |cr_textfilter |int idx|NULLOK SV *sv|int maxlen # endif diff --git a/embed.h b/embed.h index 9ab983a..c3d0231 100644 --- a/embed.h +++ b/embed.h @@ -1377,12 +1377,6 @@ #define depcom S_depcom #define incl_perldb S_incl_perldb #endif -#if 0 -#ifdef PERL_CORE -#define utf16_textfilter S_utf16_textfilter -#define utf16rev_textfilter S_utf16rev_textfilter -#endif -#endif # if defined(PERL_CR_FILTER) #ifdef PERL_CORE #define cr_textfilter S_cr_textfilter @@ -3366,12 +3360,6 @@ #define depcom() S_depcom(aTHX) #define incl_perldb() S_incl_perldb(aTHX) #endif -#if 0 -#ifdef PERL_CORE -#define utf16_textfilter(a,b,c) S_utf16_textfilter(aTHX_ a,b,c) -#define utf16rev_textfilter(a,b,c) S_utf16rev_textfilter(aTHX_ a,b,c) -#endif -#endif # if defined(PERL_CR_FILTER) #ifdef PERL_CORE #define cr_textfilter(a,b,c) S_cr_textfilter(aTHX_ a,b,c) diff --git a/op.c b/op.c index ac1311d..207d277 100644 --- a/op.c +++ b/op.c @@ -2373,8 +2373,8 @@ static int uvcompare(const void *a, const void *b) OP * Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) { - SV *tstr = ((SVOP*)expr)->op_sv; - SV *rstr = ((SVOP*)repl)->op_sv; + SV * const tstr = ((SVOP*)expr)->op_sv; + SV * const rstr = ((SVOP*)repl)->op_sv; STRLEN tlen; STRLEN rlen; const U8 *t = (U8*)SvPV_const(tstr, tlen); @@ -3480,9 +3480,9 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o) CopSTASH_set(cop, PL_curstash); if (PERLDB_LINE && PL_curstash != PL_debstash) { - SV **svp = av_fetch(CopFILEAV(PL_curcop), (I32)CopLINE(cop), FALSE); - if (svp && *svp != &PL_sv_undef ) { - (void)SvIOK_on(*svp); + SV ** const svp = av_fetch(CopFILEAV(PL_curcop), (I32)CopLINE(cop), FALSE); + if (svp && *svp != &PL_sv_undef ) { + (void)SvIOK_on(*svp); SvIV_set(*svp, PTR2IV(cop)); } } @@ -3810,28 +3810,30 @@ whileline, OP *expr, OP *block, OP *cont, I32 has_my) PERL_UNUSED_ARG(debuggable); - if (expr && (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB - || (expr->op_type == OP_NULL && expr->op_targ == OP_GLOB))) { - expr = newUNOP(OP_DEFINED, 0, - newASSIGNOP(0, newDEFSVOP(), 0, expr) ); - } else if (expr && (expr->op_flags & OPf_KIDS)) { - const OP * const k1 = ((UNOP*)expr)->op_first; - const OP * const k2 = (k1) ? k1->op_sibling : NULL; - switch (expr->op_type) { - case OP_NULL: - if (k2 && k2->op_type == OP_READLINE - && (k2->op_flags & OPf_STACKED) - && ((k1->op_flags & OPf_WANT) == OPf_WANT_SCALAR)) - expr = newUNOP(OP_DEFINED, 0, expr); - break; + if (expr) { + if (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB + || (expr->op_type == OP_NULL && expr->op_targ == OP_GLOB)) { + expr = newUNOP(OP_DEFINED, 0, + newASSIGNOP(0, newDEFSVOP(), 0, expr) ); + } else if (expr->op_flags & OPf_KIDS) { + const OP * const k1 = ((UNOP*)expr)->op_first; + const OP * const k2 = (k1) ? k1->op_sibling : NULL; + switch (expr->op_type) { + case OP_NULL: + if (k2 && k2->op_type == OP_READLINE + && (k2->op_flags & OPf_STACKED) + && ((k1->op_flags & OPf_WANT) == OPf_WANT_SCALAR)) + expr = newUNOP(OP_DEFINED, 0, expr); + break; - case OP_SASSIGN: - if (k1->op_type == OP_READDIR - || k1->op_type == OP_GLOB - || (k1->op_type == OP_NULL && k1->op_targ == OP_GLOB) - || k1->op_type == OP_EACH) - expr = newUNOP(OP_DEFINED, 0, expr); - break; + case OP_SASSIGN: + if (k1->op_type == OP_READDIR + || k1->op_type == OP_GLOB + || (k1->op_type == OP_NULL && k1->op_targ == OP_GLOB) + || k1->op_type == OP_EACH) + expr = newUNOP(OP_DEFINED, 0, expr); + break; + } } } @@ -4083,7 +4085,7 @@ void Perl_cv_ckproto(pTHX_ const CV *cv, const GV *gv, const char *p) { if (((!p != !SvPOK(cv)) || (p && strNE(p, SvPVX_const(cv)))) && ckWARN_d(WARN_PROTOTYPE)) { - SV* msg = sv_newmortal(); + SV* const msg = sv_newmortal(); SV* name = Nullsv; if (gv) diff --git a/pp_ctl.c b/pp_ctl.c index b511b0e..faa07f0 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1408,7 +1408,7 @@ Perl_die_where(pTHX_ const char *message, STRLEN msglen) if (message) { if (PL_in_eval & EVAL_KEEPERR) { static const char prefix[] = "\t(in cleanup) "; - SV *err = ERRSV; + SV * const err = ERRSV; const char *e = Nullch; if (!SvPOK(err)) sv_setpvn(err,"",0); diff --git a/proto.h b/proto.h index ae9778a..e3822d4 100644 --- a/proto.h +++ b/proto.h @@ -484,9 +484,7 @@ PERL_CALLCONV char* Perl_fbm_instr(pTHX_ unsigned char* big, unsigned char* bige __attribute__nonnull__(pTHX_3); PERL_CALLCONV char* Perl_find_script(pTHX_ const char *scriptname, bool dosearch, const char **search_ext, I32 flags); -PERL_CALLCONV OP* Perl_force_list(pTHX_ OP* arg) - __attribute__nonnull__(pTHX_1); - +PERL_CALLCONV OP* Perl_force_list(pTHX_ OP* arg); PERL_CALLCONV OP* Perl_fold_constants(pTHX_ OP* arg) __attribute__nonnull__(pTHX_1); @@ -1120,7 +1118,7 @@ PERL_CALLCONV OP* Perl_newCONDOP(pTHX_ I32 flags, OP* first, OP* trueop, OP* fal PERL_CALLCONV CV* Perl_newCONSTSUB(pTHX_ HV* stash, const char* name, SV* sv); PERL_CALLCONV void Perl_newFORM(pTHX_ I32 floor, OP* o, OP* block); -PERL_CALLCONV OP* Perl_newFOROP(pTHX_ I32 flags, char* label, line_t forline, OP* sclr, OP* expr, OP*block, OP*cont) +PERL_CALLCONV OP* Perl_newFOROP(pTHX_ I32 flags, char* label, line_t forline, OP* sv, OP* expr, OP*block, OP*cont) __attribute__malloc__ __attribute__warn_unused_result__; @@ -1184,7 +1182,8 @@ PERL_CALLCONV OP* Perl_newCVREF(pTHX_ I32 flags, OP* o) PERL_CALLCONV OP* Perl_newGVOP(pTHX_ I32 type, I32 flags, GV* gv) __attribute__malloc__ - __attribute__warn_unused_result__; + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_3); PERL_CALLCONV GV* Perl_newGVgen(pTHX_ const char* pack) __attribute__malloc__ @@ -1319,24 +1318,45 @@ PERL_CALLCONV const char* Perl_scan_version(pTHX_ const char *vstr, SV *sv, bool __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); -PERL_CALLCONV SV* Perl_new_version(pTHX_ SV *ver); -PERL_CALLCONV SV* Perl_upg_version(pTHX_ SV *ver); -PERL_CALLCONV SV* Perl_vnumify(pTHX_ SV *vs); -PERL_CALLCONV SV* Perl_vnormal(pTHX_ SV *vs); -PERL_CALLCONV SV* Perl_vstringify(pTHX_ SV *vs); +PERL_CALLCONV SV* Perl_new_version(pTHX_ SV *ver) + __attribute__nonnull__(pTHX_1); + +PERL_CALLCONV SV* Perl_upg_version(pTHX_ SV *ver) + __attribute__nonnull__(pTHX_1); + +PERL_CALLCONV SV* Perl_vnumify(pTHX_ SV *vs) + __attribute__nonnull__(pTHX_1); + +PERL_CALLCONV SV* Perl_vnormal(pTHX_ SV *vs) + __attribute__nonnull__(pTHX_1); + +PERL_CALLCONV SV* Perl_vstringify(pTHX_ SV *vs) + __attribute__nonnull__(pTHX_1); + PERL_CALLCONV int Perl_vcmp(pTHX_ SV *lvs, SV *rvs) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); -PERL_CALLCONV PerlIO* Perl_nextargv(pTHX_ GV* gv); +PERL_CALLCONV PerlIO* Perl_nextargv(pTHX_ GV* gv) + __attribute__nonnull__(pTHX_1); + PERL_CALLCONV char* Perl_ninstr(pTHX_ const char* big, const char* bigend, const char* little, const char* lend) - __attribute__pure__; + __attribute__pure__ + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4); PERL_CALLCONV OP* Perl_oopsCV(pTHX_ OP* o) - __attribute__noreturn__; + __attribute__noreturn__ + __attribute__nonnull__(pTHX_1); + +PERL_CALLCONV void Perl_op_free(pTHX_ OP* arg) + __attribute__nonnull__(pTHX_1); + +PERL_CALLCONV void Perl_package(pTHX_ OP* o) + __attribute__nonnull__(pTHX_1); -PERL_CALLCONV void Perl_op_free(pTHX_ OP* arg); -PERL_CALLCONV void Perl_package(pTHX_ OP* o); PERL_CALLCONV PADOFFSET Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype); PERL_CALLCONV PADOFFSET Perl_allocmy(pTHX_ char* name) __attribute__nonnull__(pTHX_1); @@ -1360,7 +1380,10 @@ PERL_CALLCONV void Perl_pad_free(pTHX_ PADOFFSET po); PERL_CALLCONV void Perl_pad_reset(pTHX); PERL_CALLCONV void Perl_pad_swipe(pTHX_ PADOFFSET po, bool refadjust); PERL_CALLCONV void Perl_peep(pTHX_ OP* o); -PERL_CALLCONV PerlIO* Perl_start_glob(pTHX_ SV* pattern, IO *io); +PERL_CALLCONV PerlIO* Perl_start_glob(pTHX_ SV* pattern, IO *io) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + #if defined(USE_REENTRANT_API) PERL_CALLCONV void Perl_reentrant_size(pTHX); PERL_CALLCONV void Perl_reentrant_init(pTHX); @@ -1413,8 +1436,21 @@ PERL_CALLCONV void Perl_set_numeric_standard(pTHX); PERL_CALLCONV void Perl_require_pv(pTHX_ const char* pv) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV void Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags); -PERL_CALLCONV void Perl_packlist(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist); +PERL_CALLCONV void Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4) + __attribute__nonnull__(pTHX_5) + __attribute__nonnull__(pTHX_6); + +PERL_CALLCONV void Perl_packlist(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4) + __attribute__nonnull__(pTHX_5); + PERL_CALLCONV void Perl_pidgone(pTHX_ Pid_t pid, int status); PERL_CALLCONV void Perl_pmflag(pTHX_ U32* pmfl, int ch) __attribute__nonnull__(pTHX_1); @@ -1425,7 +1461,8 @@ PERL_CALLCONV OP* Perl_pmruntime(pTHX_ OP* pm, OP* expr, bool isreg) PERL_CALLCONV OP* Perl_pmtrans(pTHX_ OP* o, OP* expr, OP* repl) __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); PERL_CALLCONV void Perl_pop_scope(pTHX); PERL_CALLCONV OP* Perl_prepend_elem(pTHX_ I32 optype, OP* head, OP* tail); @@ -1435,7 +1472,9 @@ PERL_CALLCONV OP* Perl_refkids(pTHX_ OP* o, I32 type); PERL_CALLCONV void Perl_regdump(pTHX_ regexp* r) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV SV* Perl_regclass_swash(pTHX_ const struct regnode *n, bool doinit, SV **listsvp, SV **altsvp); +PERL_CALLCONV SV* Perl_regclass_swash(pTHX_ const struct regnode *n, bool doinit, SV **listsvp, SV **altsvp) + __attribute__nonnull__(pTHX_1); + PERL_CALLCONV I32 Perl_pregexec(pTHX_ regexp* prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, U32 nosave) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -1449,8 +1488,14 @@ PERL_CALLCONV regexp* Perl_pregcomp(pTHX_ char* exp, char* xend, PMOP* pm) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); -PERL_CALLCONV char* Perl_re_intuit_start(pTHX_ regexp* prog, SV* sv, char* strpos, char* strend, U32 flags, struct re_scream_pos_data_s *data); -PERL_CALLCONV SV* Perl_re_intuit_string(pTHX_ regexp* prog); +PERL_CALLCONV char* Perl_re_intuit_start(pTHX_ regexp* prog, SV* sv, char* strpos, char* strend, U32 flags, struct re_scream_pos_data_s *data) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4); + +PERL_CALLCONV SV* Perl_re_intuit_string(pTHX_ regexp* prog) + __attribute__nonnull__(pTHX_1); + PERL_CALLCONV I32 Perl_regexec_flags(pTHX_ regexp* prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, void* data, U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -1461,7 +1506,10 @@ PERL_CALLCONV regnode* Perl_regnext(pTHX_ regnode* p) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); -PERL_CALLCONV void Perl_regprop(pTHX_ SV* sv, const regnode* o); +PERL_CALLCONV void Perl_regprop(pTHX_ SV* sv, const regnode* o) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + PERL_CALLCONV void Perl_repeatcpy(pTHX_ char* to, const char* from, I32 len, I32 count) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -3379,10 +3427,6 @@ STATIC int S_tokereport(pTHX_ const char *s, I32 rv) STATIC int S_ao(pTHX_ int toketype); STATIC void S_depcom(pTHX); STATIC const char* S_incl_perldb(pTHX); -#if 0 -STATIC I32 S_utf16_textfilter(pTHX_ int idx, SV *sv, int maxlen); -STATIC I32 S_utf16rev_textfilter(pTHX_ int idx, SV *sv, int maxlen); -#endif # if defined(PERL_CR_FILTER) STATIC I32 S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen); # endif diff --git a/regcomp.c b/regcomp.c index a4e2cc4..9f81cf5 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5779,12 +5779,12 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o) k = PL_regkind[(U8)OP(o)]; if (k == EXACT) { - SV *dsv = sv_2mortal(newSVpvn("", 0)); + SV * const dsv = sv_2mortal(newSVpvn("", 0)); /* Using is_utf8_string() is a crude hack but it may * be the best for now since we have no flag "this EXACTish * node was UTF-8" --jhi */ const bool do_utf8 = is_utf8_string((U8*)STRING(o), STR_LEN(o)); - const char *s = do_utf8 ? + const char * const s = do_utf8 ? pv_uni_display(dsv, (U8*)STRING(o), STR_LEN(o), 60, UNI_DISPLAY_REGEX) : STRING(o); @@ -5819,7 +5819,7 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o) Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* 2: embedded, otherwise 1 */ else if (k == ANYOF) { int i, rangestart = -1; - U8 flags = ANYOF_FLAGS(o); + const U8 flags = ANYOF_FLAGS(o); const char * const anyofs[] = { /* Should be synchronized with * ANYOF_ #xdefines in regcomp.h */ "\\w", @@ -5890,7 +5890,7 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o) { SV *lv; - SV *sw = regclass_swash(o, FALSE, &lv, 0); + SV * const sw = regclass_swash(o, FALSE, &lv, 0); if (lv) { if (sw) { @@ -5903,20 +5903,21 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o) if (rangestart == -1) rangestart = i; } else if (rangestart != -1) { - U8 *p; - if (i <= rangestart + 3) for (; rangestart < i; rangestart++) { - U8 *e; - for(e = uvchr_to_utf8(s, rangestart), p = s; p < e; p++) + const U8 * const e = uvchr_to_utf8(s,rangestart); + U8 *p; + for(p = s; p < e; p++) put_byte(sv, *p); } else { - U8 *e; - for (e = uvchr_to_utf8(s, rangestart), p = s; p < e; p++) + const U8 *e = uvchr_to_utf8(s,rangestart); + U8 *p; + for (p = s; p < e; p++) put_byte(sv, *p); - sv_catpv(sv, "-"); - for (e = uvchr_to_utf8(s, i - 1), p = s; p < e; p++) + sv_catpvn(sv, "-", 1); + e = uvchr_to_utf8(s, i-1); + for (p = s; p < e; p++) put_byte(sv, *p); } rangestart = -1; @@ -5933,7 +5934,7 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o) while(*s && *s != '\n') s++; if (*s == '\n') { - const char *t = ++s; + const char * const t = ++s; while (*s) { if (*s == '\n') @@ -5964,7 +5965,7 @@ Perl_re_intuit_string(pTHX_ regexp *prog) GET_RE_DEBUG_FLAGS_DECL; DEBUG_COMPILE_r( { - const char *s = SvPV_nolen_const(prog->check_substr + const char * const s = SvPV_nolen_const(prog->check_substr ? prog->check_substr : prog->check_utf8); if (!PL_colorset) reginitcolors(); diff --git a/regexec.c b/regexec.c index c764c37..d19b82e 100644 --- a/regexec.c +++ b/regexec.c @@ -4660,7 +4660,7 @@ Perl_regclass_swash(pTHX_ register const regnode* node, bool doinit, SV** listsv if (PL_regdata->what[n] == 's') { SV * const rv = (SV*)PL_regdata->data[n]; AV * const av = (AV*)SvRV((SV*)rv); - SV **ary = AvARRAY(av); + SV **const ary = AvARRAY(av); SV **a, **b; /* See the end of regcomp.c:S_reglass() for diff --git a/sv.c b/sv.c index 74ed663..70b2740 100644 --- a/sv.c +++ b/sv.c @@ -8852,16 +8852,16 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV if (patlen == 0) return; if (patlen == 2 && pat[0] == '%' && pat[1] == 's') { - if (args) { - const char * const s = va_arg(*args, char*); - sv_catpv(sv, s ? s : nullstr); - } - else if (svix < svmax) { - sv_catsv(sv, *svargs); - if (DO_UTF8(*svargs)) - SvUTF8_on(sv); - } - return; + if (args) { + const char * const s = va_arg(*args, char*); + sv_catpv(sv, s ? s : nullstr); + } + else if (svix < svmax) { + sv_catsv(sv, *svargs); + if (DO_UTF8(*svargs)) + SvUTF8_on(sv); + } + return; } if (args && patlen == 3 && pat[0] == '%' && pat[1] == '-' && pat[2] == 'p') { diff --git a/util.c b/util.c index 3635d35..7bd99f5 100644 --- a/util.c +++ b/util.c @@ -921,7 +921,7 @@ Perl_form(pTHX_ const char* pat, ...) char * Perl_vform(pTHX_ const char *pat, va_list *args) { - SV *sv = mess_alloc(); + SV * const sv = mess_alloc(); sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); return SvPVX(sv); } @@ -1577,7 +1577,7 @@ Perl_unlnk(pTHX_ char *f) /* unlink all versions of a file */ char * Perl_my_bcopy(register const char *from,register char *to,register I32 len) { - char *retval = to; + char * const retval = to; if (from - to >= 0) { while (len--) @@ -1598,7 +1598,7 @@ Perl_my_bcopy(register const char *from,register char *to,register I32 len) void * Perl_my_memset(register char *loc, register I32 ch, register I32 len) { - char *retval = loc; + char * const retval = loc; while (len--) *loc++ = ch; @@ -1611,7 +1611,7 @@ Perl_my_memset(register char *loc, register I32 ch, register I32 len) char * Perl_my_bzero(register char *loc, register I32 len) { - char *retval = loc; + char * const retval = loc; while (len--) *loc++ = 0; @@ -4037,7 +4037,7 @@ want to upgrade the SV. SV * Perl_new_version(pTHX_ SV *ver) { - SV *rv = newSV(0); + SV * const rv = newSV(0); if ( sv_derived_from(ver,"version") ) /* can just copy directly */ { I32 key; @@ -4079,10 +4079,9 @@ Perl_new_version(pTHX_ SV *ver) } #ifdef SvVOK if ( SvVOK(ver) ) { /* already a v-string */ - char *version; MAGIC* mg = mg_find(ver,PERL_MAGIC_vstring); const STRLEN len = mg->mg_len; - version = savepvn( (const char*)mg->mg_ptr, len); + char * const version = savepvn( (const char*)mg->mg_ptr, len); sv_setpvn(rv,version,len); Safefree(version); } @@ -4122,7 +4121,7 @@ Perl_upg_version(pTHX_ SV *ver) } #ifdef SvVOK else if ( SvVOK(ver) ) { /* already a v-string */ - MAGIC* mg = mg_find(ver,PERL_MAGIC_vstring); + const MAGIC* const mg = mg_find(ver,PERL_MAGIC_vstring); version = savepvn( (const char*)mg->mg_ptr,mg->mg_len ); qv = 1; } @@ -4234,7 +4233,7 @@ Perl_vnormal(pTHX_ SV *vs) { I32 i, len, digit; bool alpha = FALSE; - SV *sv = newSV(0); + SV * const sv = newSV(0); AV *av; if ( SvROK(vs) ) vs = SvRV(vs); @@ -4286,14 +4285,9 @@ the original version contained 1 or more dots, respectively SV * Perl_vstringify(pTHX_ SV *vs) { - I32 qv = 0; if ( SvROK(vs) ) vs = SvRV(vs); - if ( hv_exists((HV *)vs, "qv", 2) ) - qv = 1; - - if ( qv ) return vnormal(vs); else return vnumify(vs);