dougm 01/10/12 20:22:15 Modified: src/modules/perl modperl_mgv.c modperl_util.c modperl_util.h Log: making modperl_perl_hv_fetch_he a public function Revision Changes Path 1.15 +0 -33 modperl-2.0/src/modules/perl/modperl_mgv.c Index: modperl_mgv.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_mgv.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- modperl_mgv.c 2001/04/25 03:13:58 1.14 +++ modperl_mgv.c 2001/10/13 03:22:15 1.15 @@ -17,39 +17,6 @@ #define modperl_mgv_new_namen(mgv, p, n) \ modperl_mgv_new_w_name(mgv, p, n, 0) -/* - * similar to hv_fetch_ent, but takes string key and key len rather than SV - * also skips magic and utf8 fu, since we are only dealing with symbol tables - */ -static HE *S_hv_fetch_he(pTHX_ HV *hv, - register char *key, - register I32 klen, - register U32 hash) -{ - register XPVHV *xhv; - register HE *entry; - - xhv = (XPVHV *)SvANY(hv); - if (!xhv->xhv_array) { - return 0; - } - entry = ((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max]; - - for (; entry; entry = HeNEXT(entry)) { - if (HeHASH(entry) != hash) - continue; - if (HeKLEN(entry) != klen) - continue; - if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) - continue; - return entry; - } - - return 0; -} - -#define hv_fetch_he(hv,k,l,h) S_hv_fetch_he(aTHX_ hv,k,l,h) - int modperl_mgv_equal(modperl_mgv_t *mgv1, modperl_mgv_t *mgv2) { 1.26 +35 -0 modperl-2.0/src/modules/perl/modperl_util.c Index: modperl_util.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- modperl_util.c 2001/10/08 23:34:07 1.25 +++ modperl_util.c 2001/10/13 03:22:15 1.26 @@ -399,6 +399,41 @@ } } +/* + * similar to hv_fetch_ent, but takes string key and key len rather than SV + * also skips magic and utf8 fu, since we are only dealing with internal tables + */ +HE *modperl_perl_hv_fetch_he(pTHX_ HV *hv, + register char *key, + register I32 klen, + register U32 hash) +{ + register XPVHV *xhv; + register HE *entry; + + xhv = (XPVHV *)SvANY(hv); + if (!xhv->xhv_array) { + return 0; + } + + entry = ((HE**)xhv->xhv_array)[hash & (I32)xhv->xhv_max]; + + for (; entry; entry = HeNEXT(entry)) { + if (HeHASH(entry) != hash) { + continue; + } + if (HeKLEN(entry) != klen) { + continue; + } + if (HeKEY(entry) != key && memNE(HeKEY(entry), key, klen)) { + continue; + } + return entry; + } + + return 0; +} + void modperl_perl_call_list(pTHX_ AV *subs, const char *name) { I32 i, oldscope = PL_scopestack_ix; 1.25 +8 -0 modperl-2.0/src/modules/perl/modperl_util.h Index: modperl_util.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- modperl_util.h 2001/10/08 23:34:07 1.24 +++ modperl_util.h 2001/10/13 03:22:15 1.25 @@ -68,6 +68,14 @@ MP_INLINE void modperl_perl_av_push_elts_ref(pTHX_ AV *dst, AV *src); +HE *modperl_perl_hv_fetch_he(pTHX_ HV *hv, + register char *key, + register I32 klen, + register U32 hash); + +#define hv_fetch_he(hv,k,l,h) \ + modperl_perl_hv_fetch_he(aTHX_ hv, k, l, h) + void modperl_perl_call_list(pTHX_ AV *subs, const char *name); void modperl_perl_exit(pTHX_ int status);