David Bustos wrote: > Quoth Antonello Cruz on Wed, Sep 03, 2008 at 11:40:16AM -0700: >> David Bustos wrote: >>> 394: Please explain why it's preferable to define a malloc() version >>> of _read_single_astring_from_pg() than the alternatives. Namely, >>> making _read_single_astring_from_pg() accept an argument dictating >>> whether to use uu_zalloc() or malloc() and making all of the callers >>> of _read_single_astring_from_pg() use uu_free(). >> Yep! refactoring to use a flag. > > Ok, but please include a comment explaining why that's preferable to > making all of the callers use the same freeing function.
The initial thought was to use uu_zalloc/uu_free internally and malloc/free externally. The concern was a change in the backend memory allocator in libuutil could break the library if an external user called free() for a buffer allocated with uu_zalloc(). Since there is no benefit in using libuutil memory allocation I'll change the code to use malloc/calloc and free instead of uu_zalloc and uufree. Antonello