my personal opinion is that most uses of pcalloc() are just lazy
programming.

if maintainability is an issue then make a creator function or macro for
your data structures.

the only thing empirical here is that the person doing the pcalloc to
palloc change wasn't thorough enough.  it doesn't prove your point.  your
point, if i recall correctly, was "hey if someone adds a new element to a
structure then it might not get initialised properly."

that, of course, is also an example of a lazy programmer.

-dean

On Fri, 19 Oct 2001, Greg Stein wrote:

> I brought this up once before. I think it was Aaron that suggested an
> "optimization" which changed a pcalloc to a palloc. I noted that doing
> things like that are troublesome for long term maintenance.
>
> Bam. Empirical evidence here.
>
> Changing pcalloc to palloc should only be done when we have specific
> information that it is *really* helpful.
>
> Cheers,
> -g
>
> On Fri, Oct 19, 2001 at 02:05:48AM -0000, [EMAIL PROTECTED] wrote:
> > wrowe       01/10/18 19:05:48
> >
> >   Modified:    server   core.c
> >   Log:
> >     Guys... please be _careful_ when you pcalloc -> palloc!!!
> >
> >     Resolves GAmes' segfault observations
> >
> >   Revision  Changes    Path
> >   1.76      +3 -1      httpd-2.0/server/core.c
> >
> >   Index: core.c
> >   ===================================================================
> >   RCS file: /home/cvs/httpd-2.0/server/core.c,v
> >   retrieving revision 1.75
> >   retrieving revision 1.76
> >   diff -u -r1.75 -r1.76
> >   --- core.c        2001/10/16 11:54:06     1.75
> >   +++ core.c        2001/10/19 02:05:48     1.76
> >   @@ -183,7 +183,9 @@
> >     memcpy(conf->response_code_strings, base->response_code_strings,
> >            sizeof(*conf->response_code_strings) * RESPONSE_CODES);
> >        }
> >   -
> >   +    else
> >   +        base->response_code_strings = NULL;
> >   +
> >        conf->d = new->d;
> >        conf->d_is_fnmatch = new->d_is_fnmatch;
> >        conf->d_components = new->d_components;
> >
> >
> >
>
> --
> Greg Stein, http://www.lyra.org/
>

Reply via email to