You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@locus.apache.org on 2000/05/13 00:45:33 UTC

cvs commit: modperl/src/modules/perl Table.xs

dougm       00/05/12 15:45:32

  Modified:    .        Changes
               src/modules/perl Table.xs
  Log:
  Apache::Table->unset can now be called with an array reference
  
  Revision  Changes    Path
  1.480     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.479
  retrieving revision 1.480
  diff -u -r1.479 -r1.480
  --- Changes	2000/05/12 07:10:56	1.479
  +++ Changes	2000/05/12 22:45:30	1.480
  @@ -10,6 +10,8 @@
   
   =item 1.23_01-dev
   
  +Apache::Table->unset can now be called with an array reference
  +
   Apache::PerlRun::flush_namespace fixes, so aliased (imported)
   code/hash/array/scalar are undefined without undef-ing the pointed-to
   data and without using B.pm, thanks to Richard Chen for the suggestion
  
  
  
  1.9       +13 -5     modperl/src/modules/perl/Table.xs
  
  Index: Table.xs
  ===================================================================
  RCS file: /home/cvs/modperl/src/modules/perl/Table.xs,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Table.xs	1999/06/07 21:01:23	1.8
  +++ Table.xs	2000/05/12 22:45:32	1.9
  @@ -58,6 +58,11 @@
   
   }
   
  +static void table_delete(table *tab, const char *key, const char *val)
  +{
  +    table_unset(tab, val);
  +}
  +
   static Apache__Table ApacheTable_new(table *utable)
   {
       Apache__Table RETVAL = (Apache__Table)safemalloc(sizeof(TiedTable));
  @@ -148,9 +153,9 @@
       RETVAL
   
   const char*
  -DELETE(self, key)
  +DELETE(self, sv)
       Apache::Table self
  -    const char *key
  +    SV *sv
   
       ALIAS:
       unset = 1
  @@ -162,9 +167,12 @@
       ix = ix;
       if(!self->utable) XSRETURN_UNDEF;
       RETVAL = NULL;
  -    if(gimme != G_VOID)
  -        RETVAL = table_get(self->utable, key);
  -    table_unset(self->utable, key);
  +    if((ix == 0) && (gimme != G_VOID)) {
  +        STRLEN n_a;
  +        RETVAL = table_get(self->utable, SvPV(sv,n_a));
  +    }
  +
  +    table_modify(self, NULL, sv, (TABFUNC)table_delete);
       if(!RETVAL) XSRETURN_UNDEF;
   
       OUTPUT: