diff options
author | David Mitchell <davem@iabyn.com> | 2011-05-10 19:06:45 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-05-19 14:49:43 +0100 |
commit | e0171a1a31b0610ebdf32920b0159c22c37e4691 (patch) | |
tree | 5d3ec85de32e94fd75c837142a844d5d030ed275 /proto.h | |
parent | ee872193302939c724fd6c2c18071c621bfac6c4 (diff) | |
download | perl-e0171a1a31b0610ebdf32920b0159c22c37e4691.tar.gz |
add hfree_next_entry(), hv_free_ent_ret()
Move body of hfreeentries()' central loop into a new function,
hfree_next_entry(); leaving hfreeentries() as a simple loop that calls
hfree_next_entry() until there are no entries left.
This will in future allow sv_clear() to free a hash iteratively rather
than recursively.
Similarly, turn hv_free_ent() into a thin wrapper around a new function,
hv_free_ent_ret(), which doesn't free HeVAL(), but rather just returns the
SV instead.
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -5322,6 +5322,11 @@ STATIC struct xpvhv_aux* S_hv_auxinit(HV *hv) assert(hv) STATIC SV* S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, int k_flags, I32 d_flags, U32 hash); +STATIC SV* S_hv_free_ent_ret(pTHX_ HV *hv, HE *entryK) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_HV_FREE_ENT_RET \ + assert(hv) + STATIC void S_hv_magic_check(HV *hv, bool *needs_copy, bool *needs_store) __attribute__nonnull__(1) __attribute__nonnull__(2) @@ -5367,6 +5372,14 @@ PERL_CALLCONV void Perl_sv_kill_backrefs(pTHX_ SV *const sv, AV *const av) assert(sv) #endif +#if defined(PERL_IN_HV_C) || defined(PERL_IN_SV_C) +PERL_CALLCONV SV* Perl_hfree_next_entry(pTHX_ HV *hv, STRLEN *indexp) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_HFREE_NEXT_ENTRY \ + assert(hv); assert(indexp) + +#endif #if defined(PERL_IN_LOCALE_C) # if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) STATIC char* S_stdize_locale(pTHX_ char* locs) |