X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hv.h;h=369bf3c549836118830ac09f458ed55c7ae8ab3d;hb=917211f59b1d5210f3944956e717bae1a2ca7565;hp=f99bc7d1e83804ac2a79d49923b111e70c35e15e;hpb=8aacddc1ea3837f8f1a911d90c644451fc7cfc86;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hv.h b/hv.h index f99bc7d..369bf3c 100644 --- a/hv.h +++ b/hv.h @@ -1,6 +1,6 @@ /* hv.h * - * Copyright (c) 1991-2001, Larry Wall + * Copyright (c) 1991-2002, 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. @@ -23,6 +23,8 @@ struct hek { U32 hek_hash; /* hash of key */ I32 hek_len; /* length of hash key */ char hek_key[1]; /* variable-length hash key */ + /* the hash-key is \0-terminated */ + /* after the \0 there is a byte telling whether the key is UTF8 */ }; /* hash structure: */ @@ -63,14 +65,20 @@ struct xpvhv { } STMT_END /* +=head1 Hash Manipulation Functions + =for apidoc AmU||HEf_SVKEY This flag, used in the length slot of hash entries and magic structures, specifies the structure contains an C pointer where a C pointer is to be expected. (For information only--not to be used). +=head1 Handy Values + =for apidoc AmU||Nullhv Null HV pointer. +=head1 Hash Manipulation Functions + =for apidoc Am|char*|HvNAME|HV* stash Returns the package name of a stash. See C, C. @@ -136,10 +144,10 @@ C. #define XHvTOTALKEYS(xhv) ((xhv)->xhv_keys) /* The number of placeholders in the enumerated-keys hash */ -#define XHvPLACEHOLDERS(xhv) ((IV)((xhv)->xhv_placeholders)) +#define XHvPLACEHOLDERS(xhv) ((xhv)->xhv_placeholders) -/* the number of keys that exist() (i.e. excluding placeholers) */ -#define XHvUSEDKEYS(xhv) (XHvTOTALKEYS(xhv) - XHvPLACEHOLDERS(xhv)) +/* the number of keys that exist() (i.e. excluding placeholders) */ +#define XHvUSEDKEYS(xhv) (XHvTOTALKEYS(xhv) - (IV)XHvPLACEHOLDERS(xhv)) /* * HvKEYS gets the number of keys that actually exist(), and is provided @@ -205,7 +213,7 @@ C. #define HEK_HASH(hek) (hek)->hek_hash #define HEK_LEN(hek) (hek)->hek_len #define HEK_KEY(hek) (hek)->hek_key -#define HEK_UTF8(hek) (*(HEK_KEY(hek)+HEK_LEN(hek))) +#define HEK_UTF8(hek) (*(HEK_KEY(hek)+HEK_LEN(hek)+1)) /* calculate HV array allocation */ #if defined(STRANGE_MALLOC) || defined(MYMALLOC)