On Sun, Jul 06, 2014 at 09:56:05AM -0700, Chris Cappuccio wrote:
> Denis Fondras [[email protected]] wrote:
> > Hello all,
> >
> > If I understand correctly calloc(), allocated space is already
> > initialized to zero. So setting var to NULL is not needed.
> >
> > Is it alright or should it be kept "just in case" ?
> >
> > Regards,
> > Denis
> >
> > --- parse.y.orig Sun Jul 6 17:51:59 2014
> > +++ parse.y Sun Jul 6 17:52:15 2014
> > @@ -3042,7 +3042,6 @@
> >
> > /* some sane defaults */
> > p->state = STATE_NONE;
> > - p->next = NULL;
> > p->conf.distance = 1;
> > p->conf.announce_type = ANNOUNCE_UNDEF;
> > p->conf.announce_capa = 1;
>
> This is technically correct. So are you, but only because NULL and
> zero happen to be the same value. They don't necessarily have to
> be, it is implementation-defined. (Of course there would be
> fireworks everywhere if they weren't, since lots of people make
> the same assumption you did.)
>
> Chris
But note there are more pointers in struct peer. So in pedantic mode,
all these should be inited to NULL.
-Otto