httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: calling pstrdup() on value before table_set?
Date Sun, 21 Dec 1997 16:27:25 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.

Yeah, agreed. Of course, if people really want to store pointers we
could make an API for that (and even make it transparent to
table_get()).

> So IMHO the cleanup is to not pstrdup() before table_set().  Simpler
> to hoover, and safer for the API.  No cholesterol, either.

Yep.

Cheers,

Ben.

--
Ben Laurie                Phone: +44 (171) 460 4460
Lead Architect            Fax:   +44 (171) 460 4461
Orchestream Ltd.
London, England.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Mime
View raw message