summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-15 03:07:08 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-15 03:07:08 +0000
commit08105a92a3e1f0f7ac18e8807e8c0cad635b748a (patch)
treefe7b7b715c945c89315f70698326c7063b5d14a7
parent86cb71737ed277fd6cd123008b871f7a00c2944b (diff)
downloadperl-08105a92a3e1f0f7ac18e8807e8c0cad635b748a.tar.gz
add const qualifier to most char* prototypes, handle ripple effect
p4raw-id: //depot/perl@2924
-rw-r--r--gv.c32
-rw-r--r--hv.c17
-rw-r--r--hv.h2
-rw-r--r--mg.c2
-rw-r--r--op.c2
-rw-r--r--perl.c18
-rw-r--r--pod/perlguts.pod127
-rw-r--r--proto.h116
-rw-r--r--sv.c26
-rw-r--r--universal.c4
-rw-r--r--util.c73
11 files changed, 201 insertions, 218 deletions
diff --git a/gv.c b/gv.c
index a1e5073bb3..ff278ccc08 100644
--- a/gv.c
+++ b/gv.c
@@ -50,7 +50,7 @@ gv_IOadd(register GV *gv)
}
GV *
-gv_fetchfile(char *name)
+gv_fetchfile(const char *name)
{
dTHR;
char smallbuf[256];
@@ -80,7 +80,7 @@ gv_fetchfile(char *name)
}
void
-gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi)
+gv_init(GV *gv, HV *stash, const char *name, STRLEN len, int multi)
{
dTHR;
register GP *gp;
@@ -152,7 +152,7 @@ gv_init_sv(GV *gv, I32 sv_type)
}
GV *
-gv_fetchmeth(HV *stash, char *name, STRLEN len, I32 level)
+gv_fetchmeth(HV *stash, const char *name, STRLEN len, I32 level)
{
AV* av;
GV* topgv;
@@ -273,17 +273,17 @@ gv_fetchmeth(HV *stash, char *name, STRLEN len, I32 level)
}
GV *
-gv_fetchmethod(HV *stash, char *name)
+gv_fetchmethod(HV *stash, const char *name)
{
return gv_fetchmethod_autoload(stash, name, TRUE);
}
GV *
-gv_fetchmethod_autoload(HV *stash, char *name, I32 autoload)
+gv_fetchmethod_autoload(HV *stash, const char *name, I32 autoload)
{
dTHR;
- register char *nend;
- char *nsplit = 0;
+ register const char *nend;
+ const char *nsplit = 0;
GV* gv;
for (nend = name; *nend; nend++) {
@@ -293,7 +293,7 @@ gv_fetchmethod_autoload(HV *stash, char *name, I32 autoload)
nsplit = ++nend;
}
if (nsplit) {
- char *origname = name;
+ const char *origname = name;
name = nsplit + 1;
if (*nsplit == ':')
--nsplit;
@@ -340,7 +340,7 @@ gv_fetchmethod_autoload(HV *stash, char *name, I32 autoload)
}
GV*
-gv_autoload4(HV *stash, char *name, STRLEN len, I32 method)
+gv_autoload4(HV *stash, const char *name, STRLEN len, I32 method)
{
dTHR;
static char autoload[] = "AUTOLOAD";
@@ -385,13 +385,13 @@ gv_autoload4(HV *stash, char *name, STRLEN len, I32 method)
}
HV*
-gv_stashpv(char *name, I32 create)
+gv_stashpv(const char *name, I32 create)
{
return gv_stashpvn(name, strlen(name), create);
}
HV*
-gv_stashpvn(char *name, U32 namelen, I32 create)
+gv_stashpvn(const char *name, U32 namelen, I32 create)
{
char smallbuf[256];
char *tmpbuf;
@@ -430,14 +430,14 @@ gv_stashsv(SV *sv, I32 create)
GV *
-gv_fetchpv(char *nambeg, I32 add, I32 sv_type)
+gv_fetchpv(const char *nambeg, I32 add, I32 sv_type)
{
dTHR;
- register char *name = nambeg;
+ register const char *name = nambeg;
register GV *gv = 0;
GV**gvp;
I32 len;
- register char *namend;
+ register const char *namend;
HV *stash = 0;
U32 add_gvflags = 0;
@@ -826,7 +826,7 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type)
}
void
-gv_fullname3(SV *sv, GV *gv, char *prefix)
+gv_fullname3(SV *sv, GV *gv, const char *prefix)
{
HV *hv = GvSTASH(gv);
if (!hv) {
@@ -840,7 +840,7 @@ gv_fullname3(SV *sv, GV *gv, char *prefix)
}
void
-gv_efullname3(SV *sv, GV *gv, char *prefix)
+gv_efullname3(SV *sv, GV *gv, const char *prefix)
{
GV *egv = GvEGV(gv);
if (!egv)
diff --git a/hv.c b/hv.c
index a8d9fbca50..60c1b64d73 100644
--- a/hv.c
+++ b/hv.c
@@ -19,6 +19,7 @@ static void hv_magic_check _((HV *hv, bool *needs_copy, bool *needs_store));
static void hsplit _((HV *hv));
static void hfreeentries _((HV *hv));
static void more_he _((void));
+static HEK *save_hek _((const char *str, I32 len, U32 hash));
#endif
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
@@ -66,7 +67,7 @@ more_he(void)
}
STATIC HEK *
-save_hek(char *str, I32 len, U32 hash)
+save_hek(const char *str, I32 len, U32 hash)
{
char *k;
register HEK *hek;
@@ -90,7 +91,7 @@ unshare_hek(HEK *hek)
* contains an SV* */
SV**
-hv_fetch(HV *hv, char *key, U32 klen, I32 lval)
+hv_fetch(HV *hv, const char *key, U32 klen, I32 lval)
{
register XPVHV* xhv;
register U32 hash;
@@ -276,7 +277,7 @@ hv_magic_check (HV *hv, bool *needs_copy, bool *needs_store)
}
SV**
-hv_store(HV *hv, char *key, U32 klen, SV *val, register U32 hash)
+hv_store(HV *hv, const char *key, U32 klen, SV *val, register U32 hash)
{
register XPVHV* xhv;
register I32 i;
@@ -426,7 +427,7 @@ hv_store_ent(HV *hv, SV *keysv, SV *val, register U32 hash)
}
SV *
-hv_delete(HV *hv, char *key, U32 klen, I32 flags)
+hv_delete(HV *hv, const char *key, U32 klen, I32 flags)
{
register XPVHV* xhv;
register I32 i;
@@ -569,7 +570,7 @@ hv_delete_ent(HV *hv, SV *keysv, I32 flags, U32 hash)
}
bool
-hv_exists(HV *hv, char *key, U32 klen)
+hv_exists(HV *hv, const char *key, U32 klen)
{
register XPVHV* xhv;
register U32 hash;
@@ -1126,7 +1127,7 @@ hv_magic(HV *hv, GV *gv, int how)
}
char*
-sharepvn(char *sv, I32 len, U32 hash)
+sharepvn(const char *sv, I32 len, U32 hash)
{
return HEK_KEY(share_hek(sv, len, hash));
}
@@ -1135,7 +1136,7 @@ sharepvn(char *sv, I32 len, U32 hash)
* len and hash must both be valid for str.
*/
void
-unsharepvn(char *str, I32 len, U32 hash)
+unsharepvn(const char *str, I32 len, U32 hash)
{
register XPVHV* xhv;
register HE *entry;
@@ -1181,7 +1182,7 @@ unsharepvn(char *str, I32 len, U32 hash)
* len and hash must both be valid for str.
*/
HEK *
-share_hek(char *str, I32 len, register U32 hash)
+share_hek(const char *str, I32 len, register U32 hash)
{
register XPVHV* xhv;
register HE *entry;
diff --git a/hv.h b/hv.h
index 1f8d9ce934..1763a8860f 100644
--- a/hv.h
+++ b/hv.h
@@ -40,7 +40,7 @@ struct xpvhv {
#define PERL_HASH(hash,str,len) \
STMT_START { \
- register char *s_PeRlHaSh = str; \
+ register const char *s_PeRlHaSh = str; \
register I32 i_PeRlHaSh = len; \
register U32 hash_PeRlHaSh = 0; \
while (i_PeRlHaSh--) \
diff --git a/mg.c b/mg.c
index 76da1b4b84..ff9947a9b2 100644
--- a/mg.c
+++ b/mg.c
@@ -275,7 +275,7 @@ mg_find(SV *sv, int type)
}
int
-mg_copy(SV *sv, SV *nsv, char *key, I32 klen)
+mg_copy(SV *sv, SV *nsv, const char *key, I32 klen)
{
int count = 0;
MAGIC* mg;
diff --git a/op.c b/op.c
index 7ccfe1655e..51df80354f 100644
--- a/op.c
+++ b/op.c
@@ -541,7 +541,7 @@ pad_reset(void)
#ifdef USE_THREADS
/* find_threadsv is not reentrant */
PADOFFSET
-find_threadsv(char *name)
+find_threadsv(const char *name)
{
dTHR;
char *p;
diff --git a/perl.c b/perl.c
index 9d47e22467..69ded97d52 100644
--- a/perl.c
+++ b/perl.c
@@ -1110,7 +1110,7 @@ perl_run(PerlInterpreter *sv_interp)
}
SV*
-perl_get_sv(char *name, I32 create)
+perl_get_sv(const char *name, I32 create)
{
GV *gv;
#ifdef USE_THREADS
@@ -1129,7 +1129,7 @@ perl_get_sv(char *name, I32 create)
}
AV*
-perl_get_av(char *name, I32 create)
+perl_get_av(const char *name, I32 create)
{
GV* gv = gv_fetchpv(name, create, SVt_PVAV);
if (create)
@@ -1140,7 +1140,7 @@ perl_get_av(char *name, I32 create)
}
HV*
-perl_get_hv(char *name, I32 create)
+perl_get_hv(const char *name, I32 create)
{
GV* gv = gv_fetchpv(name, create, SVt_PVHV);
if (create)
@@ -1151,7 +1151,7 @@ perl_get_hv(char *name, I32 create)
}
CV*
-perl_get_cv(char *name, I32 create)
+perl_get_cv(const char *name, I32 create)
{
GV* gv = gv_fetchpv(name, create, SVt_PVCV);
/* XXX unsafe for threads if eval_owner isn't held */
@@ -1168,7 +1168,7 @@ perl_get_cv(char *name, I32 create)
/* Be sure to refetch the stack pointer after calling these routines. */
I32
-perl_call_argv(char *sub_name, I32 flags, register char **argv)
+perl_call_argv(const char *sub_name, I32 flags, register char **argv)
/* See G_* flags in cop.h */
/* null terminated arg list */
@@ -1187,7 +1187,7 @@ perl_call_argv(char *sub_name, I32 flags, register char **argv)
}
I32
-perl_call_pv(char *sub_name, I32 flags)
+perl_call_pv(const char *sub_name, I32 flags)
/* name of the subroutine */
/* See G_* flags in cop.h */
{
@@ -1195,7 +1195,7 @@ perl_call_pv(char *sub_name, I32 flags)
}
I32
-perl_call_method(char *methname, I32 flags)
+perl_call_method(const char *methname, I32 flags)
/* name of the subroutine */
/* See G_* flags in cop.h */
{
@@ -1444,7 +1444,7 @@ perl_eval_sv(SV *sv, I32 flags)
}
SV*
-perl_eval_pv(char *p, I32 croak_on_error)
+perl_eval_pv(const char *p, I32 croak_on_error)
{
dSP;
SV* sv = newSVpv(p, 0);
@@ -1468,7 +1468,7 @@ perl_eval_pv(char *p, I32 croak_on_error)
/* Require a module. */
void
-perl_require_pv(char *pv)
+perl_require_pv(const char *pv)
{
SV* sv;
dSP;
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 9c4831faa2..c41778c464 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -38,8 +38,8 @@ The six routines are:
SV* newSViv(IV);
SV* newSVnv(double);
- SV* newSVpv(char*, int);
- SV* newSVpvn(char*, int);
+ SV* newSVpv(const char*, int);
+ SV* newSVpvn(const char*, int);
SV* newSVpvf(const char*, ...);
SV* newSVsv(SV*);
@@ -48,8 +48,8 @@ To change the value of an *already-existing* SV, there are seven routines:
void sv_setiv(SV*, IV);
void sv_setuv(SV*, UV);
void sv_setnv(SV*, double);
- void sv_setpv(SV*, char*);
- void sv_setpvn(SV*, char*, int)
+ void sv_setpv(SV*, const char*);
+ void sv_setpvn(SV*, const char*, int)
void sv_setpvf(SV*, const char*, ...);
void sv_setpvfn(SV*, const char*, STRLEN, va_list *, SV **, I32, bool);
void sv_setsv(SV*, SV*);
@@ -150,8 +150,8 @@ But note that these last three macros are valid only if C<SvPOK()> is true.
If you want to append something to the end of string stored in an C<SV*>,
you can use the following functions:
- void sv_catpv(SV*, char*);
- void sv_catpvn(SV*, char*, int);
+ void sv_catpv(SV*, const char*);
+ void sv_catpvn(SV*, const char*, int);
void sv_catpvf(SV*, const char*, ...);
void sv_catpvfn(SV*, const char*, STRLEN, va_list *, SV **, I32, bool);
void sv_catsv(SV*, SV*);
@@ -297,8 +297,8 @@ To create an HV, you use the following routine:
Once the HV has been created, the following operations are possible on HVs:
- SV** hv_store(HV*, char* key, U32 klen, SV* val, U32 hash);
- SV** hv_fetch(HV*, char* key, U32 klen, I32 lval);
+ SV** hv_store(HV*, const char* key, U32 klen, SV* val, U32 hash);
+ SV** hv_fetch(HV*, const char* key, U32 klen, I32 lval);
The C<klen> parameter is the length of the key being passed in (Note that
you cannot pass 0 in as a value of C<klen> to tell Perl to measure the
@@ -316,8 +316,8 @@ not NULL before dereferencing it.
These two functions check if a hash table entry exists, and deletes it.
- bool hv_exists(HV*, char* key, U32 klen);
- SV* hv_delete(HV*, char* key, U32 klen, I32 flags);
+ bool hv_exists(HV*, const char* key, U32 klen);
+ SV* hv_delete(HV*, const char* key, U32 klen, I32 flags);
If C<flags> does not include the C<G_DISCARD> flag then C<hv_delete> will
create and return a mortal copy of the deleted value.
@@ -487,28 +487,28 @@ Upgrades rv to reference if not already one. Creates new SV for rv to
point to. If C<classname> is non-null, the SV is blessed into the specified
class. SV is returned.
- SV* newSVrv(SV* rv, char* classname);
+ SV* newSVrv(SV* rv, const char* classname);
Copies integer or double into an SV whose reference is C<rv>. SV is blessed
if C<classname> is non-null.
- SV* sv_setref_iv(SV* rv, char* classname, IV iv);
- SV* sv_setref_nv(SV* rv, char* classname, NV iv);
+ SV* sv_setref_iv(SV* rv, const char* classname, IV iv);
+ SV* sv_setref_nv(SV* rv, const char* classname, NV iv);
Copies the pointer value (I<the address, not the string!>) into an SV whose
reference is rv. SV is blessed if C<classname> is non-null.
- SV* sv_setref_pv(SV* rv, char* classname, PV iv);
+ SV* sv_setref_pv(SV* rv, const char* classname, PV iv);
Copies string into an SV whose reference is C<rv>. Set length to 0 to let
Perl calculate the string length. SV is blessed if C<classname> is non-null.
- SV* sv_setref_pvn(SV* rv, char* classname, PV iv, int length);
+ SV* sv_setref_pvn(SV* rv, const char* classname, PV iv, int length);
Tests whether the SV is blessed into the specified class. It does not
check inheritance relationships.
- int sv_isa(SV* sv, char* name);
+ int sv_isa(SV* sv, const char* name);
Tests whether the SV is a reference to a blessed object.
@@ -518,7 +518,7 @@ Tests whether the SV is derived from the specified class. SV can be either
a reference to a blessed object or a string containing a class name. This
is the function implementing the C<UNIVERSAL::isa> functionality.
- bool sv_derived_from(SV* sv, char* name);
+ bool sv_derived_from(SV* sv, const char* name);
To check if you've got an object derived from a specific class you have
to write:
@@ -641,7 +641,7 @@ in the stash "Baz::" in "Bar::"'s stash.
To get the stash pointer for a particular package, use the function:
- HV* gv_stashpv(char* name, I32 create)
+ HV* gv_stashpv(const char* name, I32 create)
HV* gv_stashsv(SV*, I32 create)
The first function takes a literal string, the second uses the string stored
@@ -739,7 +739,7 @@ Note this is current as of patchlevel 0, and could change at any time.
Perl adds magic to an SV using the sv_magic function:
- void sv_magic(SV* sv, SV* obj, int how, char* name, I32 namlen);
+ void sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen);
The C<sv> argument is a pointer to the SV that is to acquire a new magical
feature.
@@ -918,7 +918,7 @@ This routine returns a pointer to the C<MAGIC> structure stored in the SV.
If the SV does not have that magical feature, C<NULL> is returned. Also,
if the SV is not of type SVt_PVMG, Perl may core dump.
- int mg_copy(SV* sv, SV* nsv, char* key, STRLEN klen);
+ int mg_copy(SV* sv, SV* nsv, const char* key, STRLEN klen);
This routine checks to see what types of magic C<sv> has. If the mg_type
field is an uppercase letter, then the mg_obj is copied to C<nsv>, but
@@ -1213,9 +1213,9 @@ There are four routines that can be used to call a Perl subroutine from
within a C program. These four are:
I32 perl_call_sv(SV*, I32);
- I32 perl_call_pv(char*, I32);
- I32 perl_call_method(char*, I32);
- I32 perl_call_argv(char*, I32, register char**);
+ I32 perl_call_pv(const char*, I32);
+ I32 perl_call_method(const char*, I32);
+ I32 perl_call_argv(const char*, I32, register char**);
The routine most often used is C<perl_call_sv>. The C<SV*> argument
contains either the name of the Perl subroutine to be called, or a
@@ -1784,7 +1784,7 @@ which is not visible to Perl code. So when calling C<perl_call_sv>,
you should not use the GV directly; instead, you should use the
method's CV, which can be obtained from the GV with the C<GvCV> macro.
- GV* gv_fetchmeth (HV* stash, char* name, STRLEN len, I32 level)
+ GV* gv_fetchmeth (HV* stash, const char* name, STRLEN len, I32 level)
=item gv_fetchmethod
@@ -1813,8 +1813,8 @@ C<level==0>. C<name> should be writable if contains C<':'> or C<'\''>.
The warning against passing the GV returned by C<gv_fetchmeth> to
C<perl_call_sv> apply equally to these functions.
- GV* gv_fetchmethod (HV* stash, char* name)
- GV* gv_fetchmethod_autoload (HV* stash, char* name, I32 autoload)
+ GV* gv_fetchmethod (HV* stash, const char* name)
+ GV* gv_fetchmethod_autoload (HV* stash, const char* name, I32 autoload)
=item G_VOID
@@ -1826,7 +1826,7 @@ Returns a pointer to the stash for a specified package. If C<create> is set
then the package will be created if it does not already exist. If C<create>
is not set and the package does not exist then NULL is returned.
- HV* gv_stashpv (char* name, I32 create)
+ HV* gv_stashpv (const char* name, I32 create)
=item gv_stashsv
@@ -1923,7 +1923,7 @@ and returned to the caller. The C<klen> is the length of the key. The
C<flags> value will normally be zero; if set to G_DISCARD then NULL will be
returned.
- SV* hv_delete (HV* tb, char* key, U32 klen, I32 flags)
+ SV* hv_delete (HV* tb, const char* key, U32 klen, I32 flags)
=item hv_delete_ent
@@ -1939,7 +1939,7 @@ hash value, or 0 to ask for it to be computed.
Returns a boolean indicating whether the specified hash key exists. The
C<klen> is the length of the key.
- bool hv_exists (HV* tb, char* key, U32 klen)
+ bool hv_exists (HV* tb, const char* key, U32 klen)
=item hv_exists_ent
@@ -1958,7 +1958,7 @@ dereferencing it to a C<SV*>.
See L<Understanding the Magic of Tied Hashes and Arrays> for more
information on how to use this function on tied hashes.
- SV** hv_fetch (HV* tb, char* key, U32 klen, I32 lval)
+ SV** hv_fetch (HV* tb, const char* key, U32 klen, I32 lval)
=item hv_fetch_ent
@@ -2050,7 +2050,7 @@ before the call, and decrementing it if the function returned NULL.
See L<Understanding the Magic of Tied Hashes and Arrays> for more
information on how to use this function on tied hashes.
- SV** hv_store (HV* tb, char* key, U32 klen, SV* val, U32 hash)
+ SV** hv_store (HV* tb, const char* key, U32 klen, SV* val, U32 hash)
=item hv_store_ent
@@ -2150,7 +2150,7 @@ Clear something magical that the SV represents. See C<sv_magic>.
Copies the magic from one SV to another. See C<sv_magic>.
- int mg_copy (SV *, SV *, char *, STRLEN)
+ int mg_copy (SV *, SV *, const char *, STRLEN)
=item mg_find
@@ -2288,7 +2288,7 @@ SV is set to 1.
Creates a new SV and copies a string into it. The reference count for the
SV is set to 1. If C<len> is zero then Perl will compute the length.
- SV* newSVpv (char* s, STRLEN len)
+ SV* newSVpv (const char* s, STRLEN len)
=item newSVpvf
@@ -2303,7 +2303,7 @@ Creates a new SV and copies a string into it. The reference count for the
SV is set to 1. If C<len> is zero then Perl will create a zero length
string.
- SV* newSVpvn (char* s, STRLEN len)
+ SV* newSVpvn (const char* s, STRLEN len)
=item newSVrv
@@ -2312,7 +2312,7 @@ it will be upgraded to one. If C<classname> is non-null then the new SV will
be blessed in the specified package. The new SV is returned and its
reference count is 1.
- SV* newSVrv (SV* rv, char* classname)
+ SV* newSVrv (SV* rv, const char* classname)
=item newSVsv
@@ -2368,20 +2368,20 @@ Allocates a new Perl interpreter. See L<perlembed>.
Performs a callback to the specified Perl sub. See L<perlcall>.
- I32 perl_call_argv (char* subname, I32 flags, char** argv)
+ I32 perl_call_argv (const char* subname, I32 flags, char** argv)
=item perl_call_method
Performs a callback to the specified Perl method. The blessed object must
be on the stack. See L<perlcall>.
- I32 perl_call_method (char* methname, I32 flags)
+ I32 perl_call_method (const char* methname, I32 flags)
=item perl_call_pv
Performs a callback to the specified Perl sub. See L<perlcall>.
- I32 perl_call_pv (char* subname, I32 flags)
+ I32 perl_call_pv (const char* subname, I32 flags)
=item perl_call_sv
@@ -2408,7 +2408,7 @@ Tells Perl to C<eval> the string in the SV.
Tells Perl to C<eval> the given string and return an SV* result.
- SV* perl_eval_pv (char* p, I32 croak_on_error)
+ SV* perl_eval_pv (const char* p, I32 croak_on_error)
=item perl_free
@@ -2420,7 +2420,7 @@ Returns the AV of the specified Perl array. If C<create> is set and the
Perl variable does not exist then it will be created. If C<create> is not
set and the variable does not exist then NULL is returned.
- AV* perl_get_av (char* name, I32 create)
+ AV* perl_get_av (const char* name, I32 create)
=item perl_get_cv
@@ -2428,7 +2428,7 @@ Returns the CV of the specified Perl sub. If C<create> is set and the Perl
variable does not exist then it will be created. If C<create> is not
set and the variable does not exist then NULL is returned.
- CV* perl_get_cv (char* name, I32 create)
+ CV* perl_get_cv (const char* name, I32 create)
=item perl_get_hv
@@ -2436,7 +2436,7 @@ Returns the HV of the specified Perl hash. If C<create> is set and the Perl
variable does not exist then it will be created. If C<create> is not
set and the variable does not exist then NULL is returned.
- HV* perl_get_hv (char* name, I32 create)
+ HV* perl_get_hv (const char* name, I32 create)
=item perl_get_sv
@@ -2444,7 +2444,7 @@ Returns the SV of the specified Perl scalar. If C<create> is set and the
Perl variable does not exist then it will be created. If C<create> is not
set and the variable does not exist then NULL is returned.
- SV* perl_get_sv (char* name, I32 create)
+ SV* perl_get_sv (const char* name, I32 create)
=item perl_parse
@@ -2454,7 +2454,7 @@ Tells a Perl interpreter to parse a Perl script. See L<perlembed>.
Tells Perl to C<require> a module.
- void perl_require_pv (char* pv)
+ void perl_require_pv (const char* pv)
=item perl_run
@@ -2574,14 +2574,14 @@ The XSUB-writer's interface to the C C<realloc> function.
Copy a string to a safe spot. This does not use an SV.
- char* savepv (char* sv)
+ char* savepv (const char* sv)
=item savepvn
Copy a string to a safe spot. The C<len> indicates number of bytes to
copy. This does not use an SV.
- char* savepvn (char* sv, I32 len)
+ char* savepvn (const char* sv, I32 len)
=item SAVETMPS
@@ -2681,13 +2681,13 @@ of the SV is unaffected.
Concatenates the string onto the end of the string which is in the SV.
Handles 'get' magic, but not 'set' magic. See C<sv_catpv_mg>.
- void sv_catpv (SV* sv, char* ptr)
+ void sv_catpv (SV* sv, const char* ptr)
=item sv_catpv_mg
Like C<sv_catpv>, but also handles 'set' magic.
- void sv_catpvn (SV* sv, char* ptr)
+ void sv_catpvn (SV* sv, const char* ptr)
=item sv_catpvn
@@ -2695,13 +2695,13 @@ Concatenates the string onto the end of the string which is in the SV. The
C<len> indicates number of bytes to copy. Handles 'get' magic, but not
'set' magic. See C<sv_catpvn_mg>.
- void sv_catpvn (SV* sv, char* ptr, STRLEN len)
+ void sv_catpvn (SV* sv, const char* ptr, STRLEN len)
=item sv_catpvn_mg
Like C<sv_catpvn>, but also handles 'set' magic.
- void sv_catpvn_mg (SV* sv, char* ptr, STRLEN len)
+ void sv_catpvn_mg (SV* sv, const char* ptr, STRLEN len)
=item sv_catpvf
@@ -2737,7 +2737,7 @@ buffer. SvPOK(sv) must be true and the C<ptr> must be a pointer to
somewhere inside the string buffer. The C<ptr> becomes the first
character of the adjusted string.
- void sv_chop(SV* sv, char *ptr)
+ void sv_chop(SV* sv, const char *ptr)
=item sv_cmp
@@ -2758,7 +2758,7 @@ Returns the length of the string which is in the SV. See C<SvLEN>.
Set the length of the string which is in the SV. See C<SvCUR>.
- void SvCUR_set (SV* sv, int val )
+ void SvCUR_set (SV* sv, int val)
=item sv_dec
@@ -2768,18 +2768,11 @@ Auto-decrement of the value in the SV.
=item sv_derived_from
-Returns a boolean indicating whether the SV is a subclass of the
-specified class.
-
- int sv_derived_from(SV* sv, char* class)
-
-=item sv_derived_from
-
Returns a boolean indicating whether the SV is derived from the specified
class. This is the function that implements C<UNIVERSAL::isa>. It works
for class names as well as for objects.
- bool sv_derived_from _((SV* sv, char* name));
+ bool sv_derived_from _((SV* sv, const char* name));
=item SvEND
@@ -2800,7 +2793,7 @@ identical.
Invokes C<mg_get> on an SV if it has 'get' magic. This macro evaluates
its argument more than once.
- void SvGETMAGIC( SV *sv )
+ void SvGETMAGIC(SV *sv)
=item SvGROW
@@ -2809,7 +2802,7 @@ indicated number of bytes (remember to reserve space for an extra
trailing NUL character). Calls C<sv_grow> to perform the expansion if
necessary. Returns a pointer to the character buffer.
- char* SvGROW( SV* sv, STRLEN len )
+ char* SvGROW(SV* sv, STRLEN len)
=item sv_grow
@@ -2906,7 +2899,7 @@ Returns the length of the string in the SV. Use C<SvCUR>.
Adds magic to an SV.
- void sv_magic (SV* sv, SV* obj, int how, char* name, I32 namlen)
+ void sv_magic (SV* sv, SV* obj, int how, const char* name, I32 namlen)
=item sv_mortalcopy
@@ -3141,13 +3134,13 @@ Like C<sv_setnv>, but also handles 'set' magic.
Copies a string into an SV. The string must be null-terminated.
Does not handle 'set' magic. See C<sv_setpv_mg>.
- void sv_setpv (SV* sv, char* ptr)
+ void sv_setpv (SV* sv, const char* ptr)
=item sv_setpv_mg
Like C<sv_setpv>, but also handles 'set' magic.
- void sv_setpv_mg (SV* sv, char* ptr)
+ void sv_setpv_mg (SV* sv, const char* ptr)
=item sv_setpviv
@@ -3167,13 +3160,13 @@ Like C<sv_setpviv>, but also handles 'set' magic.
Copies a string into an SV. The C<len> parameter indicates the number of
bytes to be copied. Does not handle 'set' magic. See C<sv_setpvn_mg>.
- void sv_setpvn (SV* sv, char* ptr, STRLEN len)
+ void sv_setpvn (SV* sv, const char* ptr, STRLEN len)
=item sv_setpvn_mg
Like C<sv_setpvn>, but also handles 'set' magic.
- void sv_setpvn_mg (SV* sv, char* ptr, STRLEN len)
+ void sv_setpvn_mg (SV* sv, const char* ptr, STRLEN len)
=item sv_setpvf
diff --git a/proto.h b/proto.h
index 1a364301b1..d2898fe87e 100644
--- a/proto.h
+++ b/proto.h
@@ -147,7 +147,7 @@ VIRTUAL void fbm_compile _((SV* sv, U32 flags));
VIRTUAL char* fbm_instr _((unsigned char* big, unsigned char* bigend, SV* littlesv, U32 flags));
VIRTUAL char* find_script _((char *scriptname, bool dosearch, char **search_ext, I32 flags));
#ifdef USE_THREADS
-VIRTUAL PADOFFSET find_threadsv _((char *name));
+VIRTUAL PADOFFSET find_threadsv _((const char *name));
#endif
VIRTUAL OP* force_list _((OP* arg));
VIRTUAL OP* fold_constants _((OP* arg));
@@ -159,28 +159,28 @@ VIRTUAL GP* gp_ref _((GP* gp));
VIRTUAL GV* gv_AVadd _((GV* gv));
VIRTUAL GV* gv_HVadd _((GV* gv));
VIRTUAL GV* gv_IOadd _((GV* gv));
-VIRTUAL GV* gv_autoload4 _((HV* stash, char* name, STRLEN len, I32 method));
+VIRTUAL GV* gv_autoload4 _((HV* stash, const char* name, STRLEN len, I32 method));
VIRTUAL void gv_check _((HV* stash));
VIRTUAL void gv_efullname _((SV* sv, GV* gv));
-VIRTUAL void gv_efullname3 _((SV* sv, GV* gv, char* prefix));
-VIRTUAL GV* gv_fetchfile _((char* name));
-VIRTUAL GV* gv_fetchmeth _((HV* stash, char* name, STRLEN len, I32 level));
-VIRTUAL GV* gv_fetchmethod _((HV* stash, char* name));
-VIRTUAL GV* gv_fetchmethod_autoload _((HV* stash, char* name, I32 autoload));
-VIRTUAL GV* gv_fetchpv _((char* name, I32 add, I32 sv_type));
+VIRTUAL void gv_efullname3 _((SV* sv, GV* gv, const char* prefix));
+VIRTUAL GV* gv_fetchfile _((const char* name));
+VIRTUAL GV* gv_fetchmeth _((HV* stash, const char* name, STRLEN len, I32 level));
+VIRTUAL GV* gv_fetchmethod _((HV* stash, const char* name));
+VIRTUAL GV* gv_fetchmethod_autoload _((HV* stash, const char* name, I32 autoload));
+VIRTUAL GV* gv_fetchpv _((const char* name, I32 add, I32 sv_type));
VIRTUAL void gv_fullname _((SV* sv, GV* gv));
-VIRTUAL void gv_fullname3 _((SV* sv, GV* gv, char* prefix));
-VIRTUAL void gv_init _((GV* gv, HV* stash, char* name, STRLEN len, int multi));
-VIRTUAL HV* gv_stashpv _((char* name, I32 create));
-VIRTUAL HV* gv_stashpvn _((char* name, U32 namelen, I32 create));
+VIRTUAL void gv_fullname3 _((SV* sv, GV* gv, const char* prefix));
+VIRTUAL void gv_init _((GV* gv, HV* stash, const char* name, STRLEN len, int multi));
+VIRTUAL HV* gv_stashpv _((const char* name, I32 create));
+VIRTUAL HV* gv_stashpvn _((const char* name, U32 namelen, I32 create));
VIRTUAL HV* gv_stashsv _((SV* sv, I32 create));
VIRTUAL void hv_clear _((HV* tb));
VIRTUAL void hv_delayfree_ent _((HV* hv, HE* entry));
-VIRTUAL SV* hv_delete _((HV* tb, char* key, U32 klen, I32 flags));
+VIRTUAL SV* hv_delete _((HV* tb, const char* key, U32 klen, I32 flags));
VIRTUAL SV* hv_delete_ent _((HV* tb, SV* key, I32 flags, U32 hash));
-VIRTUAL bool hv_exists _((HV* tb, char* key, U32 klen));
+VIRTUAL bool hv_exists _((HV* tb, const char* key, U32 klen));
VIRTUAL bool hv_exists_ent _((HV* tb, SV* key, U32 hash));
-VIRTUAL SV** hv_fetch _((HV* tb, char* key, U32 klen, I32 lval));
+VIRTUAL SV** hv_fetch _((HV* tb, const char* key, U32 klen, I32 lval));
VIRTUAL HE* hv_fetch_ent _((HV* tb, SV* key, I32 lval, U32 hash));
VIRTUAL void hv_free_ent _((HV* hv, HE* entry));
VIRTUAL I32 hv_iterinit _((HV* tb));
@@ -191,15 +191,15 @@ VIRTUAL SV* hv_iternextsv _((HV* hv, char** key, I32* retlen));
VIRTUAL SV* hv_iterval _((HV* tb, HE* entry));
VIRTUAL void hv_ksplit _((HV* hv, IV newmax));
VIRTUAL void hv_magic _((HV* hv, GV* gv, int how));
-VIRTUAL SV** hv_store _((HV* tb, char* key, U32 klen, SV* val, U32 hash));
+VIRTUAL SV** hv_store _((HV* tb, const char* key, U32 klen, SV* val, U32 hash));
VIRTUAL HE* hv_store_ent _((HV* tb, SV* key, SV* val, U32 hash));
VIRTUAL void hv_undef _((HV* tb));
-VIRTUAL I32 ibcmp _((char* a, char* b, I32 len));
-VIRTUAL I32 ibcmp_locale _((char* a, char* b, I32 len));
+VIRTUAL I32 ibcmp _((const char* a, const char* b, I32 len));
+VIRTUAL I32 ibcmp_locale _((const char* a, const char* b, I32 len));
VIRTUAL I32 ingroup _((I32 testgid, I32 effective));
VIRTUAL void init_stacks _((ARGSproto));
VIRTUAL U32 intro_my _((void));
-VIRTUAL char* instr _((char* big, char* little));
+VIRTUAL char* instr _((const char* big, const char* little));
VIRTUAL bool io_close _((IO* io));
VIRTUAL OP* invert _((OP* cmd));
VIRTUAL bool is_uni_alnum _((U32 c));
@@ -304,7 +304,7 @@ VIRTUAL char* mem_collxfrm _((const char* s, STRLEN len, STRLEN* xlen));
#endif
VIRTUAL char* mess _((const char* pat, va_list* args));
VIRTUAL int mg_clear _((SV* sv));
-VIRTUAL int mg_copy _((SV* sv, SV* nsv, char* key, I32 klen));
+VIRTUAL int mg_copy _((SV* sv, SV* nsv, const char* key, I32 klen));
VIRTUAL MAGIC* mg_find _((SV* sv, int type));
VIRTUAL int mg_free _((SV* sv));
VIRTUAL int mg_get _((SV* sv));
@@ -316,7 +316,7 @@ VIRTUAL OP* mod _((OP* o, I32 type));
VIRTUAL char* moreswitches _((char* s));
VIRTUAL OP* my _((OP* o));
#if !defined(HAS_BCOPY) || !defined(HAS_SAFE_BCOPY)
-VIRTUAL char* my_bcopy _((char* from, char* to, I32 len));
+VIRTUAL char* my_bcopy _((const char* from, char* to, I32 len));
#endif
#if !defined(HAS_BZERO) && !defined(HAS_MEMSET)
char* my_bzero _((char* loc, I32 len));
@@ -325,7 +325,7 @@ VIRTUAL void my_exit _((U32 status)) __attribute__((noreturn));
VIRTUAL void my_failure_exit _((void)) __attribute__((noreturn));
VIRTUAL I32 my_lstat _((ARGSproto));
#if !defined(HAS_MEMCMP) || !defined(HAS_SANE_MEMCMP)
-VIRTUAL I32 my_memcmp _((char* s1, char* s2, I32 len));
+VIRTUAL I32 my_memcmp _((const char* s1, const char* s2, I32 len));
#endif
#if !defined(HAS_MEMSET)
VIRTUAL void* my_memset _((char* loc, I32 ch, I32 len));
@@ -382,10 +382,10 @@ VIRTUAL OP* newSVREF _((OP* o));
VIRTUAL OP* newSVOP _((I32 type, I32 flags, SV* sv));
VIRTUAL SV* newSViv _((IV i));
VIRTUAL SV* newSVnv _((double n));
-VIRTUAL SV* newSVpv _((char* s, STRLEN len));
-VIRTUAL SV* newSVpvn _((char *s, STRLEN len));
+VIRTUAL SV* newSVpv _((const char* s, STRLEN len));
+VIRTUAL SV* newSVpvn _((const char *s, STRLEN len));
VIRTUAL SV* newSVpvf _((const char* pat, ...));
-VIRTUAL SV* newSVrv _((SV* rv, char* classname));
+VIRTUAL SV* newSVrv _((SV* rv, const char* classname));
VIRTUAL SV* newSVsv _((SV* old));
VIRTUAL OP* newUNOP _((I32 type, I32 flags, OP* first));
VIRTUAL OP* newWHILEOP _((I32 flags, I32 debuggable, LOOP* loop,
@@ -395,7 +395,7 @@ VIRTUAL struct perl_thread * new_struct_thread _((struct perl_thread *t));
#endif
VIRTUAL PERL_SI * new_stackinfo _((I32 stitems, I32 cxitems));
VIRTUAL PerlIO* nextargv _((GV* gv));
-VIRTUAL char* ninstr _((char* big, char* bigend, char* little, char* lend));
+VIRTUAL char* ninstr _((const char* big, const char* bigend, const char* little, const char* lend));
VIRTUAL OP* oopsCV _((OP* o));
VIRTUAL void op_free _((OP* arg));
VIRTUAL void package _((OP* o));
@@ -418,9 +418,9 @@ VIRTUAL void perl_atexit _((void(*fn)(CPerlObj *, void *), void* ptr));
#else
void perl_atexit _((void(*fn)(void *), void*));
#endif
-VIRTUAL I32 perl_call_argv _((char* sub_name, I32 flags, char** argv));
-VIRTUAL I32 perl_call_method _((char* methname, I32 flags));
-VIRTUAL I32 perl_call_pv _((char* sub_name, I32 flags));
+VIRTUAL I32 perl_call_argv _((const char* sub_name, I32 flags, char** argv));
+VIRTUAL I32 perl_call_method _((const char* methname, I32 flags));
+VIRTUAL I32 perl_call_pv _((const char* sub_name, I32 flags));
VIRTUAL I32 perl_call_sv _((SV* sv, I32 flags));
#ifdef PERL_OBJECT
VIRTUAL void perl_construct _((void));
@@ -429,22 +429,22 @@ VIRTUAL void perl_destruct _((void));
void perl_construct _((PerlInterpreter* sv_interp));
void perl_destruct _((PerlInterpreter* sv_interp));
#endif
-VIRTUAL SV* perl_eval_pv _((char* p, I32 croak_on_error));
+VIRTUAL SV* perl_eval_pv _((const char* p, I32 croak_on_error));
VIRTUAL I32 perl_eval_sv _((SV* sv, I32 flags));
#ifdef PERL_OBJECT
VIRTUAL void perl_free _((void));
#else
void perl_free _((PerlInterpreter* sv_interp));
#endif
-VIRTUAL SV* perl_get_sv _((char* name, I32 create));
-VIRTUAL AV* perl_get_av _((char* name, I32 create));
-VIRTUAL HV* perl_get_hv _((char* name, I32 create));
-VIRTUAL CV* perl_get_cv _((char* name, I32 create));
+VIRTUAL SV* perl_get_sv _((const char* name, I32 create));
+VIRTUAL AV* perl_get_av _((const char* name, I32 create));
+VIRTUAL HV* perl_get_hv _((const char* name, I32 create));
+VIRTUAL CV* perl_get_cv _((const char* name, I32 create));
VIRTUAL int perl_init_i18nl10n _((int printwarn));
VIRTUAL int perl_init_i18nl14n _((int printwarn));
-VIRTUAL void perl_new_collate _((char* newcoll));
-VIRTUAL void perl_new_ctype _((char* newctype));
-VIRTUAL void perl_new_numeric _((char* newcoll));
+VIRTUAL void perl_new_collate _((const char* newcoll));
+VIRTUAL void perl_new_ctype _((const char* newctype));
+VIRTUAL void perl_new_numeric _((const char* newcoll));
VIRTUAL void perl_set_numeric_local _((void));
VIRTUAL void perl_set_numeric_standard _((void));
#ifdef PERL_OBJECT
@@ -452,7 +452,7 @@ VIRTUAL int perl_parse _((void(*xsinit)(CPerlObj*), int argc, char** argv, char*
#else
int perl_parse _((PerlInterpreter* sv_interp, void(*xsinit)(void), int argc, char** argv, char** env));
#endif
-VIRTUAL void perl_require_pv _((char* pv));
+VIRTUAL void perl_require_pv _((const char* pv));
#define perl_requirepv perl_require_pv
#ifdef PERL_OBJECT
VIRTUAL int perl_run _((void));
@@ -479,8 +479,8 @@ VIRTUAL I32 regexec_flags _((regexp* prog, char* stringarg, char* strend,
void* data, U32 flags));
VIRTUAL regnode* regnext _((regnode* p));
VIRTUAL void regprop _((SV* sv, regnode* o));
-VIRTUAL void repeatcpy _((char* to, char* from, I32 len, I32 count));
-VIRTUAL char* rninstr _((char* big, char* bigend, char* little, char* lend));
+VIRTUAL void repeatcpy _((char* to, const char* from, I32 len, I32 count));
+VIRTUAL char* rninstr _((const char* big, const char* bigend, const char* little, const char* lend));
VIRTUAL Sighandler_t rsignal _((int i, Sighandler_t t));
VIRTUAL int rsignal_restore _((int i, Sigsave_t* t));
VIRTUAL int rsignal_save _((int i, Sighandler_t t1, Sigsave_t* t2));
@@ -491,8 +491,8 @@ VIRTUAL void rxres_save _((void** rsp, REGEXP* prx));
#ifndef HAS_RENAME
VIRTUAL I32 same_dirent _((char* a, char* b));
#endif
-VIRTUAL char* savepv _((char* sv));
-VIRTUAL char* savepvn _((char* sv, I32 len));
+VIRTUAL char* savepv _((const char* sv));
+VIRTUAL char* savepvn _((const char* sv, I32 len));
VIRTUAL void savestack_grow _((void));
VIRTUAL void save_aelem _((AV* av, I32 idx, SV **sptr));
VIRTUAL I32 save_alloc _((I32 size, I32 pad));
@@ -547,8 +547,8 @@ VIRTUAL char* screaminstr _((SV* bigsv, SV* littlesv, I32 start_shift, I32 end_s
VIRTUAL I32 setenv_getix _((char* nam));
#endif
VIRTUAL void setdefout _((GV* gv));
-VIRTUAL char* sharepvn _((char* sv, I32 len, U32 hash));
-VIRTUAL HEK* share_hek _((char* sv, I32 len, U32 hash));
+VIRTUAL char* sharepvn _((const char* sv, I32 len, U32 hash));
+VIRTUAL HEK* share_hek _((const char* sv, I32 len, U32 hash));
VIRTUAL Signal_t sighandler _((int sig));
VIRTUAL SV** stack_grow _((SV** sp, SV**p, int n));
VIRTUAL I32 start_subparse _((I32 is_format, U32 flags));
@@ -570,8 +570,8 @@ VIRTUAL void sv_add_arena _((char* ptr, U32 size, U32 flags));
VIRTUAL int sv_backoff _((SV* sv));
VIRTUAL SV* sv_bless _((SV* sv, HV* stash));
VIRTUAL void sv_catpvf _((SV* sv, const char* pat, ...));
-VIRTUAL void sv_catpv _((SV* sv, char* ptr));
-VIRTUAL void sv_catpvn _((SV* sv, char* ptr, STRLEN len));
+VIRTUAL void sv_catpv _((SV* sv, const char* ptr));
+VIRTUAL void sv_catpvn _((SV* sv, const char* ptr, STRLEN len));
VIRTUAL void sv_catsv _((SV* dsv, SV* ssv));
VIRTUAL void sv_chop _((SV* sv, char* ptr));
VIRTUAL void sv_clean_all _((void));
@@ -585,7 +585,7 @@ VIRTUAL char* sv_collxfrm _((SV* sv, STRLEN* nxp));
VIRTUAL OP* sv_compile_2op _((SV* sv, OP** startp, char* code, AV** avp));
VIRTUAL void sv_dec _((SV* sv));
VIRTUAL void sv_dump _((SV* sv));
-VIRTUAL bool sv_derived_from _((SV* sv, char* name));
+VIRTUAL bool sv_derived_from _((SV* sv, const char* name));
VIRTUAL I32 sv_eq _((SV* sv1, SV* sv2));
VIRTUAL void sv_free _((SV* sv));
VIRTUAL void sv_free_arenas _((void));
@@ -593,11 +593,11 @@ VIRTUAL char* sv_gets _((SV* sv, PerlIO* fp, I32 append));
VIRTUAL char* sv_grow _((SV* sv, STRLEN newlen));
VIRTUAL void sv_inc _((SV* sv));
VIRTUAL void sv_insert _((SV* bigsv, STRLEN offset, STRLEN len, char* little, STRLEN littlelen));
-VIRTUAL int sv_isa _((SV* sv, char* name));
+VIRTUAL int sv_isa _((SV* sv, const char* name));
VIRTUAL int sv_isobject _((SV* sv));
VIRTUAL STRLEN sv_len _((SV* sv));
VIRTUAL STRLEN sv_len_utf8 _((SV* sv));
-VIRTUAL void sv_magic _((SV* sv, SV* obj, int how, char* name, I32 namlen));
+VIRTUAL void sv_magic _((SV* sv, SV* obj, int how, const char* name, I32 namlen));
VIRTUAL SV* sv_mortalcopy _((SV* oldsv));
VIRTUAL SV* sv_newmortal _((void));
VIRTUAL SV* sv_newref _((SV* sv));
@@ -614,10 +614,10 @@ VIRTUAL void sv_setiv _((SV* sv, IV num));
VIRTUAL void sv_setpviv _((SV* sv, IV num));
VIRTUAL void sv_setuv _((SV* sv, UV num));
VIRTUAL void sv_setnv _((SV* sv, double num));
-VIRTUAL SV* sv_setref_iv _((SV* rv, char* classname, IV iv));
-VIRTUAL SV* sv_setref_nv _((SV* rv, char* classname, double nv));
-VIRTUAL SV* sv_setref_pv _((SV* rv, char* classname, void* pv));
-VIRTUAL SV* sv_setref_pvn _((SV* rv, char* classname, char* pv, I32 n));
+VIRTUAL SV* sv_setref_iv _((SV* rv, const char* classname, IV iv));
+VIRTUAL SV* sv_setref_nv _((SV* rv, const char* classname, double nv));
+VIRTUAL SV* sv_setref_pv _((SV* rv, const char* classname, void* pv));
+VIRTUAL SV* sv_setref_pvn _((SV* rv, const char* classname, char* pv, I32 n));
VIRTUAL void sv_setpv _((SV* sv, const char* ptr));
VIRTUAL void sv_setpvn _((SV* sv, const char* ptr, STRLEN len));
VIRTUAL void sv_setsv _((SV* dsv, SV* ssv));
@@ -647,7 +647,7 @@ VIRTUAL I32 unlnk _((char* f));
#ifdef USE_THREADS
VIRTUAL void unlock_condpair _((void* svv));
#endif
-VIRTUAL void unsharepvn _((char* sv, I32 len, U32 hash));
+VIRTUAL void unsharepvn _((const char* sv, I32 len, U32 hash));
VIRTUAL void unshare_hek _((HEK* hek));
VIRTUAL void utilize _((int aver, I32 floor, OP* version, OP* id, OP* arg));
VIRTUAL U8* utf16_to_utf8 _((U16* p, U8 *d, I32 bytelen));
@@ -696,7 +696,7 @@ void hfreeentries _((HV *hv));
void more_he _((void));
HE* new_he _((void));
void del_he _((HE *p));
-HEK *save_hek _((char *str, I32 len, U32 hash));
+HEK *save_hek _((const char *str, I32 len, U32 hash));
SV *mess_alloc _((void));
void gv_init_sv _((GV *gv, I32 sv_type));
SV *save_scalar_at _((SV **sptr));
@@ -804,7 +804,7 @@ void depcom _((void));
I32 win32_textfilter _((int idx, SV *sv, int maxlen));
#endif
char* incl_perldb _((void));
-SV *isa_lookup _((HV *stash, char *name, int len, int level));
+SV *isa_lookup _((HV *stash, const char *name, int len, int level));
CV *get_db_sub _((SV **svp, CV *cv));
I32 list_assignment _((OP *o));
void bad_type _((I32 n, char *t, char *name, OP *kid));
@@ -934,8 +934,8 @@ VIRTUAL void byterun _((PerlIO *fp));
#endif /* INDIRECT_BGET_MACROS */
VIRTUAL void sv_catpvf_mg _((SV *sv, const char* pat, ...));
-VIRTUAL void sv_catpv_mg _((SV *sv, char *ptr));
-VIRTUAL void sv_catpvn_mg _((SV *sv, char *ptr, STRLEN len));
+VIRTUAL void sv_catpv_mg _((SV *sv, const char *ptr));
+VIRTUAL void sv_catpvn_mg _((SV *sv, const char *ptr, STRLEN len));
VIRTUAL void sv_catsv_mg _((SV *dstr, SV *sstr));
VIRTUAL void sv_setpvf_mg _((SV *sv, const char* pat, ...));
VIRTUAL void sv_setiv_mg _((SV *sv, IV i));
diff --git a/sv.c b/sv.c
index eede077ede..acc8ae5913 100644
--- a/sv.c
+++ b/sv.c
@@ -2304,7 +2304,7 @@ sv_chop(register SV *sv, register char *ptr) /* like set but assuming ptr is in
}
void
-sv_catpvn(register SV *sv, register char *ptr, register STRLEN len)
+sv_catpvn(register SV *sv, register const char *ptr, register STRLEN len)
{
STRLEN tlen;
char *junk;
@@ -2321,7 +2321,7 @@ sv_catpvn(register SV *sv, register char *ptr, register STRLEN len)
}
void
-sv_catpvn_mg(register SV *sv, register char *ptr, register STRLEN len)
+sv_catpvn_mg(register SV *sv, register const char *ptr, register STRLEN len)
{
sv_catpvn(sv,ptr,len);
SvSETMAGIC(sv);
@@ -2346,7 +2346,7 @@ sv_catsv_mg(SV *dstr, register SV *sstr)
}
void
-sv_catpv(register SV *sv, register char *ptr)
+sv_catpv(register SV *sv, register const char *ptr)
{
register STRLEN len;
STRLEN tlen;
@@ -2366,7 +2366,7 @@ sv_catpv(register SV *sv, register char *ptr)
}
void
-sv_catpv_mg(register SV *sv, register char *ptr)
+sv_catpv_mg(register SV *sv, register const char *ptr)
{
sv_catpv(sv,ptr);
SvSETMAGIC(sv);
@@ -2391,7 +2391,7 @@ newSV(STRLEN len)
/* name is assumed to contain an SV* if (name && namelen == HEf_SVKEY) */
void
-sv_magic(register SV *sv, SV *obj, int how, char *name, I32 namlen)
+sv_magic(register SV *sv, SV *obj, int how, const char *name, I32 namlen)
{
MAGIC* mg;
@@ -3634,7 +3634,7 @@ sv_2mortal(register SV *sv)
}
SV *
-newSVpv(char *s, STRLEN len)
+newSVpv(const char *s, STRLEN len)
{
register SV *sv;
@@ -3649,7 +3649,7 @@ newSVpv(char *s, STRLEN len)
}
SV *
-newSVpvn(char *s, STRLEN len)
+newSVpvn(const char *s, STRLEN len)
{
register SV *sv;
@@ -4100,7 +4100,7 @@ sv_isobject(SV *sv)
}
int
-sv_isa(SV *sv, char *name)
+sv_isa(SV *sv, const char *name)
{
if (!sv)
return 0;
@@ -4116,7 +4116,7 @@ sv_isa(SV *sv, char *name)
}
SV*
-newSVrv(SV *rv, char *classname)
+newSVrv(SV *rv, const char *classname)
{
dTHR;
SV *sv;
@@ -4144,7 +4144,7 @@ newSVrv(SV *rv, char *classname)
}
SV*
-sv_setref_pv(SV *rv, char *classname, void *pv)
+sv_setref_pv(SV *rv, const char *classname, void *pv)
{
if (!pv) {
sv_setsv(rv, &PL_sv_undef);
@@ -4156,21 +4156,21 @@ sv_setref_pv(SV *rv, char *classname, void *pv)
}
SV*
-sv_setref_iv(SV *rv, char *classname, IV iv)
+sv_setref_iv(SV *rv, const char *classname, IV iv)
{
sv_setiv(newSVrv(rv,classname), iv);
return rv;
}
SV*
-sv_setref_nv(SV *rv, char *classname, double nv)
+sv_setref_nv(SV *rv, const char *classname, double nv)
{
sv_setnv(newSVrv(rv,classname), nv);
return rv;
}
SV*
-sv_setref_pvn(SV *rv, char *classname, char *pv, I32 n)
+sv_setref_pvn(SV *rv, const char *classname, char *pv, I32 n)
{
sv_setpvn(newSVrv(rv,classname), pv, n);
return rv;
diff --git a/universal.c b/universal.c
index 4f76d92255..7d8ced3b0f 100644
--- a/universal.c
+++ b/universal.c
@@ -7,7 +7,7 @@
*/
STATIC SV *
-isa_lookup(HV *stash, char *name, int len, int level)
+isa_lookup(HV *stash, const char *name, int len, int level)
{
AV* av;
GV* gv;
@@ -73,7 +73,7 @@ isa_lookup(HV *stash, char *name, int len, int level)
}
bool
-sv_derived_from(SV *sv, char *name)
+sv_derived_from(SV *sv, const char *name)
{
SV *rv;
char *type;
diff --git a/util.c b/util.c
index db727f76f5..0890027b11 100644
--- a/util.c
+++ b/util.c
@@ -385,16 +385,16 @@ delimcpy(register char *to, register char *toend, register char *from, register
/* This routine was donated by Corey Satten. */
char *
-instr(register char *big, register char *little)
+instr(register const char *big, register const char *little)
{
- register char *s, *x;
+ register const char *s, *x;
register I32 first;
if (!little)
- return big;
+ return (char*)big;
first = *little++;
if (!first)
- return big;
+ return (char*)big;
while (*big) {
if (*big++ != first)
continue;
@@ -407,7 +407,7 @@ instr(register char *big, register char *little)
}
}
if (!*s)
- return big-1;
+ return (char*)(big-1);
}
return Nullch;
}
@@ -415,14 +415,14 @@ instr(register char *big, register char *little)
/* same as instr but allow embedded nulls */
char *
-ninstr(register char *big, register char *bigend, char *little, char *lend)
+ninstr(register const char *big, register const char *bigend, const char *little, const char *lend)
{
- register char *s, *x;
+ register const char *s, *x;
register I32 first = *little;
- register char *littleend = lend;
+ register const char *littleend = lend;
if (!first && little >= littleend)
- return big;
+ return (char*)big;
if (bigend - big < littleend - little)
return Nullch;
bigend -= littleend - little++;
@@ -436,7 +436,7 @@ ninstr(register char *big, register char *bigend, char *little, char *lend)
}
}
if (s >= littleend)
- return big-1;
+ return (char*)(big-1);
}
return Nullch;
}
@@ -444,15 +444,15 @@ ninstr(register char *big, register char *bigend, char *little, char *lend)
/* reverse of the above--find last substring */
char *
-rninstr(register char *big, char *bigend, char *little, char *lend)
+rninstr(register const char *big, const char *bigend, const char *little, const char *lend)
{
- register char *bigbeg;
- register char *s, *x;
+ register const char *bigbeg;
+ register const char *s, *x;
register I32 first = *little;
- register char *littleend = lend;
+ register const char *littleend = lend;
if (!first && little >= littleend)
- return bigend;
+ return (char*)bigend;
bigbeg = big;
big = bigend - (littleend - little++);
while (big >= bigbeg) {
@@ -465,7 +465,7 @@ rninstr(register char *big, char *bigend, char *little, char *lend)
}
}
if (s >= littleend)
- return big+1;
+ return (char*)(big+1);
}
return Nullch;
}
@@ -474,7 +474,7 @@ rninstr(register char *big, char *bigend, char *little, char *lend)
* Set up for a new ctype locale.
*/
void
-perl_new_ctype(char *newctype)
+perl_new_ctype(const char *newctype)
{
#ifdef USE_LOCALE_CTYPE
@@ -496,7 +496,7 @@ perl_new_ctype(char *newctype)
* Set up for a new collation locale.
*/
void
-perl_new_collate(char *newcoll)
+perl_new_collate(const char *newcoll)
{
#ifdef USE_LOCALE_COLLATE
@@ -540,7 +540,7 @@ perl_new_collate(char *newcoll)
* Set up for a new numeric locale.
*/
void
-perl_new_numeric(char *newnum)
+perl_new_numeric(const char *newnum)
{
#ifdef USE_LOCALE_NUMERIC
@@ -1127,7 +1127,7 @@ screaminstr(SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift, I32 *old_
}
I32
-ibcmp(char *s1, char *s2, register I32 len)
+ibcmp(const char *s1, const char *s2, register I32 len)
{
register U8 *a = (U8 *)s1;
register U8 *b = (U8 *)s2;
@@ -1140,7 +1140,7 @@ ibcmp(char *s1, char *s2, register I32 len)
}
I32
-ibcmp_locale(char *s1, char *s2, register I32 len)
+ibcmp_locale(const char *s1, const char *s2, register I32 len)
{
register U8 *a = (U8 *)s1;
register U8 *b = (U8 *)s2;
@@ -1155,7 +1155,7 @@ ibcmp_locale(char *s1, char *s2, register I32 len)
/* copy a string to a safe spot */
char *
-savepv(char *sv)
+savepv(const char *sv)
{
register char *newaddr;
@@ -1167,7 +1167,7 @@ savepv(char *sv)
/* same thing but with a known length */
char *
-savepvn(char *sv, register I32 len)
+savepvn(const char *sv, register I32 len)
{
register char *newaddr;
@@ -1657,7 +1657,7 @@ char *f;
#if !defined(HAS_BCOPY) || !defined(HAS_SAFE_BCOPY)
char *
-my_bcopy(register char *from,register char *to,register I32 len)
+my_bcopy(register const char *from,register char *to,register I32 len)
{
char *retval = to;
@@ -1677,10 +1677,7 @@ my_bcopy(register char *from,register char *to,register I32 len)
#ifndef HAS_MEMSET
void *
-my_memset(loc,ch,len)
-register char *loc;
-register I32 ch;
-register I32 len;
+my_memset(register char *loc, register I32 ch, register I32 len)
{
char *retval = loc;
@@ -1692,9 +1689,7 @@ register I32 len;
#if !defined(HAS_BZERO) && !defined(HAS_MEMSET)
char *
-my_bzero(loc,len)
-register char *loc;
-register I32 len;
+my_bzero(register char *loc, register I32 len)
{
char *retval = loc;
@@ -1706,10 +1701,7 @@ register I32 len;
#if !defined(HAS_MEMCMP) || !defined(HAS_SANE_MEMCMP)
I32
-my_memcmp(s1,s2,len)
-char *s1;
-char *s2;
-register I32 len;
+my_memcmp(const char *s1, const char *s2, register I32 len)
{
register U8 *a = (U8 *)s1;
register U8 *b = (U8 *)s2;
@@ -1730,10 +1722,7 @@ char *
#else
int
#endif
-vsprintf(dest, pat, args)
-char *dest;
-const char *pat;
-char *args;
+vsprintf(char *dest, const char *pat, char *args)
{
FILE fakebuf;
@@ -2293,13 +2282,13 @@ PerlIO *ptr;
#endif
void
-repeatcpy(register char *to, register char *from, I32 len, register I32 count)
+repeatcpy(register char *to, register const char *from, I32 len, register I32 count)
{
register I32 todo;
- register char *frombase = from;
+ register const char *frombase = from;
if (len == 1) {
- register char c = *from;
+ register const char c = *from;
while (count-- > 0)
*to++ = c;
return;