Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

#define phDALLOC ptr,
cursize,
nelems,
cast   ) 
 

Value:

{ \
        uint32_t tempsize = nelems * sizeof(cast); \
        if (ptr == NULL) \
        { \
            ptr = (cast *)phCalloc(nelems,sizeof(cast)); \
            phCHECK_NULLPTR(ptr,"phCalloc", \
                "phCalloc failed(nelems:%lu,size:%lu)",\
                (unsigned long)nelems,\
                (unsigned long)tempsize); \
            cursize = tempsize; \
        } \
        else \
        { \
            if (cursize != tempsize)\
            { \
                ptr = (cast *)phRealloc(ptr,tempsize); \
                phCHECK_NULLPTR(ptr,"phRealloc",\
                    "phRealloc failed(nelems:%lu,size:%lu)",\
                    (unsigned long)nelems,\
                    (unsigned long)tempsize); \
                cursize = tempsize; \
            } \
            phMemset(ptr,0,cursize); \
        } \
    }
Will resize to the requested memory size and zeroize memory. This is like calling phCalloc but it will resize to memory automatically. a.k.a: phDALLOC_NELEMS

phDALLOC will ALWAYS return zero'd memory; If you're going to memset, memcpy or otherwise set/reset all the data after resizing/alloc-ing the memory ANYWAY, then use phDALLOC_GROW;

Definition at line 197 of file phMemory.h.





Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:45:28 2007 for phission by  doxygen 1.4.4