*
*/
-/* typedefs to eliminate some typing */
-typedef struct he HE;
-typedef struct hek HEK;
-
/* entry in hash value chain */
struct he {
/* Keep hent_next first in this structure, because sv_free_arenas take
/* The use of a temporary pointer and the casting games
* is needed to serve the dual purposes of
* (a) the hashed data being interpreted as "unsigned char" (new since 5.8,
- * a "char" can be either signed or signed, depending on the compiler)
+ * a "char" can be either signed or unsigned, depending on the compiler)
* (b) catering for old code that uses a "char"
*
* The "hash seed" feature was added in Perl 5.8.1 to perturb the results
#endif
#define PERL_HASH(hash,str,len) \
STMT_START { \
- register const char *s_PeRlHaSh_tmp = str; \
+ register const char * const s_PeRlHaSh_tmp = str; \
register const unsigned char *s_PeRlHaSh = (const unsigned char *)s_PeRlHaSh_tmp; \
register I32 i_PeRlHaSh = len; \
register U32 hash_PeRlHaSh = PERL_HASH_SEED; \
#ifdef PERL_HASH_INTERNAL_ACCESS
#define PERL_HASH_INTERNAL(hash,str,len) \
STMT_START { \
- register const char *s_PeRlHaSh_tmp = str; \
+ register const char * const s_PeRlHaSh_tmp = str; \
register const unsigned char *s_PeRlHaSh = (const unsigned char *)s_PeRlHaSh_tmp; \
register I32 i_PeRlHaSh = len; \
register U32 hash_PeRlHaSh = PL_rehash_seed; \
=head1 Hash Manipulation Functions
=for apidoc Am|char*|HvNAME|HV* stash
-Returns the package name of a stash. See C<SvSTASH>, C<CvSTASH>.
+Returns the package name of a stash, or NULL if C<stash> isn't a stash.
+See C<SvSTASH>, C<CvSTASH>.
=for apidoc Am|void*|HeKEY|HE* he
Returns the actual pointer stored in the key slot of the hash entry. The
#define Nullhv Null(HV*)
-#define HvARRAY(hv) (*(HE***)&((hv)->sv_u.svu_array))
+#define HvARRAY(hv) ((hv)->sv_u.svu_hash)
#define HvFILL(hv) ((XPVHV*) SvANY(hv))->xhv_fill
#define HvMAX(hv) ((XPVHV*) SvANY(hv))->xhv_max
/* This quite intentionally does no flag checking first. That's your
/* Flags for hv_iternext_flags. */
#define HV_ITERNEXT_WANTPLACEHOLDERS 0x01 /* Don't skip placeholders. */
+#define hv_iternext(hv) hv_iternext_flags(hv, 0)
+#define hv_magic(hv, gv, how) sv_magic((SV*)(hv), (SV*)(gv), how, Nullch, 0)
+
/* available as a function in hv.c */
#define Perl_sharepvn(sv, len, hash) HEK_KEY(share_hek(sv, len, hash))
#define sharepvn(sv, len, hash) Perl_sharepvn(sv, len, hash)