[brlcad-commits] SF.net SVN: brlcad:[41325] brlcad/trunk/include/bu.h
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2010-11-11 02:34:05
|
Revision: 41325 http://brlcad.svn.sourceforge.net/brlcad/?rev=41325&view=rev Author: brlcad Date: 2010-11-11 02:33:58 +0000 (Thu, 11 Nov 2010) Log Message: ----------- expand the documentation for bu_realloc() and how it relates to the boundary cases where size in zero and/or the ptr is NULL with particular clarity that NULL will still never be returned. fortunately, the standard allows the return to be non-null even for zero sizes. Modified Paths: -------------- brlcad/trunk/include/bu.h Modified: brlcad/trunk/include/bu.h =================================================================== --- brlcad/trunk/include/bu.h 2010-11-11 02:32:30 UTC (rev 41324) +++ brlcad/trunk/include/bu.h 2010-11-11 02:33:58 UTC (rev 41325) @@ -3234,13 +3234,18 @@ * * bu_malloc()/bu_free() compatible wrapper for realloc(). * + * this routine mimics the C99 standard behavior of realloc() except + * that NULL will never be returned. it will bomb if siz is zero and + * ptr is NULL. it will return a minimum allocation suitable for + * bu_free() if siz is zero and ptr is non-NULL. + * * While the string 'str' is provided for the log messages, don't - * disturb the mdb_str value, so that this storage allocation can be + * disturb the str value, so that this storage allocation can be * tracked back to it's original creator. */ BU_EXPORT BU_EXTERN(genptr_t bu_realloc, (genptr_t ptr, - size_t cnt, + size_t siz, const char *str)); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |