summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hv.h16
-rw-r--r--sv.h5
2 files changed, 17 insertions, 4 deletions
diff --git a/hv.h b/hv.h
index 82e9c83396..7e1fc3d50b 100644
--- a/hv.h
+++ b/hv.h
@@ -280,10 +280,24 @@ hash.
=cut
*/
+
#define HvFILL(hv) Perl_hv_fill(aTHX_ MUTABLE_HV(hv))
#define HvMAX(hv) ((XPVHV*) SvANY(hv))->xhv_max
+
+/*
+
+=for apidoc Am|bool|HvHasAUX|HV *const hv
+
+Returns true if the HV has a C<struct xpvhv_aux> extension. Use this to check
+whether it is valid to call C<HvAUX()>.
+
+=cut
+
+*/
+#define HvHasAUX(hv) (SvFLAGS(hv) & SVphv_HasAUX)
+
/* This quite intentionally does no flag checking first. That's your
- responsibility. */
+ responsibility. Use HvHasAUX() first */
#define HvAUX(hv) (&(((struct xpvhv_with_aux*) SvANY(hv))->xhv_aux))
#define HvRITER(hv) (*Perl_hv_riter_p(aTHX_ MUTABLE_HV(hv)))
#define HvEITER(hv) (*Perl_hv_eiter_p(aTHX_ MUTABLE_HV(hv)))
diff --git a/sv.h b/sv.h
index 98995a3624..39edc140df 100644
--- a/sv.h
+++ b/sv.h
@@ -422,9 +422,8 @@ perform the upgrade if necessary. See C<L</svtype>>.
including PVLV-as-regex. See
isREGEXP().
*/
-#define SVf_OOK 0x02000000 /* has valid offset value. For a PVHV this
- means that a hv_aux struct is present
- after the main array */
+#define SVf_OOK 0x02000000 /* has valid offset value */
+#define SVphv_HasAUX SVf_OOK /* PVHV has an additional hv_aux struct */
#define SVf_BREAK 0x04000000 /* refcnt is artificially low - used by
SVs in final arena cleanup.
Set in S_regtry on PL_reg_curpm, so that