From 7a7b9979b52d5d343099df1ecef6251a3db2d8e8 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 30 Oct 2005 10:31:01 +0000 Subject: [PATCH] Replace hv_iternext() with a macro that calls hv_iternext_flags with an extra 0 argument. Move the old body to mathoms.c p4raw-id: //depot/perl@25895 --- embed.fnc | 2 +- embed.h | 2 -- hv.c | 12 ++---------- hv.h | 2 ++ mathoms.c | 6 ++++++ proto.h | 4 ++-- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/embed.fnc b/embed.fnc index 95ffb2f..5af184b 100644 --- a/embed.fnc +++ b/embed.fnc @@ -285,7 +285,7 @@ Ap |void |hv_free_ent |NN HV* hv|NULLOK HE* entryK Apd |I32 |hv_iterinit |NN HV* tb ApdR |char* |hv_iterkey |NN HE* entry|NN I32* retlen ApdR |SV* |hv_iterkeysv |NN HE* entry -ApdR |HE* |hv_iternext |NN HV* tb +ApdRbm |HE* |hv_iternext |NN HV* tb ApdR |SV* |hv_iternextsv |NN HV* hv|NN char** key|NN I32* retlen ApMdR |HE* |hv_iternext_flags|NN HV* tb|I32 flags ApdR |SV* |hv_iterval |NN HV* tb|NN HE* entry diff --git a/embed.h b/embed.h index 31085e1..c7feb58 100644 --- a/embed.h +++ b/embed.h @@ -273,7 +273,6 @@ #define hv_iterinit Perl_hv_iterinit #define hv_iterkey Perl_hv_iterkey #define hv_iterkeysv Perl_hv_iterkeysv -#define hv_iternext Perl_hv_iternext #define hv_iternextsv Perl_hv_iternextsv #define hv_iternext_flags Perl_hv_iternext_flags #define hv_iterval Perl_hv_iterval @@ -2263,7 +2262,6 @@ #define hv_iterinit(a) Perl_hv_iterinit(aTHX_ a) #define hv_iterkey(a,b) Perl_hv_iterkey(aTHX_ a,b) #define hv_iterkeysv(a) Perl_hv_iterkeysv(aTHX_ a) -#define hv_iternext(a) Perl_hv_iternext(aTHX_ a) #define hv_iternextsv(a,b,c) Perl_hv_iternextsv(aTHX_ a,b,c) #define hv_iternext_flags(a,b) Perl_hv_iternext_flags(aTHX_ a,b) #define hv_iterval(a,b) Perl_hv_iterval(aTHX_ a,b) diff --git a/hv.c b/hv.c index 7a9fd3a..1ab0efe 100644 --- a/hv.c +++ b/hv.c @@ -1889,6 +1889,8 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, I32 len, int flags) } /* +hv_iternext is implemented as a macro in hv.h + =for apidoc hv_iternext Returns entries from a hash iterator. See C. @@ -1901,16 +1903,6 @@ to free the entry on the next call to C, so you must not discard your iterator immediately else the entry will leak - call C to trigger the resource deallocation. -=cut -*/ - -HE * -Perl_hv_iternext(pTHX_ HV *hv) -{ - return hv_iternext_flags(hv, 0); -} - -/* =for apidoc hv_iternext_flags Returns entries from a hash iterator. See C and C. diff --git a/hv.h b/hv.h index f47a77b..5243adc 100644 --- a/hv.h +++ b/hv.h @@ -360,6 +360,8 @@ C. /* Flags for hv_iternext_flags. */ #define HV_ITERNEXT_WANTPLACEHOLDERS 0x01 /* Don't skip placeholders. */ +#define hv_iternext(hv) hv_iternext_flags(hv, 0) + /* available as a function in hv.c */ #define Perl_sharepvn(sv, len, hash) HEK_KEY(share_hek(sv, len, hash)) #define sharepvn(sv, len, hash) Perl_sharepvn(sv, len, hash) diff --git a/mathoms.c b/mathoms.c index ce2022e..ce7a49e 100644 --- a/mathoms.c +++ b/mathoms.c @@ -595,6 +595,12 @@ Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name) return gv_fetchmethod_autoload(stash, name, TRUE); } +HE * +Perl_hv_iternext(pTHX_ HV *hv) +{ + return hv_iternext_flags(hv, 0); +} + AV * Perl_av_fake(pTHX_ register I32 size, register SV **strp) { diff --git a/proto.h b/proto.h index be53793..f71e3d6 100644 --- a/proto.h +++ b/proto.h @@ -662,9 +662,9 @@ PERL_CALLCONV SV* Perl_hv_iterkeysv(pTHX_ HE* entry) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); -PERL_CALLCONV HE* Perl_hv_iternext(pTHX_ HV* tb) +/* PERL_CALLCONV HE* Perl_hv_iternext(pTHX_ HV* tb) __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); + __attribute__nonnull__(pTHX_1); */ PERL_CALLCONV SV* Perl_hv_iternextsv(pTHX_ HV* hv, char** key, I32* retlen) __attribute__warn_unused_result__ -- 2.7.4