From: Nicholas Clark Date: Sun, 30 Oct 2005 16:24:37 +0000 (+0000) Subject: Replace hv_magic() with a macro to call sv_magic() directly. Move the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bc5cdc23883e8a43c7fbf40a0069d823caa8adb3;p=p5sagit%2Fp5-mst-13.2.git Replace hv_magic() with a macro to call sv_magic() directly. Move the old body to mathoms.c p4raw-id: //depot/perl@25897 --- diff --git a/embed.fnc b/embed.fnc index 5af184b..0de7804 100644 --- a/embed.fnc +++ b/embed.fnc @@ -290,7 +290,7 @@ 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 Ap |void |hv_ksplit |NN HV* hv|IV newmax -Apd |void |hv_magic |NN HV* hv|NULLOK GV* gv|int how +Apdbm |void |hv_magic |NN HV* hv|NULLOK GV* gv|int how Apd |SV** |hv_store |NULLOK HV* tb|NULLOK const char* key|I32 klen|NULLOK SV* val \ |U32 hash Apd |HE* |hv_store_ent |NULLOK HV* tb|NULLOK SV* key|NULLOK SV* val|U32 hash diff --git a/embed.h b/embed.h index c7feb58..0111652 100644 --- a/embed.h +++ b/embed.h @@ -277,7 +277,6 @@ #define hv_iternext_flags Perl_hv_iternext_flags #define hv_iterval Perl_hv_iterval #define hv_ksplit Perl_hv_ksplit -#define hv_magic Perl_hv_magic #define hv_store Perl_hv_store #define hv_store_ent Perl_hv_store_ent #define hv_store_flags Perl_hv_store_flags @@ -2266,7 +2265,6 @@ #define hv_iternext_flags(a,b) Perl_hv_iternext_flags(aTHX_ a,b) #define hv_iterval(a,b) Perl_hv_iterval(aTHX_ a,b) #define hv_ksplit(a,b) Perl_hv_ksplit(aTHX_ a,b) -#define hv_magic(a,b,c) Perl_hv_magic(aTHX_ a,b,c) #define hv_store(a,b,c,d,e) Perl_hv_store(aTHX_ a,b,c,d,e) #define hv_store_ent(a,b,c,d) Perl_hv_store_ent(aTHX_ a,b,c,d) #define hv_store_flags(a,b,c,d,e,f) Perl_hv_store_flags(aTHX_ a,b,c,d,e,f) diff --git a/hv.c b/hv.c index 1ab0efe..838dbbc 100644 --- a/hv.c +++ b/hv.c @@ -2123,6 +2123,9 @@ Perl_hv_iternextsv(pTHX_ HV *hv, char **key, I32 *retlen) } /* + +Now a macro in hv.h + =for apidoc hv_magic Adds magic to a hash. See C. @@ -2130,22 +2133,6 @@ Adds magic to a hash. See C. =cut */ -void -Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how) -{ - sv_magic((SV*)hv, (SV*)gv, how, Nullch, 0); -} - -#if 0 /* use the macro from hv.h instead */ - -char* -Perl_sharepvn(pTHX_ const char *sv, I32 len, U32 hash) -{ - return HEK_KEY(share_hek(sv, len, hash)); -} - -#endif - /* possibly free a shared string if no one has access to it * len and hash must both be valid for str. */ diff --git a/hv.h b/hv.h index 5243adc..7552267 100644 --- a/hv.h +++ b/hv.h @@ -361,6 +361,7 @@ C. #define HV_ITERNEXT_WANTPLACEHOLDERS 0x01 /* Don't skip placeholders. */ #define hv_iternext(hv) hv_iternext_flags(hv, 0) +#define hv_magic(hv, gv, how) sv_magic((SV*)(hv), (SV*)(gv), how, Nullch, 0) /* available as a function in hv.c */ #define Perl_sharepvn(sv, len, hash) HEK_KEY(share_hek(sv, len, hash)) diff --git a/mathoms.c b/mathoms.c index ce7a49e..c62ab37 100644 --- a/mathoms.c +++ b/mathoms.c @@ -601,6 +601,22 @@ Perl_hv_iternext(pTHX_ HV *hv) return hv_iternext_flags(hv, 0); } +void +Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how) +{ + sv_magic((SV*)hv, (SV*)gv, how, Nullch, 0); +} + +#if 0 /* use the macro from hv.h instead */ + +char* +Perl_sharepvn(pTHX_ const char *sv, I32 len, U32 hash) +{ + return HEK_KEY(share_hek(sv, len, hash)); +} + +#endif + AV * Perl_av_fake(pTHX_ register I32 size, register SV **strp) { diff --git a/proto.h b/proto.h index f71e3d6..cc0df9f 100644 --- a/proto.h +++ b/proto.h @@ -684,8 +684,8 @@ PERL_CALLCONV SV* Perl_hv_iterval(pTHX_ HV* tb, HE* entry) PERL_CALLCONV void Perl_hv_ksplit(pTHX_ HV* hv, IV newmax) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV void Perl_hv_magic(pTHX_ HV* hv, GV* gv, int how) - __attribute__nonnull__(pTHX_1); +/* PERL_CALLCONV void Perl_hv_magic(pTHX_ HV* hv, GV* gv, int how) + __attribute__nonnull__(pTHX_1); */ PERL_CALLCONV SV** Perl_hv_store(pTHX_ HV* tb, const char* key, I32 klen, SV* val, U32 hash); PERL_CALLCONV HE* Perl_hv_store_ent(pTHX_ HV* tb, SV* key, SV* val, U32 hash);