On Wed, Sep 19, 2001 at 08:11:32PM -0700, Doug MacEachern wrote:
> On Thu, 20 Sep 2001, Philippe M . Chiasson wrote:
>  
> > Sure, I could do that.
> 
> cool.  might be worth skimming the archives first, i think there may have
> been discussion on this, but i didn't pay much attention at the time.
>  
> > While talking about httpd/apr, I am also thinking about making a patch to
> > apr_table_do/vdo to provide an interface for people like me who can't magically
> > create a va_list on the fly, what do you think?
> 
> i think we should just roll our own that uses the Perl stack instead of
> the va_list.  apr_table_vdo is a very small body of code.  we could also
> skip the C callback and call the Perl callback directly.

That's not a bad idea at all.  I'll look into it.  But first I have to finish
cleaning up my next patch ;-)

> 

-- 
Philippe M. Chiasson  <[EMAIL PROTECTED]>
  Extropia's Resident System Guru
     http://www.eXtropia.com/

You can solve any problem by adding a level of
indirection--except the problem of having too many levels
of indirection. 
        -- Larry Wall

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl 
Hacker!\n$/&&print||$$++&&redo}'

Index: srclib/apr/tables/apr_hash.c
===================================================================
RCS file: /home/anoncvs/apr-cvs/tables/apr_hash.c,v
retrieving revision 1.25
diff -u -I'$Id' -I'$Revision' -r1.25 apr_hash.c
--- srclib/apr/tables/apr_hash.c        2001/09/06 06:34:59     1.25
+++ srclib/apr/tables/apr_hash.c        2001/09/20 04:25:23
@@ -139,6 +139,16 @@
     return ht;
 }
 
+APR_DECLARE(apr_hash_t *) apr_hash_maken(apr_pool_t *pool, int nelts)
+{
+    apr_hash_t *ht;
+    ht = apr_palloc(pool, sizeof(apr_hash_t));
+    ht->pool = pool;
+    ht->count = 0;
+    ht->max = nelts;
+    ht->array = alloc_array(ht, ht->max);
+    return ht;
+}
 
 /*
  * Hash iteration functions.

or if you prefer

Index: srclib/apr/tables/apr_hash.c
===================================================================
RCS file: /home/anoncvs/apr-cvs/tables/apr_hash.c,v
retrieving revision 1.25
diff -u -I'$Id' -I'$Revision' -r1.25 apr_hash.c
--- srclib/apr/tables/apr_hash.c        2001/09/06 06:34:59     1.25
+++ srclib/apr/tables/apr_hash.c        2001/09/20 04:27:21
@@ -128,17 +128,16 @@
    return apr_pcalloc(ht->pool, sizeof(*ht->array) * (max + 1));
 }
 
-APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool)
+APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool, int nelts)
 {
     apr_hash_t *ht;
     ht = apr_palloc(pool, sizeof(apr_hash_t));
     ht->pool = pool;
     ht->count = 0;
-    ht->max = INITIAL_MAX;
+    ht->max = nelts;
     ht->array = alloc_array(ht, ht->max);
     return ht;
 }
-
 
 /*
  * Hash iteration functions.

PGP signature

Reply via email to