[MOAB-dev] [PATCH 1/2] iMesh_MOAB: do not allocate new memory for count=0 items
Jed Brown
jed at 59A2.org
Fri Jun 10 07:08:36 CDT 2011
It is relatively common to fill a buffer with consecutive queries, some
of which may return zero items. In such scenarios, the user passes in a
valid pointer, but occasionally a length of 0. In such scenarios,
having the library allocate a new buffer of zero length is not
desirable.
On the other hand, if a user knowingly passes in a length of zero, but
undefined pointer value, they would expect the library to return a
pointer that can safely be passed to free(). A workaround is to nullify
the pointer prior to calling iMesh with expectation of a new array.
---
itaps/imesh/iMesh_MOAB.hpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-iMesh_MOAB-do-not-allocate-new-memory-for-count-0-it.patch
Type: text/x-patch
Size: 524 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20110610/b3146808/attachment.bin>
More information about the moab-dev
mailing list