X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hv.h;h=08f3bed7d5b63c79e076a74b77b84840b068e024;hb=e1901655935137420b3a46ad23c873753fcbbbc7;hp=f0522580bbed365b1c0db1d8a1387e1051be4708;hpb=954c1994944eafa74aaac1bab94e820b6e447da9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hv.h b/hv.h index f052258..08f3bed 100644 --- a/hv.h +++ b/hv.h @@ -1,27 +1,31 @@ /* hv.h * - * Copyright (c) 1991-1999, Larry Wall + * Copyright (c) 1991-2000, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ +/* typedefs to eliminate some typing */ typedef struct he HE; typedef struct hek HEK; +/* entry in hash value chain */ struct he { - HE *hent_next; - HEK *hent_hek; - SV *hent_val; + HE *hent_next; /* next entry in chain */ + HEK *hent_hek; /* hash key */ + SV *hent_val; /* scalar value that was hashed */ }; +/* hash key -- defined separately for use as shared pointer */ struct hek { - U32 hek_hash; - I32 hek_len; - char hek_key[1]; + U32 hek_hash; /* hash of key */ + I32 hek_len; /* length of hash key */ + char hek_key[1]; /* variable-length hash key */ }; +/* hash structure: */ /* This structure must match the beginning of struct xpvmg in sv.h. */ struct xpvhv { char * xhv_array; /* pointer to malloced string */ @@ -38,6 +42,7 @@ struct xpvhv { char *xhv_name; /* name, if a symbol table */ }; +/* hash a key */ #define PERL_HASH(hash,str,len) \ STMT_START { \ register const char *s_PeRlHaSh = str; \ @@ -171,6 +176,7 @@ C. #define HEK_LEN(hek) (hek)->hek_len #define HEK_KEY(hek) (hek)->hek_key +/* calculate HV array allocation */ #if defined(STRANGE_MALLOC) || defined(MYMALLOC) # define PERL_HV_ARRAY_ALLOC_BYTES(size) ((size) * sizeof(HE*)) #else