=cut
*/
-#ifndef LINT_UNUSED_ARG
+#ifndef PERL_UNUSED_ARG
# ifdef lint
# include <note.h>
-# define LINT_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
+# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
# else
-# define LINT_UNUSED_ARG(x)
+# define PERL_UNUSED_ARG(x) ((void)x)
# endif
#endif
+#ifndef PERL_UNUSED_VAR
+# define PERL_UNUSED_VAR(x) ((void)x)
+#endif
#define ST(off) PL_stack_base[ax + (off)]
#define dITEMS I32 items = SP - MARK
-#define dXSARGS \
- LINT_UNUSED_ARG(cv) \
+#ifdef lint
+# define dXSARGS \
+ NOTE(ARGUNUSED(cv)) \
+ dSP; dAXMARK; dITEMS
+#else
+# define dXSARGS \
dSP; dAXMARK; dITEMS
+#endif
#define dXSTARG SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \
? PAD_SV(PL_op->op_targ) : sv_newmortal())
const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
STRLEN len;
- SV* rv = (SV*)cSVOP->op_sv;
- HV* hv = (HV*)SvRV(rv);
+ SV* const rv = (SV*)cSVOP->op_sv;
+ HV* const hv = (HV*)SvRV(rv);
SV** svp = hv_fetch(hv, "NONE", 4, FALSE);
const UV none = svp ? SvUV(*svp) : 0x7fffffff;
const UV extra = none + 1;
I32 matches = 0;
STRLEN len;
- SV* rv = (SV*)cSVOP->op_sv;
- HV* hv = (HV*)SvRV(rv);
- SV** svp = hv_fetch(hv, "NONE", 4, FALSE);
+ SV* const rv = (SV*)cSVOP->op_sv;
+ HV* const hv = (HV*)SvRV(rv);
+ SV** const svp = hv_fetch(hv, "NONE", 4, FALSE);
const UV none = svp ? SvUV(*svp) : 0x7fffffff;
const UV extra = none + 1;
U8 hibit = 0;
const I32 squash = PL_op->op_private & OPpTRANS_SQUASH;
const I32 del = PL_op->op_private & OPpTRANS_DELETE;
const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
- SV* rv = (SV*)cSVOP->op_sv;
- HV* hv = (HV*)SvRV(rv);
+ SV * const rv = (SV*)cSVOP->op_sv;
+ HV * const hv = (HV*)SvRV(rv);
SV** svp = hv_fetch(hv, "NONE", 4, FALSE);
const UV none = svp ? SvUV(*svp) : 0x7fffffff;
const UV extra = none + 1;
U8 *s = (U8*)SvPV(sv, len);
const I32 isutf8 = SvUTF8(sv);
if (!isutf8) {
- const U8 *t = s, *e = s + len;
+ const U8 *t = s;
+ const U8 * const e = s + len;
while (t < e) {
const U8 ch = *t++;
if ((hibit = !NATIVE_IS_INVARIANT(ch)))
void
Perl_do_join(pTHX_ register SV *sv, SV *del, register SV **mark, register SV **sp)
{
- SV **oldmark = mark;
+ SV ** const oldmark = mark;
register I32 items = sp - mark;
register STRLEN len;
STRLEN delimlen;
Perl_do_sprintf(pTHX_ SV *sv, I32 len, SV **sarg)
{
STRLEN patlen;
- const char *pat = SvPV_const(*sarg, patlen);
+ const char * const pat = SvPV_const(*sarg, patlen);
bool do_taint = FALSE;
SvUTF8_off(sv);
p |void |boot_core_PerlIO
Ap |void |call_list |I32 oldscope|NN AV* av_list
pR |bool |cando |Mode_t mode|Uid_t effective|NN const Stat_t* statbufp
-Ap |U32 |cast_ulong |NV f
-Ap |I32 |cast_i32 |NV f
-Ap |IV |cast_iv |NV f
-Ap |UV |cast_uv |NV f
+ApR |U32 |cast_ulong |NV f
+ApR |I32 |cast_i32 |NV f
+ApR |IV |cast_iv |NV f
+ApR |UV |cast_uv |NV f
#if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP)
-Ap |I32 |my_chsize |int fd|Off_t length
+ApR |I32 |my_chsize |int fd|Off_t length
#endif
-p |OP* |convert |I32 optype|I32 flags|OP* o
+pR |OP* |convert |I32 optype|I32 flags|OP* o
Afprd |void |croak |const char* pat|...
Apr |void |vcroak |const char* pat|va_list* args
#if defined(PERL_IMPLICIT_CONTEXT)
#endif
Ap |void |gp_free |GV* gv
Ap |GP* |gp_ref |GP* gp
-Ap |GV* |gv_AVadd |GV* gv
-Ap |GV* |gv_HVadd |GV* gv
-Ap |GV* |gv_IOadd |GV* gv
+Ap |GV* |gv_AVadd |NN GV* gv
+Ap |GV* |gv_HVadd |NN GV* gv
+Ap |GV* |gv_IOadd |NN GV* gv
ApR |GV* |gv_autoload4 |HV* stash|NN const char* name|STRLEN len|I32 method
Ap |void |gv_check |HV* stash
Ap |void |gv_efullname |SV* sv|const GV* gv
Apmb |void |gv_efullname3 |SV* sv|const GV* gv|const char* prefix
Ap |void |gv_efullname4 |SV* sv|const GV* gv|const char* prefix|bool keepmain
-Ap |GV* |gv_fetchfile |const char* name
+Ap |GV* |gv_fetchfile |NN const char* name
Apd |GV* |gv_fetchmeth |HV* stash|const char* name|STRLEN len \
|I32 level
Apd |GV* |gv_fetchmeth_autoload |HV* stash|const char* name|STRLEN len \
Ap |void |gv_fullname |SV* sv|const GV* gv
Apmb |void |gv_fullname3 |SV* sv|const GV* gv|const char* prefix
Ap |void |gv_fullname4 |SV* sv|const GV* gv|const char* prefix|bool keepmain
-Ap |void |gv_init |GV* gv|HV* stash|const char* name \
+Ap |void |gv_init |NN GV* gv|NN HV* stash|NN const char* name \
|STRLEN len|int multi
Apd |HV* |gv_stashpv |const char* name|I32 create
Apd |HV* |gv_stashpvn |const char* name|U32 namelen|I32 create
#if !defined(HAS_RENAME)
p |I32 |same_dirent |NN const char* a|NN const char* b
#endif
-Apd |char* |savepv |const char* pv
-Apd |char* |savesharedpv |const char* pv
-Apd |char* |savepvn |const char* pv|I32 len
+Apda |char* |savepv |NN const char* pv
+Apda |char* |savepvn |NN const char* pv|I32 len
+Apda |char* |savesharedpv |const char* pv
+Apda |char* |savesvpv |NN SV* sv
Ap |void |savestack_grow
Ap |void |savestack_grow_cnt |I32 need
Ap |void |save_aelem |const AV* av|I32 idx|SV **sptr
p |OP * |my_attrs |NN OP *o|OP *attrs
p |void |boot_core_xsutils
#if defined(USE_ITHREADS)
-Ap |PERL_CONTEXT*|cx_dup |PERL_CONTEXT* cx|I32 ix|I32 max|CLONE_PARAMS* param
-Ap |PERL_SI*|si_dup |PERL_SI* si|CLONE_PARAMS* param
-Ap |ANY* |ss_dup |PerlInterpreter* proto_perl|CLONE_PARAMS* param
-Ap |void* |any_dup |void* v|PerlInterpreter* proto_perl
-Ap |HE* |he_dup |HE* e|bool shared|CLONE_PARAMS* param
-Ap |HEK* |hek_dup |HEK* e|CLONE_PARAMS* param
-Ap |REGEXP*|re_dup |REGEXP* r|CLONE_PARAMS* param
-Ap |PerlIO*|fp_dup |PerlIO* fp|char type|CLONE_PARAMS* param
-Ap |DIR* |dirp_dup |DIR* dp
-Ap |GP* |gp_dup |GP* gp|CLONE_PARAMS* param
-Ap |MAGIC* |mg_dup |MAGIC* mg|CLONE_PARAMS* param
-Ap |SV* |sv_dup |SV* sstr|CLONE_PARAMS* param
-Ap |void |rvpv_dup |SV* dstr|SV *sstr|CLONE_PARAMS* param
-Ap |PTR_TBL_t*|ptr_table_new
-Ap |void* |ptr_table_fetch|NN PTR_TBL_t *tbl|NN void *sv
-Ap |void |ptr_table_store|NN PTR_TBL_t *tbl|void *oldsv|void *newsv
+Apa |PERL_CONTEXT*|cx_dup |PERL_CONTEXT* cx|I32 ix|I32 max|CLONE_PARAMS* param
+Apa |PERL_SI*|si_dup |PERL_SI* si|CLONE_PARAMS* param
+Apa |ANY* |ss_dup |NN PerlInterpreter* proto_perl|CLONE_PARAMS* param
+Apa |void* |any_dup |void* v|NN const PerlInterpreter* proto_perl
+Apa |HE* |he_dup |HE* e|bool shared|CLONE_PARAMS* param
+Apa |HEK* |hek_dup |HEK* e|CLONE_PARAMS* param
+Apa |REGEXP*|re_dup |const REGEXP* r|CLONE_PARAMS* param
+Apa |PerlIO*|fp_dup |PerlIO* fp|char type|CLONE_PARAMS* param
+Apa |DIR* |dirp_dup |DIR* dp
+Apa |GP* |gp_dup |GP* gp|CLONE_PARAMS* param
+Apa |MAGIC* |mg_dup |NN MAGIC* mg|CLONE_PARAMS* param
+Apa |SV* |sv_dup |NN SV* sstr|CLONE_PARAMS* param
+Ap |void |rvpv_dup |NN SV* dstr|NN SV *sstr|CLONE_PARAMS* param
+Apa |PTR_TBL_t*|ptr_table_new
+Apa |void* |ptr_table_fetch|NN PTR_TBL_t *tbl|NN const void *sv
+Ap |void |ptr_table_store|NN PTR_TBL_t *tbl|const void *oldsv|NN void *newsv
Ap |void |ptr_table_split|NN PTR_TBL_t *tbl
Ap |void |ptr_table_clear|PTR_TBL_t *tbl
Ap |void |ptr_table_free|PTR_TBL_t *tbl
Ap |void |sys_intern_init
#endif
-Ap |char * |custom_op_name |NN const OP* op
-Ap |char * |custom_op_desc |NN const OP* op
+ApR |char * |custom_op_name |NN const OP* op
+ApR |char * |custom_op_desc |NN const OP* op
#if defined(PERL_OLD_COPY_ON_WRITE)
pMX |int |sv_release_IVX |SV *sv
END_EXTERN_C
#if defined(PERL_IN_DOOP_C) || defined(PERL_DECL_PROT)
-s |I32 |do_trans_simple |NN SV *sv
-s |I32 |do_trans_count |NN SV *sv
-s |I32 |do_trans_complex |NN SV *sv
-s |I32 |do_trans_simple_utf8 |NN SV *sv
-s |I32 |do_trans_count_utf8 |NN SV *sv
-s |I32 |do_trans_complex_utf8 |NN SV *sv
+sR |I32 |do_trans_simple |NN SV *sv
+sR |I32 |do_trans_count |NN SV *sv
+sR |I32 |do_trans_complex |NN SV *sv
+sR |I32 |do_trans_simple_utf8 |NN SV *sv
+sR |I32 |do_trans_count_utf8 |NN SV *sv
+sR |I32 |do_trans_complex_utf8 |NN SV *sv
#endif
#if defined(PERL_IN_GV_C) || defined(PERL_DECL_PROT)
-s |void |gv_init_sv |GV *gv|I32 sv_type
+s |void |gv_init_sv |NN GV *gv|I32 sv_type
s |void |require_errno |NN GV *gv
#endif
#if defined(PERL_IN_HV_C) || defined(PERL_DECL_PROT)
-s |void |hsplit |HV *hv
+s |void |hsplit |NN HV *hv
s |void |hfreeentries |HV *hv
-sR |HE* |new_he
+sa |HE* |new_he
s |void |del_he |NN HE *p
-sR |HEK* |save_hek_flags |NN const char *str|I32 len|U32 hash|int flags
+sa |HEK* |save_hek_flags |NN const char *str|I32 len|U32 hash|int flags
s |void |hv_magic_check |NN HV *hv|NN bool *needs_copy|NN bool *needs_store
s |void |unshare_hek_or_pvn|const HEK* hek|const char* str|I32 len|U32 hash
sR |HEK* |share_hek_flags|const char* sv|I32 len|U32 hash|int flags
rs |void |hv_notallowed |int flags|NN const char *key|I32 klen|NN const char *msg
-s |struct xpvhv_aux*|hv_auxinit|HV *hv
+s |struct xpvhv_aux*|hv_auxinit|NN HV *hv
sM |SV* |hv_delete_common|HV* tb|SV* key_sv|const char* key|STRLEN klen|int k_flags|I32 d_flags|U32 hash
sM |HE* |hv_fetch_common|HV* tb|SV* key_sv|const char* key|STRLEN klen|int flags|int action|SV* val|U32 hash
#endif
Ap |GV* |gv_fetchsv|SV *name|I32 flags|I32 sv_type
dpR |bool |is_gv_magical_sv|SV *name|U32 flags
-Apda |char* |savesvpv |NN SV* sv
ApR |bool |stashpv_hvname_match|NN const COP *cop|NN const HV *hv
END_EXTERN_C
#endif
#endif
#define savepv Perl_savepv
-#define savesharedpv Perl_savesharedpv
#define savepvn Perl_savepvn
+#define savesharedpv Perl_savesharedpv
+#define savesvpv Perl_savesvpv
#define savestack_grow Perl_savestack_grow
#define savestack_grow_cnt Perl_savestack_grow_cnt
#define save_aelem Perl_save_aelem
#ifdef PERL_CORE
#define is_gv_magical_sv Perl_is_gv_magical_sv
#endif
-#define savesvpv Perl_savesvpv
#define stashpv_hvname_match Perl_stashpv_hvname_match
#define ck_anoncode Perl_ck_anoncode
#define ck_bitop Perl_ck_bitop
#endif
#endif
#define savepv(a) Perl_savepv(aTHX_ a)
-#define savesharedpv(a) Perl_savesharedpv(aTHX_ a)
#define savepvn(a,b) Perl_savepvn(aTHX_ a,b)
+#define savesharedpv(a) Perl_savesharedpv(aTHX_ a)
+#define savesvpv(a) Perl_savesvpv(aTHX_ a)
#define savestack_grow() Perl_savestack_grow(aTHX)
#define savestack_grow_cnt(a) Perl_savestack_grow_cnt(aTHX_ a)
#define save_aelem(a,b,c) Perl_save_aelem(aTHX_ a,b,c)
#ifdef PERL_CORE
#define is_gv_magical_sv(a,b) Perl_is_gv_magical_sv(aTHX_ a,b)
#endif
-#define savesvpv(a) Perl_savesvpv(aTHX_ a)
#define stashpv_hvname_match(a,b) Perl_stashpv_hvname_match(aTHX_ a,b)
#define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a)
#define ck_bitop(a) Perl_ck_bitop(aTHX_ a)
Perl_rsignal
Perl_rsignal_state
Perl_savepv
-Perl_savesharedpv
Perl_savepvn
+Perl_savesharedpv
+Perl_savesvpv
Perl_savestack_grow
Perl_savestack_grow_cnt
Perl_save_aelem
Perl_hv_placeholders_set
Perl_gv_fetchpvn_flags
Perl_gv_fetchsv
-Perl_savesvpv
Perl_stashpv_hvname_match
# ex: set ro:
int
Perl_magic_freeovrld(pTHX_ SV *sv, MAGIC *mg)
{
- AMT *amtp = (AMT*)mg->mg_ptr;
- (void)sv;
+ AMT * const amtp = (AMT*)mg->mg_ptr;
+ PERL_UNUSED_ARG(sv);
if (amtp && AMT_AMAGIC(amtp)) {
int i;
for (i = 1; i < NofAMmeth; i++) {
- CV *cv = amtp->table[i];
+ CV * const cv = amtp->table[i];
if (cv != Nullcv) {
SvREFCNT_dec((SV *) cv);
amtp->table[i] = Nullcv;
bool
Perl_Gv_AMupdate(pTHX_ HV *stash)
{
- GV* gv;
- CV* cv;
- MAGIC* mg=mg_find((SV*)stash, PERL_MAGIC_overload_table);
- AMT *amtp = (mg) ? (AMT*)mg->mg_ptr: (AMT *) NULL;
+ MAGIC* const mg = mg_find((SV*)stash, PERL_MAGIC_overload_table);
+ AMT * const amtp = (mg) ? (AMT*)mg->mg_ptr: (AMT *) NULL;
AMT amt;
if (mg && amtp->was_ok_am == PL_amagic_generation
{
int filled = 0, have_ovl = 0;
int i, lim = 1;
- SV* sv = NULL;
/* Work with "fallback" key, which we assume to be first in PL_AMG_names */
/* Try to find via inheritance. */
- gv = gv_fetchmeth(stash, PL_AMG_names[0], 2, -1);
- if (gv)
- sv = GvSV(gv);
+ GV *gv = gv_fetchmeth(stash, PL_AMG_names[0], 2, -1);
+ SV * const sv = gv ? GvSV(gv) : NULL;
+ CV* cv;
if (!gv)
lim = DESTROY_amg; /* Skip overloading entries. */
int
Perl_magic_freearylen_p(pTHX_ SV *sv, MAGIC *mg)
{
+ PERL_UNUSED_ARG(sv);
/* during global destruction, mg_obj may already have been freed */
if (PL_in_clean_all)
return 0;
* children, or integrate this loop with general cleanup */
if (!PL_dirty) { /* don't bother during global destruction */
- CV *outercv = CvOUTSIDE(cv);
+ CV * const outercv = CvOUTSIDE(cv);
const U32 seq = CvOUTSIDE_SEQ(cv);
- AV *comppad_name = (AV*)AvARRAY(padlist)[0];
- SV **namepad = AvARRAY(comppad_name);
- AV *comppad = (AV*)AvARRAY(padlist)[1];
- SV **curpad = AvARRAY(comppad);
+ AV * const comppad_name = (AV*)AvARRAY(padlist)[0];
+ SV ** const namepad = AvARRAY(comppad_name);
+ AV * const comppad = (AV*)AvARRAY(padlist)[1];
+ SV ** const curpad = AvARRAY(comppad);
for (ix = AvFILLp(comppad_name); ix > 0; ix--) {
SV * const namesv = namepad[ix];
if (namesv && namesv != &PL_sv_undef
ix = AvFILLp(padlist);
while (ix >= 0) {
- SV* sv = AvARRAY(padlist)[ix--];
+ SV* const sv = AvARRAY(padlist)[ix--];
if (!sv)
continue;
if (sv == (SV*)PL_comppad_name)
Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake)
{
const PADOFFSET offset = pad_alloc(OP_PADSV, SVs_PADMY);
- SV* namesv = NEWSV(1102, 0);
+ SV* const namesv = NEWSV(1102, 0);
ASSERT_CURPAD_ACTIVE("pad_add_name");
retval = AvFILLp(PL_comppad);
}
else {
- SV **names = AvARRAY(PL_comppad_name);
+ SV ** const names = AvARRAY(PL_comppad_name);
const SSize_t names_fill = AvFILLp(PL_comppad_name);
for (;;) {
/*
void
Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
{
- SV **svp, *sv;
+ SV **svp;
PADOFFSET top, off;
ASSERT_CURPAD_ACTIVE("pad_check_dup");
/* XXX DAPM - why the (I32) cast - shouldn't we ensure they're the same
* type ? */
for (off = top; (I32)off > PL_comppad_name_floor; off--) {
- if ((sv = svp[off])
+ SV * const sv = svp[off];
+ if (sv
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
/* check the rest of the pad */
if (is_our) {
do {
- if ((sv = svp[off])
+ SV * const sv = svp[off];
+ if (sv
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
{
SV *new_namesv;
- AV *ocomppad_name = PL_comppad_name;
- PAD *ocomppad = PL_comppad;
+ AV * const ocomppad_name = PL_comppad_name;
+ PAD * const ocomppad = PL_comppad;
PL_comppad_name = (AV*)AvARRAY(padlist)[0];
PL_comppad = (AV*)AvARRAY(padlist)[1];
PL_curpad = AvARRAY(PL_comppad);
Perl_intro_my(pTHX)
{
SV **svp;
- SV *sv;
I32 i;
ASSERT_CURPAD_ACTIVE("intro_my");
svp = AvARRAY(PL_comppad_name);
for (i = PL_min_intro_pending; i <= PL_max_intro_pending; i++) {
- if ((sv = svp[i]) && sv != &PL_sv_undef
- && !SvFAKE(sv) && !SvIVX(sv))
- {
+ SV * const sv = svp[i];
+
+ if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && !SvIVX(sv)) {
SvIV_set(sv, PAD_MAX); /* Don't know scope end yet. */
SvNV_set(sv, (NV)PL_cop_seqmax);
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
Perl_pad_leavemy(pTHX)
{
I32 off;
- SV **svp = AvARRAY(PL_comppad_name);
+ SV ** const svp = AvARRAY(PL_comppad_name);
PL_pad_reset_pending = FALSE;
ASSERT_CURPAD_ACTIVE("pad_leavemy");
if (PL_min_intro_pending && PL_comppad_name_fill < PL_min_intro_pending) {
for (off = PL_max_intro_pending; off >= PL_min_intro_pending; off--) {
- const SV *sv;
- if ((sv = svp[off]) && sv != &PL_sv_undef
+ const SV * const sv = svp[off];
+ if (sv && sv != &PL_sv_undef
&& !SvFAKE(sv) && ckWARN_d(WARN_INTERNAL))
Perl_warner(aTHX_ packWARN(WARN_INTERNAL),
"%"SVf" never introduced", sv);
}
/* "Deintroduce" my variables that are leaving with this scope. */
for (off = AvFILLp(PL_comppad_name); off > PL_comppad_name_fill; off--) {
- const SV *sv;
- if ((sv = svp[off]) && sv != &PL_sv_undef
- && !SvFAKE(sv) && SvIVX(sv) == PAD_MAX)
- {
+ const SV * const sv = svp[off];
+ if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && SvIVX(sv) == PAD_MAX) {
SvIV_set(sv, PL_cop_seqmax);
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
"Pad leavemy: %ld \"%s\", (%ld,%ld)\n",
av_store(PL_comppad_name, AvFILLp(PL_comppad), Nullsv);
if (type == padtidy_SUBCLONE) {
- SV **namep = AvARRAY(PL_comppad_name);
+ SV ** const namep = AvARRAY(PL_comppad_name);
PADOFFSET ix;
for (ix = AvFILLp(PL_comppad); ix > 0; ix--) {
}
else if (type == padtidy_SUB) {
/* XXX DAPM this same bit of code keeps appearing !!! Rationalise? */
- AV *av = newAV(); /* Will be @_ */
+ AV * const av = newAV(); /* Will be @_ */
av_extend(av, 0);
av_store(PL_comppad, 0, (SV*)av);
AvREIFY_only(av);
STATIC void
S_cv_dump(pTHX_ const CV *cv, const char *title)
{
- const CV *outside = CvOUTSIDE(cv);
- AV* padlist = CvPADLIST(cv);
+ const CV * const outside = CvOUTSIDE(cv);
+ AV* const padlist = CvPADLIST(cv);
PerlIO_printf(Perl_debug_log,
" %s: CV=0x%"UVxf" (%s), OUTSIDE=0x%"UVxf" (%s)\n",
{
dVAR;
I32 ix;
- AV* protopadlist = CvPADLIST(proto);
- const AV* protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
- const AV* protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
- SV** pname = AvARRAY(protopad_name);
- SV** ppad = AvARRAY(protopad);
+ AV* const protopadlist = CvPADLIST(proto);
+ const AV* const protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
+ const AV* const protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
+ SV** const pname = AvARRAY(protopad_name);
+ SV** const ppad = AvARRAY(protopad);
const I32 fname = AvFILLp(protopad_name);
const I32 fpad = AvFILLp(protopad);
CV* cv;
outpad = AvARRAY(AvARRAY(CvPADLIST(outside))[depth]);
for (ix = fpad; ix > 0; ix--) {
- SV* namesv = (ix <= fname) ? pname[ix] : Nullsv;
+ SV* const namesv = (ix <= fname) ? pname[ix] : Nullsv;
SV *sv = Nullsv;
if (namesv && namesv != &PL_sv_undef) { /* lexical */
if (SvFAKE(namesv)) { /* lexical from outside? */
I32 ix;
AV * const comppad_name = (AV*)AvARRAY(padlist)[0];
AV * const comppad = (AV*)AvARRAY(padlist)[1];
- SV **namepad = AvARRAY(comppad_name);
- SV **curpad = AvARRAY(comppad);
+ SV ** const namepad = AvARRAY(comppad_name);
+ SV ** const curpad = AvARRAY(comppad);
for (ix = AvFILLp(comppad_name); ix > 0; ix--) {
const SV *namesv = namepad[ix];
if (namesv && namesv != &PL_sv_undef
* for silencing unused variables that are actually used most of the time,
* but we cannot quite get rid of, such as "ax" in PPCODE+noargs xsubs
*/
-#define PERL_UNUSED_VAR(var) ((void)var)
-
-#ifndef LINT_UNUSED_ARG
+#ifndef PERL_UNUSED_ARG
# ifdef lint
# include <note.h>
-# define LINT_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
+# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
# else
-# define LINT_UNUSED_ARG(x)
+# define PERL_UNUSED_ARG(x) ((void)x)
# endif
#endif
+#ifndef PERL_UNUSED_VAR
+# define PERL_UNUSED_VAR(x) ((void)x)
+#endif
#define NOOP (void)0
#define dNOOP extern int Perl___notused PERL_UNUSED_DECL
body arenas */
struct ptr_tbl_ent {
struct ptr_tbl_ent* next;
- void* oldval;
+ const void* oldval;
void* newval;
};
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_3);
-PERL_CALLCONV U32 Perl_cast_ulong(pTHX_ NV f);
-PERL_CALLCONV I32 Perl_cast_i32(pTHX_ NV f);
-PERL_CALLCONV IV Perl_cast_iv(pTHX_ NV f);
-PERL_CALLCONV UV Perl_cast_uv(pTHX_ NV f);
+PERL_CALLCONV U32 Perl_cast_ulong(pTHX_ NV f)
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV I32 Perl_cast_i32(pTHX_ NV f)
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV IV Perl_cast_iv(pTHX_ NV f)
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV UV Perl_cast_uv(pTHX_ NV f)
+ __attribute__warn_unused_result__;
+
#if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP)
-PERL_CALLCONV I32 Perl_my_chsize(pTHX_ int fd, Off_t length);
+PERL_CALLCONV I32 Perl_my_chsize(pTHX_ int fd, Off_t length)
+ __attribute__warn_unused_result__;
+
#endif
-PERL_CALLCONV OP* Perl_convert(pTHX_ I32 optype, I32 flags, OP* o);
+PERL_CALLCONV OP* Perl_convert(pTHX_ I32 optype, I32 flags, OP* o)
+ __attribute__warn_unused_result__;
+
PERL_CALLCONV void Perl_croak(pTHX_ const char* pat, ...)
__attribute__noreturn__
__attribute__format__(__printf__,pTHX_1,pTHX_2);
#endif
PERL_CALLCONV void Perl_gp_free(pTHX_ GV* gv);
PERL_CALLCONV GP* Perl_gp_ref(pTHX_ GP* gp);
-PERL_CALLCONV GV* Perl_gv_AVadd(pTHX_ GV* gv);
-PERL_CALLCONV GV* Perl_gv_HVadd(pTHX_ GV* gv);
-PERL_CALLCONV GV* Perl_gv_IOadd(pTHX_ GV* gv);
+PERL_CALLCONV GV* Perl_gv_AVadd(pTHX_ GV* gv)
+ __attribute__nonnull__(pTHX_1);
+
+PERL_CALLCONV GV* Perl_gv_HVadd(pTHX_ GV* gv)
+ __attribute__nonnull__(pTHX_1);
+
+PERL_CALLCONV GV* Perl_gv_IOadd(pTHX_ GV* gv)
+ __attribute__nonnull__(pTHX_1);
+
PERL_CALLCONV GV* Perl_gv_autoload4(pTHX_ HV* stash, const char* name, STRLEN len, I32 method)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_2);
PERL_CALLCONV void Perl_gv_efullname(pTHX_ SV* sv, const GV* gv);
/* PERL_CALLCONV void Perl_gv_efullname3(pTHX_ SV* sv, const GV* gv, const char* prefix); */
PERL_CALLCONV void Perl_gv_efullname4(pTHX_ SV* sv, const GV* gv, const char* prefix, bool keepmain);
-PERL_CALLCONV GV* Perl_gv_fetchfile(pTHX_ const char* name);
+PERL_CALLCONV GV* Perl_gv_fetchfile(pTHX_ const char* name)
+ __attribute__nonnull__(pTHX_1);
+
PERL_CALLCONV GV* Perl_gv_fetchmeth(pTHX_ HV* stash, const char* name, STRLEN len, I32 level);
PERL_CALLCONV GV* Perl_gv_fetchmeth_autoload(pTHX_ HV* stash, const char* name, STRLEN len, I32 level);
PERL_CALLCONV GV* Perl_gv_fetchmethod(pTHX_ HV* stash, const char* name);
PERL_CALLCONV void Perl_gv_fullname(pTHX_ SV* sv, const GV* gv);
/* PERL_CALLCONV void Perl_gv_fullname3(pTHX_ SV* sv, const GV* gv, const char* prefix); */
PERL_CALLCONV void Perl_gv_fullname4(pTHX_ SV* sv, const GV* gv, const char* prefix, bool keepmain);
-PERL_CALLCONV void Perl_gv_init(pTHX_ GV* gv, HV* stash, const char* name, STRLEN len, int multi);
+PERL_CALLCONV void Perl_gv_init(pTHX_ GV* gv, HV* stash, const char* name, STRLEN len, int multi)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2)
+ __attribute__nonnull__(pTHX_3);
+
PERL_CALLCONV HV* Perl_gv_stashpv(pTHX_ const char* name, I32 create);
PERL_CALLCONV HV* Perl_gv_stashpvn(pTHX_ const char* name, U32 namelen, I32 create);
PERL_CALLCONV HV* Perl_gv_stashsv(pTHX_ SV* sv, I32 create);
__attribute__nonnull__(pTHX_2);
#endif
-PERL_CALLCONV char* Perl_savepv(pTHX_ const char* pv);
-PERL_CALLCONV char* Perl_savesharedpv(pTHX_ const char* pv);
-PERL_CALLCONV char* Perl_savepvn(pTHX_ const char* pv, I32 len);
+PERL_CALLCONV char* Perl_savepv(pTHX_ const char* pv)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
+PERL_CALLCONV char* Perl_savepvn(pTHX_ const char* pv, I32 len)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
+PERL_CALLCONV char* Perl_savesharedpv(pTHX_ const char* pv)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV char* Perl_savesvpv(pTHX_ SV* sv)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
PERL_CALLCONV void Perl_savestack_grow(pTHX);
PERL_CALLCONV void Perl_savestack_grow_cnt(pTHX_ I32 need);
PERL_CALLCONV void Perl_save_aelem(pTHX_ const AV* av, I32 idx, SV **sptr);
PERL_CALLCONV void Perl_boot_core_xsutils(pTHX);
#if defined(USE_ITHREADS)
-PERL_CALLCONV PERL_CONTEXT* Perl_cx_dup(pTHX_ PERL_CONTEXT* cx, I32 ix, I32 max, CLONE_PARAMS* param);
-PERL_CALLCONV PERL_SI* Perl_si_dup(pTHX_ PERL_SI* si, CLONE_PARAMS* param);
-PERL_CALLCONV ANY* Perl_ss_dup(pTHX_ PerlInterpreter* proto_perl, CLONE_PARAMS* param);
-PERL_CALLCONV void* Perl_any_dup(pTHX_ void* v, PerlInterpreter* proto_perl);
-PERL_CALLCONV HE* Perl_he_dup(pTHX_ HE* e, bool shared, CLONE_PARAMS* param);
-PERL_CALLCONV HEK* Perl_hek_dup(pTHX_ HEK* e, CLONE_PARAMS* param);
-PERL_CALLCONV REGEXP* Perl_re_dup(pTHX_ REGEXP* r, CLONE_PARAMS* param);
-PERL_CALLCONV PerlIO* Perl_fp_dup(pTHX_ PerlIO* fp, char type, CLONE_PARAMS* param);
-PERL_CALLCONV DIR* Perl_dirp_dup(pTHX_ DIR* dp);
-PERL_CALLCONV GP* Perl_gp_dup(pTHX_ GP* gp, CLONE_PARAMS* param);
-PERL_CALLCONV MAGIC* Perl_mg_dup(pTHX_ MAGIC* mg, CLONE_PARAMS* param);
-PERL_CALLCONV SV* Perl_sv_dup(pTHX_ SV* sstr, CLONE_PARAMS* param);
-PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV* dstr, SV *sstr, CLONE_PARAMS* param);
-PERL_CALLCONV PTR_TBL_t* Perl_ptr_table_new(pTHX);
-PERL_CALLCONV void* Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, void *sv)
- __attribute__nonnull__(pTHX_1)
+PERL_CALLCONV PERL_CONTEXT* Perl_cx_dup(pTHX_ PERL_CONTEXT* cx, I32 ix, I32 max, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV PERL_SI* Perl_si_dup(pTHX_ PERL_SI* si, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV ANY* Perl_ss_dup(pTHX_ PerlInterpreter* proto_perl, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
+PERL_CALLCONV void* Perl_any_dup(pTHX_ void* v, const PerlInterpreter* proto_perl)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_2);
-PERL_CALLCONV void Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, void *oldsv, void *newsv)
+PERL_CALLCONV HE* Perl_he_dup(pTHX_ HE* e, bool shared, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV HEK* Perl_hek_dup(pTHX_ HEK* e, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV REGEXP* Perl_re_dup(pTHX_ const REGEXP* r, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV PerlIO* Perl_fp_dup(pTHX_ PerlIO* fp, char type, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV DIR* Perl_dirp_dup(pTHX_ DIR* dp)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV GP* Perl_gp_dup(pTHX_ GP* gp, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV MAGIC* Perl_mg_dup(pTHX_ MAGIC* mg, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
+PERL_CALLCONV SV* Perl_sv_dup(pTHX_ SV* sstr, CLONE_PARAMS* param)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
+PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV* dstr, SV *sstr, CLONE_PARAMS* param)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV PTR_TBL_t* Perl_ptr_table_new(pTHX)
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
+
+PERL_CALLCONV void* Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, const void *sv)
+ __attribute__malloc__
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldsv, void *newsv)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_3);
+
PERL_CALLCONV void Perl_ptr_table_split(pTHX_ PTR_TBL_t *tbl)
__attribute__nonnull__(pTHX_1);
#endif
PERL_CALLCONV char * Perl_custom_op_name(pTHX_ const OP* op)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV char * Perl_custom_op_desc(pTHX_ const OP* op)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#if defined(PERL_IN_DOOP_C) || defined(PERL_DECL_PROT)
STATIC I32 S_do_trans_simple(pTHX_ SV *sv)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
STATIC I32 S_do_trans_count(pTHX_ SV *sv)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
STATIC I32 S_do_trans_complex(pTHX_ SV *sv)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
STATIC I32 S_do_trans_simple_utf8(pTHX_ SV *sv)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
STATIC I32 S_do_trans_count_utf8(pTHX_ SV *sv)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
STATIC I32 S_do_trans_complex_utf8(pTHX_ SV *sv)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#endif
#if defined(PERL_IN_GV_C) || defined(PERL_DECL_PROT)
-STATIC void S_gv_init_sv(pTHX_ GV *gv, I32 sv_type);
+STATIC void S_gv_init_sv(pTHX_ GV *gv, I32 sv_type)
+ __attribute__nonnull__(pTHX_1);
+
STATIC void S_require_errno(pTHX_ GV *gv)
__attribute__nonnull__(pTHX_1);
#endif
#if defined(PERL_IN_HV_C) || defined(PERL_DECL_PROT)
-STATIC void S_hsplit(pTHX_ HV *hv);
+STATIC void S_hsplit(pTHX_ HV *hv)
+ __attribute__nonnull__(pTHX_1);
+
STATIC void S_hfreeentries(pTHX_ HV *hv);
STATIC HE* S_new_he(pTHX)
+ __attribute__malloc__
__attribute__warn_unused_result__;
STATIC void S_del_he(pTHX_ HE *p)
__attribute__nonnull__(pTHX_1);
STATIC HEK* S_save_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags)
+ __attribute__malloc__
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_4);
-STATIC struct xpvhv_aux* S_hv_auxinit(pTHX_ HV *hv);
+STATIC struct xpvhv_aux* S_hv_auxinit(pTHX_ HV *hv)
+ __attribute__nonnull__(pTHX_1);
+
STATIC SV* S_hv_delete_common(pTHX_ HV* tb, SV* key_sv, const char* key, STRLEN klen, int k_flags, I32 d_flags, U32 hash);
STATIC HE* S_hv_fetch_common(pTHX_ HV* tb, SV* key_sv, const char* key, STRLEN klen, int flags, int action, SV* val, U32 hash);
#endif
__attribute__warn_unused_result__;
-PERL_CALLCONV char* Perl_savesvpv(pTHX_ SV* sv)
- __attribute__malloc__
- __attribute__warn_unused_result__
- __attribute__nonnull__(pTHX_1);
-
PERL_CALLCONV bool Perl_stashpv_hvname_match(pTHX_ const COP *cop, const HV *hv)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1)
SV* sva;
bool ok = 0;
for (sva = PL_sv_arenaroot; sva; sva = (SV *) SvANY(sva)) {
- SV *sv = sva + 1;
- SV *svend = &sva[SvREFCNT(sva)];
+ const SV * const sv = sva + 1;
+ const SV * const svend = &sva[SvREFCNT(sva)];
if (p >= sv && p < svend) {
ok = 1;
break;
I32 visited = 0;
for (sva = PL_sv_arenaroot; sva; sva = (SV*)SvANY(sva)) {
- register SV * const svend = &sva[SvREFCNT(sva)];
+ register const SV * const svend = &sva[SvREFCNT(sva)];
register SV* sv;
for (sv = sva + 1; sv < svend; ++sv) {
if (SvTYPE(sv) != SVTYPEMASK
S_varname(pTHX_ GV *gv, const char *gvtype, PADOFFSET targ,
SV* keyname, I32 aindex, int subscript_type)
{
- AV *av;
- SV *sv;
SV * const name = sv_newmortal();
if (gv) {
* directly */
const char *p;
- HV *hv = GvSTASH(gv);
+ HV * const hv = GvSTASH(gv);
sv_setpv(name, gvtype);
if (!hv)
p = "???";
sv_catpvn(name,GvNAME(gv),GvNAMELEN(gv));
}
else {
- U32 u;
- CV *cv = find_runcv(&u);
+ U32 unused;
+ CV * const cv = find_runcv(&unused);
+ SV *sv;
+ AV *av;
+
if (!cv || !CvPADLIST(cv))
return Nullsv;;
av = (AV*)(*av_fetch(CvPADLIST(cv), 0, FALSE));
}
if (subscript_type == FUV_SUBSCRIPT_HASH) {
+ SV *sv;
*SvPVX(name) = '$';
sv = NEWSV(0,0);
Perl_sv_catpvf(aTHX_ name, "{%s}",
/* index is an expression;
* attempt to find a match within the aggregate */
if (obase->op_type == OP_HELEM) {
- SV *keysv = S_find_hash_subscript(aTHX_ (HV*)sv, uninit_sv);
+ SV * const keysv = S_find_hash_subscript(aTHX_ (HV*)sv, uninit_sv);
if (keysv)
return S_varname(aTHX_ gv, "%", o->op_targ,
keysv, 0, FUV_SUBSCRIPT_HASH);
{
char *start;
const char *end;
- size_t count = PERL_ARENA_SIZE/size;
+ const size_t count = PERL_ARENA_SIZE/size;
New(0, start, count*size, char);
*((void **) start) = *arena_root;
*arena_root = (void *)start;
*root = (void *)start;
while (start < end) {
- char *next = start + size;
+ char * const next = start + size;
*(void**) start = (void *)next;
start = next;
}
size_t new_body_offset;
void** new_body_arena;
void** new_body_arenaroot;
- U32 old_type = SvTYPE(sv);
+ const U32 old_type = SvTYPE(sv);
if (mt != SVt_PV && SvIsCOW(sv)) {
sv_force_normal_flags(sv, 0);
assert(SvTYPE(sv) != SVt_PVHV);
assert(SvTYPE(sv) != SVt_PVAV);
if (SvIVX(sv)) {
- const char *s = SvPVX_const(sv);
+ const char * const s = SvPVX_const(sv);
SvLEN_set(sv, SvLEN(sv) + SvIVX(sv));
SvPV_set(sv, SvPVX(sv) - SvIVX(sv));
SvIV_set(sv, 0);
Perl_sv_copypv(pTHX_ SV *dsv, register SV *ssv)
{
STRLEN len;
- const char *s;
- s = SvPV_const(ssv,len);
+ const char * const s = SvPV_const(ssv,len);
sv_setpvn(dsv,s,len);
if (SvUTF8(ssv))
SvUTF8_on(dsv);
return SvRV(sv) != 0;
}
if (SvPOKp(sv)) {
- register XPV* Xpvtmp;
- if ((Xpvtmp = (XPV*)SvANY(sv)) &&
+ register XPV* const Xpvtmp = (XPV*)SvANY(sv);
+ if (Xpvtmp &&
(*sv->sv_u.svu_pv > '0' ||
Xpvtmp->xpv_cur > 1 ||
(Xpvtmp->xpv_cur && *sv->sv_u.svu_pv != '0')))
int hibit = 0;
while (t < e) {
- U8 ch = *t++;
+ const U8 ch = *t++;
if ((hibit = !NATIVE_IS_INVARIANT(ch)))
break;
}
if (hibit) {
STRLEN len = SvCUR(sv) + 1; /* Plus the \0 */
- U8 *recoded = bytes_to_utf8((U8*)s, &len);
+ U8 * const recoded = bytes_to_utf8((U8*)s, &len);
SvPV_free(sv); /* No longer using what was there before. */
/* large enough for "%#.#f" --chip */
/* what about long double NVs? --jhi */
+ PERL_UNUSED_ARG(maybe_tainted);
+
/* no matter what, this is a string now */
(void)SvPV_force(sv, origlen);
return;
if (patlen == 2 && pat[0] == '%' && pat[1] == 's') {
if (args) {
- const char *s = va_arg(*args, char*);
+ const char * const s = va_arg(*args, char*);
sv_catpv(sv, s ? s : nullstr);
}
else if (svix < svmax) {
sv_utf8_upgrade(sv);
}
else {
- SV *nsv = sv_2mortal(newSVpvn(eptr, elen));
+ SV * const nsv = sv_2mortal(newSVpvn(eptr, elen));
sv_utf8_upgrade(nsv);
eptr = SvPVX_const(nsv);
elen = SvCUR(nsv);
SvGROW(sv, SvCUR(sv) + need + dotstrlen + 1);
p = SvEND(sv);
if (esignlen && fill == '0') {
+ int i;
for (i = 0; i < (int)esignlen; i++)
*p++ = esignbuf[i];
}
p += gap;
}
if (esignlen && fill != '0') {
+ int i;
for (i = 0; i < (int)esignlen; i++)
*p++ = esignbuf[i];
}
if (zeros) {
+ int i;
for (i = zeros; i; i--)
*p++ = '0';
}
regcomp.c. AMS 20010712 */
REGEXP *
-Perl_re_dup(pTHX_ REGEXP *r, CLONE_PARAMS *param)
+Perl_re_dup(pTHX_ const REGEXP *r, CLONE_PARAMS *param)
{
dVAR;
REGEXP *ret;
if (r->data) {
struct reg_data *d;
const int count = r->data->count;
+ int i;
Newc(0, d, sizeof(struct reg_data) + count*sizeof(void *),
char, struct reg_data);
Perl_fp_dup(pTHX_ PerlIO *fp, char type, CLONE_PARAMS *param)
{
PerlIO *ret;
- (void)type;
+
+ PERL_UNUSED_ARG(type);
if (!fp)
return (PerlIO*)NULL;
/* map an existing pointer using a table */
void *
-Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, void *sv)
+Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, const void *sv)
{
PTR_TBL_ENT_t *tblent;
const UV hash = PTR_TABLE_HASH(sv);
/* add a new entry to a pointer-mapping table */
void
-Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, void *oldv, void *newv)
+Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldv, void *newv)
{
PTR_TBL_ENT_t *tblent, **otblent;
/* XXX this may be pessimal on platforms where pointers aren't good
*/
void *
-Perl_any_dup(pTHX_ void *v, PerlInterpreter *proto_perl)
+Perl_any_dup(pTHX_ void *v, const PerlInterpreter *proto_perl)
{
void *ret;
ANY *
Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
{
- ANY *ss = proto_perl->Tsavestack;
- I32 ix = proto_perl->Tsavestack_ix;
- I32 max = proto_perl->Tsavestack_max;
+ ANY * const ss = proto_perl->Tsavestack;
+ const I32 max = proto_perl->Tsavestack_max;
+ I32 ix = proto_perl->Tsavestack_ix;
ANY *nss;
SV *sv;
GV *gv;
char *c = NULL;
void (*dptr) (void*);
void (*dxptr) (pTHX_ void*);
- OP *o;
Newz(54, nss, max, ANY);
ptr = POPPTR(ss,ix);
if (ptr && (((OP*)ptr)->op_private & OPpREFCOUNTED)) {
/* these are assumed to be refcounted properly */
+ OP *o;
switch (((OP*)ptr)->op_type) {
case OP_LEAVESUB:
case OP_LEAVESUBLV:
static void
do_mark_cloneable_stash(pTHX_ SV *sv)
{
- const HEK *hvname = HvNAME_HEK((HV*)sv);
+ const HEK * const hvname = HvNAME_HEK((HV*)sv);
if (hvname) {
- GV* cloner = gv_fetchmethod_autoload((HV*)sv, "CLONE_SKIP", 0);
+ GV* const cloner = gv_fetchmethod_autoload((HV*)sv, "CLONE_SKIP", 0);
SvFLAGS(sv) |= SVphv_CLONEABLE; /* clone objects by default */
if (cloner && GvCV(cloner)) {
dSP;
PL_regex_padav = newAV();
{
const I32 len = av_len((AV*)proto_perl->Iregex_padav);
- SV** regexen = AvARRAY((AV*)proto_perl->Iregex_padav);
+ SV** const regexen = AvARRAY((AV*)proto_perl->Iregex_padav);
IV i;
av_push(PL_regex_padav,
sv_dup_inc(regexen[0],param));
identified by sv_dup() above.
*/
while(av_len(param->stashes) != -1) {
- HV* stash = (HV*) av_shift(param->stashes);
- GV* cloner = gv_fetchmethod_autoload(stash, "CLONE", 0);
+ HV* const stash = (HV*) av_shift(param->stashes);
+ GV* const cloner = gv_fetchmethod_autoload(stash, "CLONE", 0);
if (cloner && GvCV(cloner)) {
dSP;
ENTER;
XS(XS_Regexp_DESTROY)
{
- LINT_UNUSED_ARG(cv)
+ PERL_UNUSED_ARG(cv);
}
XS(XS_PerlIO_get_layers)
/* Using dXSARGS would also have dITEM and dSP,
* which define 2 unused local variables. */
dAXMARK;
- LINT_UNUSED_ARG(cv)
+ PERL_UNUSED_ARG(cv);
PERL_UNUSED_VAR(mark);
XSRETURN_UV(PERL_HASH_SEED);
}
/* Using dXSARGS would also have dITEM and dSP,
* which define 2 unused local variables. */
dAXMARK;
- LINT_UNUSED_ARG(cv)
+ PERL_UNUSED_ARG(cv);
PERL_UNUSED_VAR(mark);
XSRETURN_UV(PL_rehash_seed);
}
else {
#ifdef USE_SFIO
/* SFIO can really mess with your errno */
- int e = errno;
+ const int e = errno;
#endif
- PerlIO *serr = Perl_error_log;
+ PerlIO * const serr = Perl_error_log;
PERL_WRITE_MSG_TO_CONSOLE(serr, message, msglen);
(void)PerlIO_flush(serr);
Perl_vwarn(pTHX_ const char* pat, va_list *args)
{
dVAR;
- const char *message;
- HV *stash;
- GV *gv;
- CV *cv;
- SV *msv;
STRLEN msglen;
- I32 utf8 = 0;
-
- msv = vmess(pat, args);
- utf8 = SvUTF8(msv);
- message = SvPV_const(msv, msglen);
+ SV * const msv = vmess(pat, args);
+ const I32 utf8 = SvUTF8(msv);
+ const char * const message = SvPV_const(msv, msglen);
if (PL_warnhook) {
/* sv_2cv might call Perl_warn() */
- SV *oldwarnhook = PL_warnhook;
+ SV * const oldwarnhook = PL_warnhook;
+ CV * cv;
+ HV * stash;
+ GV * gv;
+
ENTER;
SAVESPTR(PL_warnhook);
PL_warnhook = Nullsv;
setenv(nam, val, 1);
# else
char *new_env;
- int nlen = strlen(nam), vlen;
+ const int nlen = strlen(nam);
+ int vlen;
if (!val) {
val = "";
}
I32
Perl_setenv_getix(pTHX_ const char *nam)
{
- register I32 i, len = strlen(nam);
+ register I32 i;
+ const register I32 len = strlen(nam);
for (i = 0; environ[i]; i++) {
if (
int extidx = 0, i = 0;
const char *curext = Nullch;
#else
- (void)search_ext;
+ PERL_UNUSED_ARG(search_ext);
# define MAX_EXT_LEN 0
#endif
if ( sv_derived_from(ver,"version") ) /* can just copy directly */
{
I32 key;
- AV *av = newAV();
+ AV * const av = newAV();
AV *sav;
/* This will get reblessed later if a derived class*/
- SV* hv = newSVrv(rv, "version");
+ SV* const hv = newSVrv(rv, "version");
(void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */
#ifndef NODEFAULT_SHAREKEYS
HvSHAREKEYS_on(hv); /* key-sharing on by default */
if ( hv_exists((HV*)ver, "width", 5 ) )
{
- I32 width = SvIV(*hv_fetch((HV*)ver, "width", 5, FALSE));
+ const I32 width = SvIV(*hv_fetch((HV*)ver, "width", 5, FALSE));
hv_store((HV *)hv, "width", 5, newSViv(width), 0);
}
I32 i, len, digit;
int width;
bool alpha = FALSE;
- SV *sv = newSV(0);
+ SV * const sv = newSV(0);
AV *av;
if ( SvROK(vs) )
vs = SvRV(vs);
/* attempt to retrieve the version array */
if ( !(av = (AV *)*hv_fetch((HV*)vs, "version", 7, FALSE) ) ) {
- Perl_sv_catpv(aTHX_ sv,"0");
+ sv_catpvn(sv,"0",1);
return sv;
}
{
digit = SvIV(*av_fetch(av, i, 0));
if ( width < 3 ) {
- int denom = (int)pow(10,(3-width));
- div_t term = div((int)PERL_ABS(digit),denom);
+ const int denom = (int)pow(10,(3-width));
+ const div_t term = div((int)PERL_ABS(digit),denom);
Perl_sv_catpvf(aTHX_ sv,"%0*d_%d", width, term.quot, term.rem);
}
else {
void
Perl_sv_nosharing(pTHX_ SV *sv)
{
- (void)sv;
+ PERL_UNUSED_ARG(sv);
}
/*
void
Perl_sv_nolocking(pTHX_ SV *sv)
{
- (void)sv;
+ PERL_UNUSED_ARG(sv);
}
void
Perl_sv_nounlocking(pTHX_ SV *sv)
{
- (void)sv;
+ PERL_UNUSED_ARG(sv);
}
U32