Use the force Luke!
/* hash structure: */
/* This structure must match the beginning of struct xpvmg in sv.h. */
struct xpvhv {
HV* xmg_stash; /* class package */
union _xmgu xmg_u;
STRLEN xhv_keys; /* total keys, including placeholders
+*/
STRLEN xhv_max; /* subscript of last element of xhv_ar
+ray */
};
and
/* the number of keys (including any placeholders) */
#define XHvTOTALKEYS(xhv) ((xhv)->xhv_keys)
/*
* HvKEYS gets the number of keys that actually exist(), and is provid
+ed
* for backwards compatibility with old XS code. The core uses HvUSEDK
+EYS
* (keys, excluding placeholders) and HvTOTALKEYS (including placehold
+ers)
*/
#define HvKEYS(hv) HvUSEDKEYS(hv)
#define HvUSEDKEYS(hv) (HvTOTALKEYS(hv) - HvPLACEHOLDERS_get(
+hv))
#define HvTOTALKEYS(hv) XHvTOTALKEYS((XPVHV*) SvANY(hv))
#define HvPLACEHOLDERS(hv) (*Perl_hv_placeholders_p(aTHX_ MUTABLE
+_HV(hv)))
#define HvPLACEHOLDERS_get(hv) (SvMAGIC(hv) ? Perl_hv_placeholders_ge
+t(aTHX_ (const HV *)hv) : 0)
HvKEYS(hv) is the thing that implements scalar keys %hash
---
$world=~s/war/peace/g
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|