[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flac-dev
Subject:    [flac-dev] sf bug 258 - don't calloc pointers
From:       Ralph Giles <giles () thaumas ! net>
Date:       2013-08-20 3:01:59
Message-ID: 5212DC27.4020203 () thaumas ! net
[Download RAW message or body]

Bug suggests using literal assignment to initialize pointers in
structures instead of calloc, to avoid pointer-representation assumptions.

https://sourceforge.net/p/flac/bugs/258/


Pointers should not be initialised by the function "calloc" if they are
a member of a bigger data structure. Would you like to deal with an
internal representation that is not all-bits-0?
http://c-faq.com/null/varieties.html

I recommend to assign a "0" to data elements like "buffer" in the
functions "FLAC__bitreader_new" and "FLAC__bitwriter_new" separately.
http://flac.cvs.sourceforge.net/flac/flac/src/libFLAC/bitreader.c?revision=1.6&view=markup
http://flac.cvs.sourceforge.net/flac/flac/src/libFLAC/bitwriter.c?revision=1.8&view=markup

Are assignments for the data element "words" in the functions
"FLAC__bitreader_init" and "FLAC__bitwriter_init" unnecassary in this
context?
_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic