httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: calling pstrdup() on value before table_set?
Date Sun, 21 Dec 1997 15:28:07 GMT
Rodent of Unusual Size wrote:
> 
> Dean Gaudet wrote:
> > 
> > Either that or the table_*() functions should be changed to not
> > duplicate... I wonder which wastes less memory.  Not duplicating is likely
> > to be a source of bugs though, because you have to allocate into the right
> > pool.
> 
> Personally, I would rather have the table_*() functions duplicate
> whatever they're given.  (Of course, I'd also like a parallel set
> of table_*_opaque(table *t, void *d, size_t len) routines so non-
> string data could be table-ised.)
> 
> My feeling is that when I hand something to table_*(), I'm expecting
> it to squirrel a value away for me, not just point to it.  The pool
> is an attribute of the table, so copying values into the table's
> pool makes perfect sense and strikes me as elegant.
> 

IMO table-ized data should be "static" and somewhat safe, so that if
the pointer to it changes, the tabled-version remains the same. Thus,
I also agree that table_*() should dup and alloc as required.
-- 
====================================================================
      Jim Jagielski            |       jaguNET Access Services
     jim@jaguNET.com           |       http://www.jaguNET.com/
            "Look at me! I'm wearing a cardboard belt!"

Mime
View raw message