[MOAB-dev] [Itaps-users] [PATCH 1/2] iMesh_MOAB: do not allocate new memory for count=0 items
James Porter
jvporter at wisc.edu
Fri Jun 10 13:16:54 CDT 2011
On Fri, 2011-06-10 at 20:03 +0200, Jed Brown wrote:
> On Fri, Jun 10, 2011 at 19:43, Tim Tautges <tautges at mcs.anl.gov>
> wrote:
> I'm fine with at least not allocating for count = 0, and my
> read of the iMesh spec is that it's silent on this issue.
>
>
> It's subtle. The letter of the spec suggests (to me) that if you pass
> in UNALLOCATED (currently defined using OR), you get a pointer that
> free() can be called on. This pointer may or may not be NULL (some
> malloc() implementations return NULL on zero-length allocation, others
> return a pointer that can be freed).
A null pointer can *always* be freed. It's just a no-op.
- Jim
More information about the moab-dev
mailing list