This patch is mostly a "shut up compiler warnings" patch. gcc has been
making noise about unused parm cv in all the XS code, so I'm squashing
them.
Consted some more inbound parms, mostly on dump.c funcs. And shrunk the
scope of more autovariables.
Also added rvpv_dup to the public API. Seemed orthoganal to the other
dup funcs.
Nothing's been consted more to the outside, of course.
xoa
--
Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance
diff -ur bleadperl/doio.c bw/trunk/doio.c
--- bleadperl/doio.c 2005-03-29 02:52:54.000000000 -0600
+++ bw/trunk/doio.c 2005-03-30 09:22:11.000000000 -0600
@@ -71,6 +71,7 @@
int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs,
I32 num_svs)
{
+ (void)num_svs;
return do_openn(gv, name, len, as_raw, rawmode, rawperm,
supplied_fp, &svs, 1);
}
@@ -156,7 +157,7 @@
|O_TRUNC
#endif
;
- int modifyingmode = O_WRONLY|O_RDWR|O_CREAT|appendtrunc;
+ const int modifyingmode = O_WRONLY|O_RDWR|O_CREAT|appendtrunc;
int ismodifying;
if (num_svs != 0) {
@@ -1613,7 +1614,7 @@
&& s > cmd + 1 && s[-1] == '2' && isSPACE(s[-2])
&& (!s[3] || isSPACE(s[3])))
{
- char *t = s + 3;
+ const char *t = s + 3;
while (*t && isSPACE(*t))
++t;
@@ -1651,12 +1652,11 @@
goto doshell;
}
{
- int e = errno;
-
if (ckWARN(WARN_EXEC))
Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't exec \"%s\": %s",
PL_Argv[0], Strerror(errno));
if (do_report) {
+ int e = errno;
PerlLIO_write(fd, (void*)&e, sizeof(int));
PerlLIO_close(fd);
}
@@ -1672,7 +1672,6 @@
Perl_apply(pTHX_ I32 type, register SV **mark, register SV **sp)
{
register I32 val;
- register I32 val2;
register I32 tot = 0;
const char *what;
char *s;
@@ -1715,6 +1714,7 @@
what = "chown";
APPLY_TAINT_PROPER();
if (sp - mark > 2) {
+ register I32 val2;
val = SvIVx(*++mark);
val2 = SvIVx(*++mark);
APPLY_TAINT_PROPER();
@@ -1967,12 +1967,11 @@
I32
Perl_do_ipcget(pTHX_ I32 optype, SV **mark, SV **sp)
{
- key_t key;
- I32 n, flags;
+ key_t key = (key_t)SvNVx(*++mark);
+ const I32 n = (optype == OP_MSGGET) ? 0 : SvIVx(*++mark);
+ const I32 flags = SvIVx(*++mark);
+ (void)sp;
- key = (key_t)SvNVx(*++mark);
- n = (optype == OP_MSGGET) ? 0 : SvIVx(*++mark);
- flags = SvIVx(*++mark);
SETERRNO(0,0);
switch (optype)
{
@@ -2001,12 +2000,13 @@
{
SV *astr;
char *a;
- I32 id, n, cmd, infosize, getinfo;
+ I32 infosize, getinfo;
I32 ret = -1;
+ const I32 id = SvIVx(*++mark);
+ const I32 n = (optype == OP_SEMCTL) ? SvIVx(*++mark) : 0;
+ const I32 cmd = SvIVx(*++mark);
+ (void)sp;
- id = SvIVx(*++mark);
- n = (optype == OP_SEMCTL) ? SvIVx(*++mark) : 0;
- cmd = SvIVx(*++mark);
astr = *++mark;
infosize = 0;
getinfo = (cmd == IPC_STAT);
@@ -2125,10 +2125,11 @@
#ifdef HAS_MSG
SV *mstr;
char *mbuf;
- I32 id, msize, flags;
+ I32 msize, flags;
STRLEN len;
+ const I32 id = SvIVx(*++mark);
+ (void)sp;
- id = SvIVx(*++mark);
mstr = *++mark;
flags = SvIVx(*++mark);
mbuf = SvPV(mstr, len);
@@ -2148,10 +2149,11 @@
SV *mstr;
char *mbuf;
long mtype;
- I32 id, msize, flags, ret;
+ I32 msize, flags, ret;
STRLEN len;
+ const I32 id = SvIVx(*++mark);
+ (void)sp;
- id = SvIVx(*++mark);
mstr = *++mark;
/* suppress warning when reading into undef var --jhi */
if (! SvOK(mstr))
@@ -2184,10 +2186,10 @@
#ifdef HAS_SEM
SV *opstr;
char *opbuf;
- I32 id;
STRLEN opsize;
+ const I32 id = SvIVx(*++mark);
+ (void)sp;
- id = SvIVx(*++mark);
opstr = *++mark;
opbuf = SvPV(opstr, opsize);
if (opsize < 3 * SHORTSIZE
@@ -2198,7 +2200,7 @@
SETERRNO(0,0);
/* We can't assume that sizeof(struct sembuf) == 3 * sizeof(short). */
{
- int nsops = opsize / (3 * sizeof (short));
+ const int nsops = opsize / (3 * sizeof (short));
int i = nsops;
short *ops = (short *) opbuf;
short *o = ops;
@@ -2237,11 +2239,12 @@
#ifdef HAS_SHM
SV *mstr;
char *mbuf, *shm;
- I32 id, mpos, msize;
+ I32 mpos, msize;
STRLEN len;
struct shmid_ds shmds;
+ const I32 id = SvIVx(*++mark);
+ (void)sp;
- id = SvIVx(*++mark);
mstr = *++mark;
mpos = SvIVx(*++mark);
msize = SvIVx(*++mark);
diff -ur bleadperl/dump.c bw/trunk/dump.c
--- bleadperl/dump.c 2005-03-30 09:10:24.000000000 -0600
+++ bw/trunk/dump.c 2005-03-30 09:58:15.000000000 -0600
@@ -334,7 +334,7 @@
}
void
-Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP *pm)
+Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
{
char ch;
@@ -402,14 +402,14 @@
/* An op sequencer. We visit the ops in the order they're to execute. */
STATIC void
-sequence(pTHX_ register OP *o)
+sequence(pTHX_ register const OP *o)
{
SV *op;
char *key;
STRLEN len;
static UV seq;
- OP *oldop = 0,
- *l;
+ const OP *oldop = 0;
+ OP *l;
if (!Sequence)
Sequence = newHV();
@@ -499,7 +499,7 @@
}
STATIC UV
-sequence_num(pTHX_ OP *o)
+sequence_num(pTHX_ const OP *o)
{
SV *op,
**seq;
@@ -513,7 +513,7 @@
}
void
-Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
+Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
{
UV seq;
sequence(aTHX_ o);
@@ -856,7 +856,7 @@
}
void
-Perl_op_dump(pTHX_ OP *o)
+Perl_op_dump(pTHX_ const OP *o)
{
do_op_dump(0, Perl_debug_log, o);
}
@@ -932,7 +932,7 @@
};
void
-Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32
maxnest, bool dumpops, STRLEN pvlim)
+Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const MAGIC *mg, I32 nest,
I32 maxnest, bool dumpops, STRLEN pvlim)
{
for (; mg; mg = mg->mg_moremagic) {
Perl_dump_indent(aTHX_ level, file,
@@ -1050,7 +1050,7 @@
}
void
-Perl_magic_dump(pTHX_ MAGIC *mg)
+Perl_magic_dump(pTHX_ const MAGIC *mg)
{
do_magic_dump(0, Perl_debug_log, mg, 0, 0, 0, 0);
}
@@ -1586,9 +1586,8 @@
}
I32
-Perl_debop(pTHX_ OP *o)
+Perl_debop(pTHX_ const OP *o)
{
- AV *padlist, *comppad;
CV *cv;
SV *sv;
@@ -1617,8 +1616,8 @@
/* print the lexical's name */
cv = deb_curcv(cxstack_ix);
if (cv) {
- padlist = CvPADLIST(cv);
- comppad = (AV*)(*av_fetch(padlist, 0, FALSE));
+ AV *padlist = CvPADLIST(cv);
+ AV *comppad = (AV*)(*av_fetch(padlist, 0, FALSE));
sv = *av_fetch(comppad, o->op_targ, FALSE);
} else
sv = Nullsv;
diff -ur bleadperl/embed.fnc bw/trunk/embed.fnc
--- bleadperl/embed.fnc 2005-03-29 07:08:29.000000000 -0600
+++ bw/trunk/embed.fnc 2005-03-30 11:09:34.000000000 -0600
@@ -82,7 +82,7 @@
p |OP* |append_elem |I32 optype|OP* head|OP* tail
p |OP* |append_list |I32 optype|LISTOP* first|LISTOP* last
p |I32 |apply |I32 type|SV** mark|SV** sp
-ApM |void |apply_attrs_string|char *stashpv|CV *cv|char *attrstr|STRLEN
len
+ApM |void |apply_attrs_string|const char *stashpv|CV *cv|const char
*attrstr|STRLEN len
Apd |void |av_clear |AV* ar
Apd |SV* |av_delete |AV* ar|I32 key|I32 flags
Apd |bool |av_exists |AV* ar|I32 key
@@ -137,7 +137,7 @@
p |void |cv_ckproto |const CV* cv|const GV* gv|const char* p
pd |CV* |cv_clone |CV* proto
Apd |SV* |cv_const_sv |CV* cv
-p |SV* |op_const_sv |OP* o|CV* cv
+p |SV* |op_const_sv |const OP* o|CV* cv
Apd |void |cv_undef |CV* cv
Ap |void |cx_dump |PERL_CONTEXT* cs
Ap |SV* |filter_add |filter_t funcp|SV* datasv
@@ -152,7 +152,7 @@
Afp |void |deb |const char* pat|...
Ap |void |vdeb |const char* pat|va_list* args
Ap |void |debprofdump
-Ap |I32 |debop |OP* o
+Ap |I32 |debop |const OP* o
Ap |I32 |debstack
Ap |I32 |debstackptrs
Ap |char* |delimcpy |char* to|const char* toend|const char* from \
@@ -218,7 +218,7 @@
#endif
Ap |void |dump_form |const GV* gv
Ap |void |gv_dump |GV* gv
-Ap |void |op_dump |OP* arg
+Ap |void |op_dump |const OP* arg
Ap |void |pmop_dump |PMOP* pm
Ap |void |dump_packsubs |const HV* stash
Ap |void |dump_sub |const GV* gv
@@ -895,13 +895,13 @@
Ap |void |do_gv_dump |I32 level|PerlIO *file|const char *name|GV *sv
Ap |void |do_gvgv_dump |I32 level|PerlIO *file|const char *name|GV *sv
Ap |void |do_hv_dump |I32 level|PerlIO *file|const char *name|HV *sv
-Ap |void |do_magic_dump |I32 level|PerlIO *file|MAGIC *mg|I32 nest \
+Ap |void |do_magic_dump |I32 level|PerlIO *file|const MAGIC *mg|I32
nest \
|I32 maxnest|bool dumpops|STRLEN pvlim
-Ap |void |do_op_dump |I32 level|PerlIO *file|OP *o
-Ap |void |do_pmop_dump |I32 level|PerlIO *file|PMOP *pm
+Ap |void |do_op_dump |I32 level|PerlIO *file|const OP *o
+Ap |void |do_pmop_dump |I32 level|PerlIO *file|const PMOP *pm
Ap |void |do_sv_dump |I32 level|PerlIO *file|SV *sv|I32 nest \
|I32 maxnest|bool dumpops|STRLEN pvlim
-Ap |void |magic_dump |MAGIC *mg
+Ap |void |magic_dump |const MAGIC *mg
Ap |void |reginitcolors
Apd |char* |sv_2pv_nolen |SV* sv
Apd |char* |sv_2pvutf8_nolen|SV* sv
@@ -935,6 +935,7 @@
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
#if defined(HAVE_INTERP_INTERN)
Ap |void |sys_intern_dup |struct interp_intern* src \
|struct interp_intern* dst
@@ -1000,11 +1001,11 @@
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT)
-s |I32 |list_assignment|OP *o
-s |void |bad_type |I32 n|const char *t|const char *name|OP *kid
+s |I32 |list_assignment|const OP *o
+s |void |bad_type |I32 n|const char *t|const char *name|const OP
*kid
s |void |cop_free |COP *cop
s |OP* |modkids |OP *o|I32 type
-s |void |no_bareword_allowed|OP *o
+s |void |no_bareword_allowed|const OP *o
s |OP* |no_fh_allowed |OP *o
s |OP* |scalarboolean |OP *o
s |OP* |too_few_arguments|OP *o|const char* name
@@ -1012,9 +1013,9 @@
s |OP* |newDEFSVOP
s |OP* |new_logop |I32 type|I32 flags|OP **firstp|OP **otherp
s |void |simplify_sort |OP *o
-s |bool |is_handle_constructor |OP *o|I32 argnum
+s |bool |is_handle_constructor |const OP *o|I32 argnum
s |char* |gv_ename |GV *gv
-s |bool |scalar_mod_type|OP *o|I32 type
+s |bool |scalar_mod_type|const OP *o|I32 type
s |OP * |my_kid |OP *o|OP *attrs|OP **imopsp
s |OP * |dup_attrlist |OP *o
s |void |apply_attrs |HV *stash|SV *target|OP *attrs|bool for_my
diff -ur bleadperl/embed.h bw/trunk/embed.h
--- bleadperl/embed.h 2005-03-29 04:08:10.000000000 -0600
+++ bw/trunk/embed.h 2005-03-30 11:09:37.000000000 -0600
@@ -1218,6 +1218,7 @@
#define gp_dup Perl_gp_dup
#define mg_dup Perl_mg_dup
#define sv_dup Perl_sv_dup
+#define rvpv_dup Perl_rvpv_dup
#if defined(HAVE_INTERP_INTERN)
#define sys_intern_dup Perl_sys_intern_dup
#endif
@@ -3818,6 +3819,7 @@
#define gp_dup(a,b) Perl_gp_dup(aTHX_ a,b)
#define mg_dup(a,b) Perl_mg_dup(aTHX_ a,b)
#define sv_dup(a,b) Perl_sv_dup(aTHX_ a,b)
+#define rvpv_dup(a,b,c) Perl_rvpv_dup(aTHX_ a,b,c)
#if defined(HAVE_INTERP_INTERN)
#define sys_intern_dup(a,b) Perl_sys_intern_dup(aTHX_ a,b)
#endif
diff -ur bleadperl/embedvar.h bw/trunk/embedvar.h
--- bleadperl/embedvar.h 2005-03-30 09:10:24.000000000 -0600
+++ bw/trunk/embedvar.h 2005-03-30 11:09:37.000000000 -0600
@@ -1,8 +1,7 @@
/*
* embedvar.h
*
- * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- * by Larry Wall and others
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, by Larry Wall and
others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
diff -ur bleadperl/global.sym bw/trunk/global.sym
--- bleadperl/global.sym 2005-01-24 07:42:30.000000000 -0600
+++ bw/trunk/global.sym 2005-03-30 11:09:37.000000000 -0600
@@ -617,6 +617,7 @@
Perl_gp_dup
Perl_mg_dup
Perl_sv_dup
+Perl_rvpv_dup
Perl_sys_intern_dup
Perl_ptr_table_new
Perl_ptr_table_fetch
diff -ur bleadperl/mg.c bw/trunk/mg.c
--- bleadperl/mg.c 2005-03-29 09:48:42.000000000 -0600
+++ bw/trunk/mg.c 2005-03-30 11:15:58.000000000 -0600
@@ -2489,7 +2489,7 @@
{
union pstun un;
s = SvPV(sv, len);
- un.pst_command = s;
+ un.pst_command = (char *)s;
pstat(PSTAT_SETCMD, un, len, 0, 0);
}
#endif
diff -ur bleadperl/op.c bw/trunk/op.c
--- bleadperl/op.c 2005-03-29 09:48:43.000000000 -0600
+++ bw/trunk/op.c 2005-03-30 10:58:11.000000000 -0600
@@ -190,14 +190,14 @@
}
STATIC void
-S_bad_type(pTHX_ I32 n, const char *t, const char *name, OP *kid)
+S_bad_type(pTHX_ I32 n, const char *t, const char *name, const OP *kid)
{
yyerror(Perl_form(aTHX_ "Type of arg %d to %s must be %s (not %s)",
(int)n, name, t, OP_DESC(kid)));
}
STATIC void
-S_no_bareword_allowed(pTHX_ OP *o)
+S_no_bareword_allowed(pTHX_ const OP *o)
{
qerror(Perl_mess(aTHX_
"Bareword \"%"SVf"\" not allowed while \"strict subs\" in
use",
@@ -270,7 +270,6 @@
void
Perl_op_free(pTHX_ OP *o)
{
- register OP *kid, *nextkid;
OPCODE type;
PADOFFSET refcnt;
@@ -297,6 +296,7 @@
}
if (o->op_flags & OPf_KIDS) {
+ register OP *kid, *nextkid;
for (kid = cUNOPo->op_first; kid; kid = nextkid) {
nextkid = kid->op_sibling; /* Get before next freeing kid */
op_free(kid);
@@ -494,13 +494,13 @@
OP *
Perl_linklist(pTHX_ OP *o)
{
- register OP *kid;
if (o->op_next)
return o->op_next;
/* establish postfix order */
if (cUNOPo->op_first) {
+ register OP *kid;
o->op_next = LINKLIST(cUNOPo->op_first);
for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling) {
if (kid->op_sibling)
@@ -531,7 +531,7 @@
{
if (o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST) {
if (ckWARN(WARN_SYNTAX)) {
- line_t oldline = CopLINE(PL_curcop);
+ const line_t oldline = CopLINE(PL_curcop);
if (PL_copline != NOLINE)
CopLINE_set(PL_curcop, PL_copline);
@@ -843,8 +843,8 @@
OP *
Perl_listkids(pTHX_ OP *o)
{
- OP *kid;
if (o && o->op_flags & OPf_KIDS) {
+ OP *kid;
for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling)
list(kid);
}
@@ -929,14 +929,13 @@
OP *
Perl_scalarseq(pTHX_ OP *o)
{
- OP *kid;
-
if (o) {
if (o->op_type == OP_LINESEQ ||
o->op_type == OP_SCOPE ||
o->op_type == OP_LEAVE ||
o->op_type == OP_LEAVETRY)
{
+ OP *kid;
for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling) {
if (kid->op_sibling) {
scalarvoid(kid);
@@ -956,8 +955,8 @@
STATIC OP *
S_modkids(pTHX_ OP *o, I32 type)
{
- OP *kid;
if (o && o->op_flags & OPf_KIDS) {
+ OP *kid;
for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling)
mod(kid, type);
}
@@ -1317,7 +1316,7 @@
}
STATIC bool
-S_scalar_mod_type(pTHX_ OP *o, I32 type)
+S_scalar_mod_type(pTHX_ const OP *o, I32 type)
{
switch (type) {
case OP_SASSIGN:
@@ -1364,7 +1363,7 @@
}
STATIC bool
-S_is_handle_constructor(pTHX_ OP *o, I32 argnum)
+S_is_handle_constructor(pTHX_ const OP *o, I32 argnum)
{
switch (o->op_type) {
case OP_PIPE_OP:
@@ -1389,8 +1388,8 @@
OP *
Perl_refkids(pTHX_ OP *o, I32 type)
{
- OP *kid;
if (o && o->op_flags & OPf_KIDS) {
+ OP *kid;
for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling)
ref(kid, type);
}
@@ -1617,8 +1616,8 @@
*/
void
-Perl_apply_attrs_string(pTHX_ char *stashpv, CV *cv,
- char *attrstr, STRLEN len)
+Perl_apply_attrs_string(pTHX_ const char *stashpv, CV *cv,
+ const char *attrstr, STRLEN len)
{
OP *attrs = Nullop;
@@ -1629,7 +1628,7 @@
while (len) {
for (; isSPACE(*attrstr) && len; --len, ++attrstr) ;
if (len) {
- char *sstr = attrstr;
+ const char *sstr = attrstr;
for (; !isSPACE(*attrstr) && len; --len, ++attrstr) ;
attrs = append_elem(OP_LIST, attrs,
newSVOP(OP_CONST, 0,
@@ -1650,7 +1649,6 @@
STATIC OP *
S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
{
- OP *kid;
I32 type;
if (!o || PL_error_count)
@@ -1658,6 +1656,7 @@
type = o->op_type;
if (type == OP_LIST) {
+ OP *kid;
for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling)
my_kid(kid, attrs, imopsp);
} else if (type == OP_UNDEF) {
@@ -1871,7 +1870,7 @@
OP*
Perl_block_end(pTHX_ I32 floor, OP *seq)
{
- int needblockscope = PL_hints & HINT_BLOCK_SCOPE;
+ const int needblockscope = PL_hints & HINT_BLOCK_SCOPE;
OP* retval = scalarseq(seq);
LEAVE_SCOPE(floor);
PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
@@ -1884,7 +1883,7 @@
STATIC OP *
S_newDEFSVOP(pTHX)
{
- I32 offset = pad_findmy("$_");
+ const I32 offset = pad_findmy("$_");
if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS(offset) & SVpad_OUR) {
return newSVREF(newGVOP(OP_GV, 0, PL_defgv));
}
@@ -2086,7 +2085,7 @@
Perl_gen_constant_list(pTHX_ register OP *o)
{
register OP *curop;
- I32 oldtmps_floor = PL_tmps_floor;
+ const I32 oldtmps_floor = PL_tmps_floor;
list(o);
if (PL_error_count)
@@ -2956,7 +2955,7 @@
void
Perl_package(pTHX_ OP *o)
{
- char *name;
+ const char *name;
STRLEN len;
save_hptr(&PL_curstash);
@@ -3134,9 +3133,9 @@
}
}
{
- line_t ocopline = PL_copline;
- COP *ocurcop = PL_curcop;
- int oexpect = PL_expect;
+ const line_t ocopline = PL_copline;
+ COP * const ocurcop = PL_curcop;
+ const int oexpect = PL_expect;
utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0),
veop, modname, imop);
@@ -3178,7 +3177,7 @@
}
STATIC I32
-S_list_assignment(pTHX_ register OP *o)
+S_list_assignment(pTHX_ register const OP *o)
{
if (!o)
return TRUE;
@@ -3187,8 +3186,8 @@
o = cUNOPo->op_first;
if (o->op_type == OP_COND_EXPR) {
- I32 t = list_assignment(cLOGOPo->op_first->op_sibling);
- I32 f = list_assignment(cLOGOPo->op_first->op_sibling->op_sibling);
+ const I32 t = list_assignment(cLOGOPo->op_first->op_sibling);
+ const I32 f =
list_assignment(cLOGOPo->op_first->op_sibling->op_sibling);
if (t && f)
return TRUE;
@@ -3502,7 +3501,7 @@
}
else {
/* check for C<my $x if 0>, or C<my($x,$y) if 0> */
- OP *o2 = other;
+ const OP *o2 = other;
if ( ! (o2->op_type == OP_LIST
&& (( o2 = cUNOPx(o2)->op_first))
&& o2->op_type == OP_PUSHMARK
@@ -3528,8 +3527,8 @@
else if (ckWARN(WARN_MISC) && (first->op_flags & OPf_KIDS) &&
type != OP_DOR) /* [#24076] Don't warn for <FH> err FOO. */
{
- OP *k1 = ((UNOP*)first)->op_first;
- OP *k2 = k1->op_sibling;
+ const OP *k1 = ((UNOP*)first)->op_first;
+ const OP *k2 = k1->op_sibling;
OPCODE warnop = 0;
switch (first->op_type)
{
@@ -3554,7 +3553,7 @@
break;
}
if (warnop) {
- line_t oldline = CopLINE(PL_curcop);
+ const line_t oldline = CopLINE(PL_curcop);
CopLINE_set(PL_curcop, PL_copline);
Perl_warner(aTHX_ packWARN(WARN_MISC),
"Value of %s%s can be \"0\"; test with defined()",
@@ -4101,7 +4100,7 @@
*/
SV *
-Perl_op_const_sv(pTHX_ OP *o, CV *cv)
+Perl_op_const_sv(pTHX_ const OP *o, CV *cv)
{
SV *sv = Nullsv;
@@ -4181,8 +4180,8 @@
Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
{
STRLEN n_a;
- char *name;
- char *aname;
+ const char *name;
+ const char *aname;
GV *gv;
char *ps;
register CV *cv=0;
@@ -4255,7 +4254,7 @@
const_sv = op_const_sv(block, Nullcv);
if (cv) {
- bool exists = CvROOT(cv) || CvXSUB(cv);
+ const bool exists = CvROOT(cv) || CvXSUB(cv);
#ifdef GV_UNIQUE_CHECK
if (exists && GvUNIQUE(gv)) {
@@ -4288,7 +4287,7 @@
|| (CvCONST(cv)
&& (!const_sv || sv_cmp(cv_const_sv(cv), const_sv))))
{
- line_t oldline = CopLINE(PL_curcop);
+ const line_t oldline = CopLINE(PL_curcop);
if (PL_copline != NOLINE)
CopLINE_set(PL_curcop, PL_copline);
Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
@@ -4391,7 +4390,7 @@
op_free(block);
block = Nullop;
if (name) {
- char *s = strrchr(name, ':');
+ const char *s = strrchr(name, ':');
s = s ? s+1 : name;
if (strEQ(s, "BEGIN")) {
const char not_safe[] =
@@ -4438,8 +4437,8 @@
}
if (name || aname) {
- char *s;
- char *tname = (name ? name : aname);
+ const char *s;
+ const char *tname = (name ? name : aname);
if (PERLDB_SUBLINE && PL_curstash != PL_debstash) {
SV *sv = NEWSV(0,0);
@@ -4474,7 +4473,7 @@
goto done;
if (strEQ(s, "BEGIN") && !PL_error_count) {
- I32 oldscope = PL_scopestack_ix;
+ const I32 oldscope = PL_scopestack_ix;
ENTER;
SAVECOPFILE(&PL_compiling);
SAVECOPLINE(&PL_compiling);
@@ -4597,7 +4596,7 @@
/* already defined (or promised) */
if (ckWARN(WARN_REDEFINE) && !(CvGV(cv) && GvSTASH(CvGV(cv))
&& strEQ(HvNAME(GvSTASH(CvGV(cv))), "autouse"))) {
- line_t oldline = CopLINE(PL_curcop);
+ const line_t oldline = CopLINE(PL_curcop);
if (PL_copline != NOLINE)
CopLINE_set(PL_curcop, PL_copline);
Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
@@ -4695,7 +4694,7 @@
GvMULTI_on(gv);
if ((cv = GvFORM(gv))) {
if (ckWARN(WARN_REDEFINE)) {
- line_t oldline = CopLINE(PL_curcop);
+ const line_t oldline = CopLINE(PL_curcop);
if (PL_copline != NOLINE)
CopLINE_set(PL_curcop, PL_copline);
Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
@@ -4901,8 +4900,8 @@
|| o->op_type == OP_BIT_AND
|| o->op_type == OP_BIT_XOR))
{
- OP * left = cBINOPo->op_first;
- OP * right = left->op_sibling;
+ const OP * left = cBINOPo->op_first;
+ const OP * right = left->op_sibling;
if ((OP_IS_NUMCOMPARE(left->op_type) &&
(left->op_flags & OPf_PARENS) == 0) ||
(OP_IS_NUMCOMPARE(right->op_type) &&
@@ -4920,7 +4919,7 @@
OP *
Perl_ck_concat(pTHX_ OP *o)
{
- OP *kid = cUNOPo->op_first;
+ const OP *kid = cUNOPo->op_first;
if (kid->op_type == OP_CONCAT && !(kid->op_private & OPpTARGET_MY) &&
!(kUNOP->op_first->op_flags & OPf_MOD))
o->op_flags |= OPf_STACKED;
@@ -4933,7 +4932,7 @@
if (o->op_flags & OPf_KIDS) {
OP* newop;
OP* kid;
- OPCODE type = o->op_type;
+ const OPCODE type = o->op_type;
o = modkids(ck_fun(o), type);
kid = cUNOPo->op_first;
newop = kUNOP->op_first->op_sibling;
@@ -4992,7 +4991,7 @@
OP *
Perl_ck_eof(pTHX_ OP *o)
{
- I32 type = o->op_type;
+ const I32 type = o->op_type;
if (o->op_flags & OPf_KIDS) {
if (cLISTOPo->op_first->op_type == OP_STUB) {
@@ -5066,8 +5065,8 @@
OP *
Perl_ck_exec(pTHX_ OP *o)
{
- OP *kid;
if (o->op_flags & OPf_STACKED) {
+ OP *kid;
o = ck_fun(o);
kid = cUNOPo->op_first->op_sibling;
if (kid->op_type == OP_RV2GV)
@@ -5213,7 +5212,7 @@
OP *
Perl_ck_ftst(pTHX_ OP *o)
{
- I32 type = o->op_type;
+ const I32 type = o->op_type;
if (o->op_flags & OPf_REF) {
/* nothing */
@@ -5250,11 +5249,7 @@
OP *
Perl_ck_fun(pTHX_ OP *o)
{
- register OP *kid;
- OP **tokid;
- OP *sibl;
- I32 numargs = 0;
- int type = o->op_type;
+ const int type = o->op_type;
register I32 oa = PL_opargs[type] >> OASHIFT;
if (o->op_flags & OPf_STACKED) {
@@ -5265,8 +5260,11 @@
}
if (o->op_flags & OPf_KIDS) {
- tokid = &cLISTOPo->op_first;
- kid = cLISTOPo->op_first;
+ OP **tokid = &cLISTOPo->op_first;
+ register OP *kid = cLISTOPo->op_first;
+ OP *sibl;
+ I32 numargs = 0;
+
if (kid->op_type == OP_PUSHMARK ||
(kid->op_type == OP_NULL && kid->op_targ == OP_PUSHMARK))
{
@@ -5428,7 +5426,7 @@
else if (op->op_type == OP_PADAV
|| op->op_type == OP_PADHV) {
/* lexicalvar $a[] or $h{} */
- char *padname =
+ const char *padname =
PAD_COMPNAME_PV(op->op_targ);
if (padname)
tmpstr =
@@ -5555,7 +5553,7 @@
{
LOGOP *gwop;
OP *kid;
- OPCODE type = o->op_type == OP_GREPSTART ? OP_GREPWHILE : OP_MAPWHILE;
+ const OPCODE type = o->op_type == OP_GREPSTART ? OP_GREPWHILE :
OP_MAPWHILE;
I32 offset;
o->op_ppaddr = PL_ppaddr[OP_GREPSTART];
@@ -5632,7 +5630,7 @@
OP *
Perl_ck_lfun(pTHX_ OP *o)
{
- OPCODE type = o->op_type;
+ const OPCODE type = o->op_type;
return modkids(ck_fun(o), type);
}
@@ -5677,7 +5675,7 @@
OP *
Perl_ck_rfun(pTHX_ OP *o)
{
- OPCODE type = o->op_type;
+ const OPCODE type = o->op_type;
return refkids(ck_fun(o), type);
}
@@ -5758,7 +5756,7 @@
Perl_ck_match(pTHX_ OP *o)
{
if (o->op_type != OP_QR) {
- I32 offset = pad_findmy("$_");
+ const I32 offset = pad_findmy("$_");
if (offset != NOT_IN_PAD && !(PAD_COMPNAME_FLAGS(offset) & SVpad_OUR)) {
o->op_targ = offset;
o->op_private |= OPpTARGET_MY;
@@ -5907,8 +5905,8 @@
OP *
Perl_ck_return(pTHX_ OP *o)
{
- OP *kid;
if (CvLVALUE(PL_compcv)) {
+ OP *kid;
for (kid = cLISTOPo->op_first->op_sibling; kid; kid = kid->op_sibling)
mod(kid, OP_LEAVESUBLV);
}
@@ -5948,7 +5946,7 @@
OP *
Perl_ck_shift(pTHX_ OP *o)
{
- I32 type = o->op_type;
+ const I32 type = o->op_type;
if (!(o->op_flags & OPf_KIDS)) {
OP *argop;
@@ -6152,11 +6150,10 @@
Perl_ck_join(pTHX_ OP *o)
{
if (ckWARN(WARN_SYNTAX)) {
- OP *kid = cLISTOPo->op_first->op_sibling;
+ const OP *kid = cLISTOPo->op_first->op_sibling;
if (kid && kid->op_type == OP_MATCH) {
- const char *pmstr = "STRING";
- if (PM_GETRE(kPMOP))
- pmstr = PM_GETRE(kPMOP)->precomp;
+ const REGEXP *re = PM_GETRE(kPMOP);
+ const char *pmstr = re ? re->precomp : "STRING";
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
"/%s/ should probably be written as \"%s\"",
pmstr, pmstr);
@@ -6309,8 +6306,8 @@
break;
case ']':
if (contextclass) {
- char *p = proto;
- char s = *p;
+ char *p = proto;
+ const char s = *p;
contextclass = 0;
*p = '\0';
while (*--p != '[');
@@ -6488,7 +6485,7 @@
* Despite being a "constant", the SV is written to,
* for reference counts, sv_upgrade() etc. */
if (cSVOP->op_sv) {
- PADOFFSET ix = pad_alloc(OP_CONST, SVs_PADTMP);
+ const PADOFFSET ix = pad_alloc(OP_CONST, SVs_PADTMP);
if (o->op_type == OP_CONST && SvPADTMP(cSVOPo->op_sv)) {
/* If op_sv is already a PADTMP then it is being used by
* some pad, so make a copy. */
@@ -6683,7 +6680,7 @@
o->op_next->op_sibling->op_type != OP_EXIT &&
o->op_next->op_sibling->op_type != OP_WARN &&
o->op_next->op_sibling->op_type != OP_DIE) {
- line_t oldline = CopLINE(PL_curcop);
+ const line_t oldline = CopLINE(PL_curcop);
CopLINE_set(PL_curcop, CopLINE((COP*)o->op_next));
Perl_warner(aTHX_ packWARN(WARN_EXEC),
diff -ur bleadperl/perl.c bw/trunk/perl.c
--- bleadperl/perl.c 2005-03-29 04:08:10.000000000 -0600
+++ bw/trunk/perl.c 2005-03-30 11:11:04.000000000 -0600
@@ -3838,6 +3838,7 @@
int euid = PerlProc_geteuid();
int gid = PerlProc_getgid();
int egid = PerlProc_getegid();
+ (void)envp;
#ifdef VMS
uid |= gid << 16;
@@ -3853,7 +3854,6 @@
&& (argv[1][1] == 't' || argv[1][1] == 'T') )
return 1;
return 0;
- (void)envp;
}
STATIC void
diff -ur bleadperl/Porting/Maintainers.pl bw/trunk/Porting/Maintainers.pl
--- bleadperl/Porting/Maintainers.pl 2005-02-15 09:18:36.000000000 -0600
+++ bw/trunk/Porting/Maintainers.pl 2005-03-30 10:00:06.000000000 -0600
@@ -40,7 +40,7 @@
'ni-s' => 'Nick Ing-Simmons <[EMAIL PROTECTED]>',
'p5p' => 'perl5-porters <[email protected]>',
'perlfaq' => 'perlfaq-workers <[email protected]>',
- 'petdance' => 'Andy Lester <[EMAIL PROTECTED]>',
+ 'petdance' => 'Andy Lester <[EMAIL PROTECTED]>',
'pmqs' => 'Paul Marquess <[EMAIL PROTECTED]>',
'pvhp' => 'Peter Prymmer <[EMAIL PROTECTED]>',
'rclamp' => 'Richard Clamp <[EMAIL PROTECTED]>',
diff -ur bleadperl/proto.h bw/trunk/proto.h
--- bleadperl/proto.h 2005-03-29 07:08:29.000000000 -0600
+++ bw/trunk/proto.h 2005-03-30 11:09:36.000000000 -0600
@@ -56,7 +56,7 @@
PERL_CALLCONV OP* Perl_append_elem(pTHX_ I32 optype, OP* head, OP* tail);
PERL_CALLCONV OP* Perl_append_list(pTHX_ I32 optype, LISTOP* first,
LISTOP* last);
PERL_CALLCONV I32 Perl_apply(pTHX_ I32 type, SV** mark, SV** sp);
-PERL_CALLCONV void Perl_apply_attrs_string(pTHX_ char *stashpv, CV *cv,
char *attrstr, STRLEN len);
+PERL_CALLCONV void Perl_apply_attrs_string(pTHX_ const char *stashpv, CV
*cv, const char *attrstr, STRLEN len);
PERL_CALLCONV void Perl_av_clear(pTHX_ AV* ar);
PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV* ar, I32 key, I32 flags);
PERL_CALLCONV bool Perl_av_exists(pTHX_ AV* ar, I32 key);
@@ -126,7 +126,7 @@
PERL_CALLCONV void Perl_cv_ckproto(pTHX_ const CV* cv, const GV* gv, const
char* p);
PERL_CALLCONV CV* Perl_cv_clone(pTHX_ CV* proto);
PERL_CALLCONV SV* Perl_cv_const_sv(pTHX_ CV* cv);
-PERL_CALLCONV SV* Perl_op_const_sv(pTHX_ OP* o, CV* cv);
+PERL_CALLCONV SV* Perl_op_const_sv(pTHX_ const OP* o, CV* cv);
PERL_CALLCONV void Perl_cv_undef(pTHX_ CV* cv);
PERL_CALLCONV void Perl_cx_dump(pTHX_ PERL_CONTEXT* cs);
PERL_CALLCONV SV* Perl_filter_add(pTHX_ filter_t funcp, SV* datasv);
@@ -142,7 +142,7 @@
__attribute__format__(__printf__,pTHX_1,pTHX_2);
PERL_CALLCONV void Perl_vdeb(pTHX_ const char* pat, va_list* args);
PERL_CALLCONV void Perl_debprofdump(pTHX);
-PERL_CALLCONV I32 Perl_debop(pTHX_ OP* o);
+PERL_CALLCONV I32 Perl_debop(pTHX_ const OP* o);
PERL_CALLCONV I32 Perl_debstack(pTHX);
PERL_CALLCONV I32 Perl_debstackptrs(pTHX);
PERL_CALLCONV char* Perl_delimcpy(pTHX_ char* to, const char* toend, const
char* from, const char* fromend, int delim, I32* retlen);
@@ -203,7 +203,7 @@
#endif
PERL_CALLCONV void Perl_dump_form(pTHX_ const GV* gv);
PERL_CALLCONV void Perl_gv_dump(pTHX_ GV* gv);
-PERL_CALLCONV void Perl_op_dump(pTHX_ OP* arg);
+PERL_CALLCONV void Perl_op_dump(pTHX_ const OP* arg);
PERL_CALLCONV void Perl_pmop_dump(pTHX_ PMOP* pm);
PERL_CALLCONV void Perl_dump_packsubs(pTHX_ const HV* stash);
PERL_CALLCONV void Perl_dump_sub(pTHX_ const GV* gv);
@@ -858,11 +858,11 @@
PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const
char *name, GV *sv);
PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, const
char *name, GV *sv);
PERL_CALLCONV void Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, const
char *name, HV *sv);
-PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC
*mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
-PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o);
-PERL_CALLCONV void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP
*pm);
+PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const
MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
+PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP
*o);
+PERL_CALLCONV void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const
PMOP *pm);
PERL_CALLCONV void Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv,
I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
-PERL_CALLCONV void Perl_magic_dump(pTHX_ MAGIC *mg);
+PERL_CALLCONV void Perl_magic_dump(pTHX_ const MAGIC *mg);
PERL_CALLCONV void Perl_reginitcolors(pTHX);
PERL_CALLCONV char* Perl_sv_2pv_nolen(pTHX_ SV* sv);
PERL_CALLCONV char* Perl_sv_2pvutf8_nolen(pTHX_ SV* sv);
@@ -896,6 +896,7 @@
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);
#if defined(HAVE_INTERP_INTERN)
PERL_CALLCONV void Perl_sys_intern_dup(pTHX_ struct interp_intern* src,
struct interp_intern* dst);
#endif
@@ -959,11 +960,11 @@
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT)
-STATIC I32 S_list_assignment(pTHX_ OP *o);
-STATIC void S_bad_type(pTHX_ I32 n, const char *t, const char *name, OP
*kid);
+STATIC I32 S_list_assignment(pTHX_ const OP *o);
+STATIC void S_bad_type(pTHX_ I32 n, const char *t, const char *name, const
OP *kid);
STATIC void S_cop_free(pTHX_ COP *cop);
STATIC OP* S_modkids(pTHX_ OP *o, I32 type);
-STATIC void S_no_bareword_allowed(pTHX_ OP *o);
+STATIC void S_no_bareword_allowed(pTHX_ const OP *o);
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, const char* name);
@@ -971,9 +972,9 @@
STATIC OP* S_newDEFSVOP(pTHX);
STATIC OP* S_new_logop(pTHX_ I32 type, I32 flags, OP **firstp, OP
**otherp);
STATIC void S_simplify_sort(pTHX_ OP *o);
-STATIC bool S_is_handle_constructor(pTHX_ OP *o, I32 argnum);
+STATIC bool S_is_handle_constructor(pTHX_ const OP *o, I32 argnum);
STATIC char* S_gv_ename(pTHX_ GV *gv);
-STATIC bool S_scalar_mod_type(pTHX_ OP *o, I32 type);
+STATIC bool S_scalar_mod_type(pTHX_ const OP *o, I32 type);
STATIC OP * S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp);
STATIC OP * S_dup_attrlist(pTHX_ OP *o);
STATIC void S_apply_attrs(pTHX_ HV *stash, SV *target, OP *attrs, bool
for_my);
diff -ur bleadperl/sv.c bw/trunk/sv.c
--- bleadperl/sv.c 2005-03-29 07:08:29.000000000 -0600
+++ bw/trunk/sv.c 2005-03-30 11:10:29.000000000 -0600
@@ -7228,7 +7228,7 @@
screamer2:
if (rslen) {
- register STDCHAR *bpe = buf + sizeof(buf);
+ const register STDCHAR *bpe = buf + sizeof(buf);
bp = buf;
while ((i = PerlIO_getc(fp)) != EOF && (*bp++ = (STDCHAR)i) !=
rslast && bp < bpe)
; /* keep reading */
@@ -11617,7 +11617,7 @@
# ifdef DEBUGGING
Poison(my_perl, 1, PerlInterpreter);
PL_op = Nullop;
- PL_curcop = Nullop;
+ PL_curcop = NULL;
PL_markstack = 0;
PL_scopestack = 0;
PL_savestack = 0;
diff -ur bleadperl/universal.c bw/trunk/universal.c
--- bleadperl/universal.c 2005-03-24 10:52:51.000000000 -0600
+++ bw/trunk/universal.c 2005-03-30 09:40:03.000000000 -0600
@@ -249,8 +249,9 @@
{
dXSARGS;
SV *sv;
- char *name;
+ const char *name;
STRLEN n_a;
+ (void)cv;
if (items != 2)
Perl_croak(aTHX_ "Usage: UNIVERSAL::isa(reference, kind)");
@@ -264,7 +265,7 @@
|| (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))))
XSRETURN_UNDEF;
- name = (char *)SvPV(ST(1),n_a);
+ name = (const char *)SvPV(ST(1),n_a);
ST(0) = boolSV(sv_derived_from(sv, name));
XSRETURN(1);
@@ -274,10 +275,11 @@
{
dXSARGS;
SV *sv;
- char *name;
+ const char *name;
SV *rv;
HV *pkg = NULL;
STRLEN n_a;
+ (void)cv;
if (items != 2)
Perl_croak(aTHX_ "Usage: UNIVERSAL::can(object-ref, method)");
@@ -291,7 +293,7 @@
|| (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))))
XSRETURN_UNDEF;
- name = (char *)SvPV(ST(1),n_a);
+ name = (const char *)SvPV(ST(1),n_a);
rv = &PL_sv_undef;
if (SvROK(sv)) {
@@ -321,6 +323,7 @@
GV *gv;
SV *sv;
const char *undef;
+ (void)cv;
if (SvROK(ST(0))) {
sv = (SV*)SvRV(ST(0));
@@ -390,6 +393,7 @@
XS(XS_version_new)
{
dXSARGS;
+ (void)cv;
if (items > 3)
Perl_croak(aTHX_ "Usage: version::new(class, version)");
SP -= items;
@@ -416,6 +420,7 @@
XS(XS_version_stringify)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::stringify(lobj, ...)");
SP -= items;
@@ -439,6 +444,7 @@
XS(XS_version_numify)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::numify(lobj, ...)");
SP -= items;
@@ -462,6 +468,7 @@
XS(XS_version_vcmp)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::vcmp(lobj, ...)");
SP -= items;
@@ -507,6 +514,7 @@
XS(XS_version_boolean)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::boolean(lobj, ...)");
SP -= items;
@@ -514,6 +522,7 @@
SV * lobj;
if (sv_derived_from(ST(0), "version")) {
+ /* XXX If tmp serves a purpose, explain it. */
SV *tmp = SvRV(ST(0));
lobj = tmp;
}
@@ -534,6 +543,7 @@
XS(XS_version_noop)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::noop(lobj, ...)");
{
@@ -557,6 +567,7 @@
XS(XS_version_is_alpha)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: version::is_alpha(lobj)");
SP -= items;
@@ -564,14 +575,15 @@
SV *lobj;
if (sv_derived_from(ST(0), "version")) {
+ /* XXX If tmp serves a purpose, explain it. */
SV *tmp = SvRV(ST(0));
lobj = tmp;
}
else
Perl_croak(aTHX_ "lobj is not of type version");
{
- I32 len = av_len((AV *)lobj);
- I32 digit = SvIVX(*av_fetch((AV *)lobj, len, 0));
+ const I32 len = av_len((AV *)lobj);
+ const I32 digit = SvIVX(*av_fetch((AV *)lobj, len, 0));
if ( digit < 0 )
XSRETURN_YES;
else
@@ -585,6 +597,7 @@
XS(XS_version_qv)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: version::qv(ver)");
SP -= items;
@@ -622,10 +635,11 @@
XS(XS_utf8_is_utf8)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::is_utf8(sv)");
{
- SV * sv = ST(0);
+ const SV *sv = ST(0);
{
if (SvUTF8(sv))
XSRETURN_YES;
@@ -639,14 +653,15 @@
XS(XS_utf8_valid)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::valid(sv)");
{
SV * sv = ST(0);
{
STRLEN len;
- char *s = SvPV(sv,len);
- if (!SvUTF8(sv) || is_utf8_string((U8*)s,len))
+ const char *s = SvPV(sv,len);
+ if (!SvUTF8(sv) || is_utf8_string((const U8*)s,len))
XSRETURN_YES;
else
XSRETURN_NO;
@@ -658,6 +673,7 @@
XS(XS_utf8_encode)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::encode(sv)");
{
@@ -671,13 +687,12 @@
XS(XS_utf8_decode)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::decode(sv)");
{
SV * sv = ST(0);
- bool RETVAL;
-
- RETVAL = sv_utf8_decode(sv);
+ const bool RETVAL = sv_utf8_decode(sv);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
@@ -687,6 +702,7 @@
XS(XS_utf8_upgrade)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::upgrade(sv)");
{
@@ -703,20 +719,14 @@
XS(XS_utf8_downgrade)
{
dXSARGS;
+ (void)cv;
if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: utf8::downgrade(sv, failok=0)");
{
SV * sv = ST(0);
- bool failok;
- bool RETVAL;
-
- if (items < 2)
- failok = 0;
- else {
- failok = (int)SvIV(ST(1));
- }
+ const bool failok = (items<2) ? 0 : (int)SvIV(ST(1));
+ const bool RETVAL = sv_utf8_downgrade(sv, failok);
- RETVAL = sv_utf8_downgrade(sv, failok);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
@@ -726,7 +736,8 @@
XS(XS_utf8_native_to_unicode)
{
dXSARGS;
- UV uv = SvUV(ST(0));
+ const UV uv = SvUV(ST(0));
+ (void)cv;
if (items > 1)
Perl_croak(aTHX_ "Usage: utf8::native_to_unicode(sv)");
@@ -738,7 +749,8 @@
XS(XS_utf8_unicode_to_native)
{
dXSARGS;
- UV uv = SvUV(ST(0));
+ const UV uv = SvUV(ST(0));
+ (void)cv;
if (items > 1)
Perl_croak(aTHX_ "Usage: utf8::unicode_to_native(sv)");
@@ -751,6 +763,8 @@
{
dXSARGS;
SV *sv = SvRV(ST(0));
+ (void)cv;
+
if (items == 1) {
if (SvREADONLY(sv))
XSRETURN_YES;
@@ -775,6 +789,8 @@
{
dXSARGS;
SV *sv = SvRV(ST(0));
+ (void)cv;
+
if (items == 1)
XSRETURN_IV(SvREFCNT(sv) - 1); /* Minus the ref created for us. */
else if (items == 2) {
@@ -789,6 +805,8 @@
{
dXSARGS;
HV *hv = (HV *) SvRV(ST(0));
+ (void)cv;
+
if (items != 1)
Perl_croak(aTHX_ "Usage: UNIVERSAL::hv_clear_placeholders(hv)");
hv_clear_placeholders(hv);
@@ -797,12 +815,13 @@
XS(XS_Regexp_DESTROY)
{
-
+ (void)cv;
}
XS(XS_PerlIO_get_layers)
{
dXSARGS;
+ (void)cv;
if (items < 1 || items % 2 == 0)
Perl_croak(aTHX_ "Usage: PerlIO_get_layers(filehandle[,args])");
#ifdef USE_PERLIO
@@ -820,7 +839,7 @@
SV **varp = svp;
SV **valp = svp + 1;
STRLEN klen;
- char *key = SvPV(*varp, klen);
+ const char *key = SvPV(*varp, klen);
switch (*key) {
case 'i':
@@ -930,6 +949,7 @@
/* Using dXSARGS would also have dITEM and dSP,
* which define 2 unused local variables. */
dMARK; dAX;
+ (void)cv;
XSRETURN_UV(PERL_HASH_SEED);
}
@@ -938,14 +958,16 @@
/* Using dXSARGS would also have dITEM and dSP,
* which define 2 unused local variables. */
dMARK; dAX;
+ (void)cv;
XSRETURN_UV(PL_rehash_seed);
}
XS(XS_Internals_HvREHASH) /* Subject to change */
{
dXSARGS;
+ (void)cv;
if (SvROK(ST(0))) {
- HV *hv = (HV *) SvRV(ST(0));
+ const HV *hv = (HV *) SvRV(ST(0));
if (items == 1 && SvTYPE(hv) == SVt_PVHV) {
if (HvREHASH(hv))
XSRETURN_YES;
diff -ur bleadperl/xsutils.c bw/trunk/xsutils.c
--- bleadperl/xsutils.c 2005-03-24 10:52:51.000000000 -0600
+++ bw/trunk/xsutils.c 2005-03-30 11:03:58.000000000 -0600
@@ -160,6 +160,7 @@
{
dXSARGS;
const char file[] = __FILE__;
+ (void)cv;
if( items > 1 )
Perl_croak(aTHX_ "Usage: attributes::bootstrap $module");
@@ -177,6 +178,7 @@
{
dXSARGS;
SV *rv, *sv;
+ (void)cv;
if (items < 1) {
usage:
@@ -199,6 +201,7 @@
dXSARGS;
SV *rv, *sv;
cv_flags_t cvflags;
+ (void)cv;
if (items != 1) {
usage:
@@ -244,6 +247,7 @@
dXSARGS;
SV *rv, *sv;
dXSTARG;
+ (void)cv;
if (items != 1) {
usage:
@@ -264,7 +268,7 @@
sv_setsv(TARG, &PL_sv_no); /* unblessed lexical */
#endif
else {
- HV *stash = Nullhv;
+ const HV *stash = Nullhv;
switch (SvTYPE(sv)) {
case SVt_PVCV:
if (CvGV(sv) && isGV(CvGV(sv)) && GvSTASH(CvGV(sv)))
@@ -296,6 +300,7 @@
dXSARGS;
SV *rv, *sv;
dXSTARG;
+ (void)cv;
if (items != 1) {
usage:
@@ -319,6 +324,7 @@
XS(XS_attributes__warn_reserved)
{
dXSARGS;
+ (void)cv;
if (items != 0) {
Perl_croak(aTHX_