/* hv.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, 2004, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005, 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.
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;
#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
}
/*
-=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>
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,
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;
if (--items == 0) {
/* Finished. */
- HvTOTALKEYS(hv) -= HvPLACEHOLDERS(hv);
+ HvTOTALKEYS(hv) -= (IV)HvPLACEHOLDERS(hv);
if (HvKEYS(hv) == 0)
HvHASKFLAGS_off(hv);
HvPLACEHOLDERS(hv) = 0;
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;
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:
HvRITER(hv) = riter; /* Restore hash iterator state */
HvEITER(hv) = eiter;
}
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vim: shiftwidth=4:
+*/