API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IREALLOC_ERRMALLOCRECEX()

Brew Release
Brew MP 1.0.2
See Also
IRealloc_ErrMalloc()
Description
Helper macro for allocating blocks capable of holding a particular data type, plus a specified amount of extra space.
Params
piRealloc
[]:
pointer to the IRealloc interface : the type name of a valid C type
nExtra
[]:
the number of extra bytes to allocate
ppOut
[]:
(out) on exit, *ppOut will have the new pointer to the block, or NULL if no block was allocated.
Prototype
  •    int IREALLOC_ERRMALLOCRECEX(IRealloc *piRealloc,
                                   ,
                                   int nExtra,
                                    **ppOut);
    
Return
  • AEE_SUCCESS - Allocation (or free) was successful AEE_ENOMEMORY - Not enough memory to fulfill the request AEE_EHEAP - An internal heap error was detected Another error from AEEStdErr.h, if appropriate
Side Effect
  • None
Comments
This helper macro may be used to request a zero-initialized block of memory capable of holding a particular data type, plus some extra space. Example: struct foo *pFoo; nErr = IREALLOC_ERRMALLOCRECEX(piRealloc, struct foo, 16, &pFoo); if (AEE_SUCCESS == nErr) { ... Fill in the empty structure pointed to by pFoo ... ... Fill in up to 16 bytes immediately after the structure ... } There is no range checking for nExtra; if a negative value is passed for nExtra, or if nExtra is so large as to cause an arithmetic overflow, this macro will likely fail to work correctly.