perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/src/modules/perl modperl_perl_global.c modperl_perl_global.h
Date Sat, 13 Oct 2001 18:55:03 GMT
dougm       01/10/13 11:55:03

  Modified:    src/modules/perl modperl_perl_global.c modperl_perl_global.h
  Log:
  s/hv_fetch/hv_fetch_he/g
  
  Revision  Changes    Path
  1.10      +24 -9     modperl-2.0/src/modules/perl/modperl_perl_global.c
  
  Index: modperl_perl_global.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl_global.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- modperl_perl_global.c	2001/10/08 21:09:08	1.9
  +++ modperl_perl_global.c	2001/10/13 18:55:03	1.10
  @@ -12,8 +12,14 @@
   
   /* XXX: PL_modglobal thingers might be useful elsewhere */
   
  +#define MP_MODGLOBAL_FETCH(gkey) \
  +hv_fetch_he(PL_modglobal, (char *)gkey->val, gkey->len, gkey->hash)
  +
  +#define MP_MODGLOBAL_STORE_HV(gkey) \
  +(HV*)*hv_store(PL_modglobal, gkey->val, gkey->len, (SV*)newHV(), gkey->hash)
  +
   #define MP_MODGLOBAL_ENT(key) \
  -{key, "ModPerl::" key, (sizeof("ModPerl::")-1)+(sizeof(key)-1)}
  +{key, "ModPerl::" key, (sizeof("ModPerl::")-1)+(sizeof(key)-1), 0}
   
   static modperl_modglobal_key_t MP_modglobal_keys[] = {
       MP_MODGLOBAL_ENT("END"),
  @@ -36,18 +42,18 @@
   static AV *modperl_perl_global_avcv_fetch(pTHX_ modperl_modglobal_key_t *gkey,
                                             const char *package, I32 packlen)
   {
  -    SV **svp = hv_fetch(PL_modglobal, gkey->val, gkey->len, FALSE);
  +    HE *he = MP_MODGLOBAL_FETCH(gkey);
       HV *hv;
   
  -    if (!(svp && (hv = (HV*)*svp))) {
  +    if (!(he && (hv = (HV*)HeVAL(he)))) {
           return Nullav;
       }
   
  -    if (!(svp = hv_fetch(hv, package, packlen, FALSE))) {
  +    if (!(he = hv_fetch_he(hv, (char *)package, packlen, 0))) {
           return Nullav;
       }
   
  -    return (AV*)*svp;
  +    return (AV*)HeVAL(he);
   }
   
   void modperl_perl_global_avcv_call(pTHX_ modperl_modglobal_key_t *gkey,
  @@ -76,6 +82,7 @@
   
   static int modperl_perl_global_avcv_set(pTHX_ SV *sv, MAGIC *mg)
   {
  +    HE *he;
       HV *hv;
       AV *mav, *av = (AV*)sv;
       const char *package = HvNAME(PL_curstash);
  @@ -83,11 +90,19 @@
       modperl_modglobal_key_t *gkey =
           (modperl_modglobal_key_t *)mg->mg_ptr;
   
  -    hv = (HV*)*hv_fetch(PL_modglobal, gkey->val, gkey->len, TRUE);
  -    (void)SvUPGRADE((SV*)hv, SVt_PVHV);
  +    if ((he = MP_MODGLOBAL_FETCH(gkey))) {
  +        hv = (HV*)HeVAL(he);
  +    }
  +    else {
  +        hv = MP_MODGLOBAL_STORE_HV(gkey);
  +    }
   
  -    mav = (AV*)*hv_fetch(hv, package, packlen, TRUE);
  -    (void)SvUPGRADE((SV*)mav, SVt_PVAV);
  +    if ((he = hv_fetch_he(hv, (char *)package, packlen, 0))) {
  +        mav = (AV*)HeVAL(he);
  +    }
  +    else {
  +        mav = (AV*)*hv_store(hv, package, packlen, (SV*)newAV(), 0);
  +    }
   
       /* $cv = pop @av */
       sv = AvARRAY(av)[AvFILLp(av)];
  
  
  
  1.8       +1 -0      modperl-2.0/src/modules/perl/modperl_perl_global.h
  
  Index: modperl_perl_global.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl_global.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- modperl_perl_global.h	2001/10/07 22:07:15	1.7
  +++ modperl_perl_global.h	2001/10/13 18:55:03	1.8
  @@ -5,6 +5,7 @@
       const char *name;
       const char *val;
       I32 len;
  +    U32 hash;
   } modperl_modglobal_key_t;
   
   typedef enum {
  
  
  

Mime
View raw message