Down with C++ reserved names
[p5sagit/p5-mst-13.2.git] / hv.c
diff --git a/hv.c b/hv.c
index 8270c97..8c6ec39 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -90,7 +90,7 @@ S_more_he(pTHX)
 STATIC HEK *
 S_save_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags)
 {
-    int flags_masked = flags & HVhek_MASK;
+    const int flags_masked = flags & HVhek_MASK;
     char *k;
     register HEK *hek;
 
@@ -186,7 +186,6 @@ S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen,
 #define HV_FETCH_ISEXISTS  0x02
 #define HV_FETCH_LVALUE    0x04
 #define HV_FETCH_JUST_SV   0x08
-#define HV_FETCH_PLACEHOLDER   0x10
 
 /*
 =for apidoc hv_store
@@ -338,46 +337,6 @@ Perl_hv_fetch(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 lval)
 }
 
 /*
-=for apidoc hv_fetch_flags
-
-Returns the SV which corresponds to the specified key in the hash.
-See C<hv_fetch>.
-The C<flags> value will normally be zero; if HV_FETCH_WANTPLACEHOLDERS is
-set then placeholders keys (for restricted hashes) will be returned in addition
-to normal keys. By default placeholders are automatically skipped over.
-Currently a placeholder is implemented with a value that is
-C<&Perl_sv_placeholder>. Note that the implementation of placeholders and
-restricted hashes may change.
-
-=cut
-*/
-
-SV**
-Perl_hv_fetch_flags(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 lval, 
-                   I32 flags)
-{
-    HE *hek;
-    STRLEN klen;
-    int common_flags;
-
-    if (klen_i32 < 0) {
-       klen = -klen_i32;
-       common_flags = HVhek_UTF8;
-    } else {
-       klen = klen_i32;
-       common_flags = 0;
-    }
-    hek = hv_fetch_common (hv, NULL, key, klen, common_flags,
-                          ((flags & HV_FETCH_WANTPLACEHOLDERS) 
-                               ? HV_FETCH_PLACEHOLDER 
-                               : 0)
-                           | HV_FETCH_JUST_SV 
-                           | (lval ? HV_FETCH_LVALUE : 0),
-                          Nullsv, 0);
-    return hek ? &HeVAL(hek) : NULL;
-}
-
-/*
 =for apidoc hv_exists_ent
 
 Returns a boolean indicating whether the specified hash key exists. C<hash>
@@ -496,7 +455,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
                    if (isLOWER(key[i])) {
                        /* Would be nice if we had a routine to do the
                           copy and upercase in a single pass through.  */
-                       char *nkey = strupr(savepvn(key,klen));
+                       const char *nkey = strupr(savepvn(key,klen));
                        /* Note that this fetch is for nkey (the uppercased
                           key) whereas the store is for key (the original)  */
                        entry = hv_fetch_common(hv, Nullsv, nkey, klen,
@@ -734,9 +693,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
                SvREFCNT_dec(HeVAL(entry));
                HeVAL(entry) = val;
            }
-       } else if (HeVAL(entry) == &PL_sv_placeholder 
-                   && !(action & HV_FETCH_PLACEHOLDER)) 
-       {
+       } else if (HeVAL(entry) == &PL_sv_placeholder) {
            /* if we find a placeholder, we pretend we haven't found
               anything */
            break;
@@ -1576,7 +1533,7 @@ Perl_hv_clear_placeholders(pTHX_ HV *hv)
 
                if (--items == 0) {
                    /* Finished.  */
-                   HvTOTALKEYS(hv) -= HvPLACEHOLDERS(hv);
+                   HvTOTALKEYS(hv) -= (IV)HvPLACEHOLDERS(hv);
                    if (HvKEYS(hv) == 0)
                        HvHASKFLAGS_off(hv);
                    HvPLACEHOLDERS(hv) = 0;
@@ -2042,7 +1999,7 @@ S_unshare_hek_or_pvn(pTHX_ HEK *hek, const char *str, I32 len, U32 hash)
             break;
         }
     } else {
-        int flags_masked = k_flags & HVhek_MASK;
+        const int flags_masked = k_flags & HVhek_MASK;
         for (entry = *oentry; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) {
             if (HeHASH(entry) != hash)         /* strings can't be equal */
                 continue;
@@ -2118,7 +2075,7 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
     register HE **oentry;
     register I32 i = 1;
     I32 found = 0;
-    int flags_masked = flags & HVhek_MASK;
+    const int flags_masked = flags & HVhek_MASK;
 
     /* what follows is the moral equivalent of: