Consting in S_find_uninit_var() and the routines that it calls.
authorNicholas Clark <nick@ccl4.org>
Tue, 28 Oct 2008 21:12:09 +0000 (21:12 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 28 Oct 2008 21:12:09 +0000 (21:12 +0000)
p4raw-id: //depot/perl@34627

embed.fnc
proto.h
sv.c

index 89630f6..9dde029 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1567,8 +1567,9 @@ s |void   |sv_unglob      |NN SV *const sv
 s      |void   |not_a_number   |NN SV *const sv
 s      |I32    |visit          |NN SVFUNC_t f|const U32 flags|const U32 mask
 s      |void   |sv_del_backref |NN SV *const tsv|NN SV *const sv
-sR     |SV *   |varname        |NULLOK GV *gv|const char gvtype|PADOFFSET targ \
-                               |NULLOK SV *keyname|I32 aindex|int subscript_type
+sR     |SV *   |varname        |NULLOK const GV *const gv|const char gvtype \
+                               |PADOFFSET targ|NULLOK const SV *const keyname \
+                               |I32 aindex|int subscript_type
 #  ifdef DEBUGGING
 s      |void   |del_sv |NN SV *p
 #  endif
@@ -1803,9 +1804,12 @@ Apo      |void   |hv_placeholders_set    |NN HV *hv|I32 ph
 p      |SV*    |magic_scalarpack|NN HV *hv|NN MAGIC *mg
 
 #if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
-s      |SV *   |find_hash_subscript|NULLOK HV *hv|NN SV *val
-s      |I32    |find_array_subscript|NULLOK AV *av|NN SV *val
-sMd    |SV*    |find_uninit_var|NULLOK OP* obase|NULLOK SV* uninit_sv|bool top
+s      |SV *   |find_hash_subscript|NULLOK const HV *const hv \
+               |NN const SV *const val
+s      |I32    |find_array_subscript|NULLOK const AV *const av \
+               |NN const SV *const val
+sMd    |SV*    |find_uninit_var|NULLOK const OP *const obase \
+               |NULLOK const SV *const uninit_sv|bool top
 #endif
 
 #ifdef PERL_NEED_MY_HTOLE16
diff --git a/proto.h b/proto.h
index 5f2600d..750ab28 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5552,7 +5552,7 @@ STATIC void       S_sv_del_backref(pTHX_ SV *const tsv, SV *const sv)
 #define PERL_ARGS_ASSERT_SV_DEL_BACKREF        \
        assert(tsv); assert(sv)
 
-STATIC SV *    S_varname(pTHX_ GV *gv, const char gvtype, PADOFFSET targ, SV *keyname, I32 aindex, int subscript_type)
+STATIC SV *    S_varname(pTHX_ const GV *const gv, const char gvtype, PADOFFSET targ, const SV *const keyname, I32 aindex, int subscript_type)
                        __attribute__warn_unused_result__;
 
 #  ifdef DEBUGGING
@@ -6209,17 +6209,17 @@ PERL_CALLCONV SV*       Perl_magic_scalarpack(pTHX_ HV *hv, MAGIC *mg)
 
 
 #if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
-STATIC SV *    S_find_hash_subscript(pTHX_ HV *hv, SV *val)
+STATIC SV *    S_find_hash_subscript(pTHX_ const HV *const hv, const SV *const val)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_FIND_HASH_SUBSCRIPT   \
        assert(val)
 
-STATIC I32     S_find_array_subscript(pTHX_ AV *av, SV *val)
+STATIC I32     S_find_array_subscript(pTHX_ const AV *const av, const SV *const val)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_FIND_ARRAY_SUBSCRIPT  \
        assert(val)
 
-STATIC SV*     S_find_uninit_var(pTHX_ OP* obase, SV* uninit_sv, bool top);
+STATIC SV*     S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, bool top);
 #endif
 
 #ifdef PERL_NEED_MY_HTOLE16
diff --git a/sv.c b/sv.c
index 1eb6552..d61ff9f 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12289,7 +12289,7 @@ Perl_sv_cat_decode(pTHX_ SV *dsv, SV *encoding,
  * If so, return a mortal copy of the key. */
 
 STATIC SV*
-S_find_hash_subscript(pTHX_ HV *hv, SV* val)
+S_find_hash_subscript(pTHX_ const HV *const hv, const SV *const val)
 {
     dVAR;
     register HE **array;
@@ -12325,7 +12325,7 @@ S_find_hash_subscript(pTHX_ HV *hv, SV* val)
  * If so, return the index, otherwise return -1. */
 
 STATIC I32
-S_find_array_subscript(pTHX_ AV *av, SV* val)
+S_find_array_subscript(pTHX_ const AV *const av, const SV *const val)
 {
     dVAR;
 
@@ -12358,8 +12358,8 @@ S_find_array_subscript(pTHX_ AV *av, SV* val)
 #define FUV_SUBSCRIPT_WITHIN   4       /* "within @foo"   */
 
 STATIC SV*
-S_varname(pTHX_ GV *gv, const char gvtype, PADOFFSET targ,
-       SV* keyname, I32 aindex, int subscript_type)
+S_varname(pTHX_ const GV *const gv, const char gvtype, PADOFFSET targ,
+       const SV *const keyname, I32 aindex, int subscript_type)
 {
 
     SV * const name = sv_newmortal();
@@ -12434,13 +12434,13 @@ PL_comppad/PL_curpad points to the currently executing pad.
 */
 
 STATIC SV *
-S_find_uninit_var(pTHX_ OP* obase, SV* uninit_sv, bool match)
+S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv,
+                 bool match)
 {
     dVAR;
     SV *sv;
-    AV *av;
-    GV *gv;
-    OP *o, *o2, *kid;
+    const GV *gv;
+    const OP *o, *o2, *kid;
 
     if (!obase || (match && (!uninit_sv || uninit_sv == &PL_sv_undef ||
                            uninit_sv == &PL_sv_placeholder)))
@@ -12511,7 +12511,7 @@ S_find_uninit_var(pTHX_ OP* obase, SV* uninit_sv, bool match)
        if (obase->op_flags & OPf_SPECIAL) { /* lexical array */
            if (match) {
                SV **svp;
-               av = (AV*)PAD_SV(obase->op_targ);
+               AV *av = (AV*)PAD_SV(obase->op_targ);
                if (!av || SvRMAGICAL(av))
                    break;
                svp = av_fetch(av, (I32)obase->op_private, FALSE);
@@ -12527,7 +12527,7 @@ S_find_uninit_var(pTHX_ OP* obase, SV* uninit_sv, bool match)
                break;
            if (match) {
                SV **svp;
-               av = GvAV(gv);
+               AV *const av = GvAV(gv);
                if (!av || SvRMAGICAL(av))
                    break;
                svp = av_fetch(av, (I32)obase->op_private, FALSE);