SCTP Discussions

Text archives Help


Re: [SCTP-Discussion] Bug in bundling .c


Chronological Thread 
  • From: Marc Boucher <marc+sctp AT mbsi.ca>
  • To: discussion AT sctp.de
  • Subject: Re: [SCTP-Discussion] Bug in bundling .c
  • Date: Thu Apr 5 14:24:01 2001
  • List-id: SCTP Discussions <discussion.sctp.de>

agreed, but implicit initialization is better than no initialization ;-)

Marc

On Thu, Apr 05, 2001 at 02:10:39PM +0200, Andreas Jungmaier wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello all,
>
> that is the sort of
> implicit initialization I would rather not introduce into
> the code (probably there is already enough of bad things
> in the code ;-)
>
> Regards,
> Andreas
>
> > how about simply zeroing the whole thing after allocation
> > this way if fields are added to the struct in the future they will be
> > automatically initialized to zero/FALSE.
> >
> > --- sbundling.c 2001/04/05 10:23:22 1.1
> > +++ sbundling.c 2001/04/05 10:24:16
> > @@ -120,15 +120,13 @@
> > error_log(ERROR_MAJOR, "Malloc failed");
> > return 0;
> > }
> > +
> > + memset(ptr, '\0', sizeof(sizeof(bundling_instance)));
> > +
> > ptr->ctrl_position = sizeof(SCTP_common_header); /* start adding data
> > after that header ! */ ptr->data_position = sizeof(SCTP_common_header); /*
> > start adding data after that header ! */ ptr->sack_position =
> > sizeof(SCTP_common_header); /* start adding data after that header ! */
> >
> > - ptr->data_in_buffer = FALSE;
> > - ptr->ctrl_chunk_in_buffer = FALSE;
> > - ptr->sack_in_buffer = FALSE;
> > - ptr->got_send_request = FALSE;
> > - ptr->locked = FALSE;
> > return ptr;
> > }
> >
>
> Andreas Jungmaier
>
> -
> ----------------------------------------------------------------------------
> void hamlet()
> {#define question=((bb)||(!bb))}
> -
> ----------------------------------------------------------------------------
> Andreas Jungmaier, Dipl.-Ing.
> University of Essen email:
> ajung AT exp-math.uni-essen.de
> Computer Networking Technology Group Tel. : +49 (0201) 183-7636
> -
> ----------------------------------------------------------------------------
> PGP Public Key and Fingerprint: see http://www.exp-math.uni-essen.de/~ajung
> -
> ----------------------------------------------------------------------------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.4 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE6zGC/d2Uw+xBvGUIRAmCMAJ4iHJHHxcXvfOYZnpS4jR5sXBQ1lgCfZZEW
> yZ1SF3F5gOIZIMiNA93KLQ4=
> =UxlL
> -----END PGP SIGNATURE-----
> _______________________________________________
> discussion mailing list
> discussion AT sctp.de
> http://www.sctp.de/mailman/listinfo/discussion
>




Archive powered by MHonArc 2.6.19+.

Top of page