|
ZEDA
1.6.18
|
Macros | |
| #define | zAlloc(t, n) ( (n) == 0 ? NULL : (t *)calloc( (n), sizeof(t) ) ) |
| #define | zAllocZero(t, n) ( (n) == 0 ? NULL : (t *)calloc( (n), sizeof(t) ) ) |
| #define | zFree(m) do{ if( (m) ){ free( m ); (m) = NULL; } } while(0) |
| #define | zCopy(t, s, d) ( (t *)memcpy( d, s, sizeof(t) ) ) |
| #define | zRealloc(m, t, n) (t *)realloc( (void *)m, sizeof(t)*(n) ) |
Functions | |
| void * | zClone (void *src, size_t size) |
| clone a memory space. More... | |
| #define zAlloc | ( | t, | |
| n | |||
| ) | ( (n) == 0 ? NULL : (t *)calloc( (n), sizeof(t) ) ) |
allocate memory for n data of a data type type.
| #define zAllocZero | ( | t, | |
| n | |||
| ) | ( (n) == 0 ? NULL : (t *)calloc( (n), sizeof(t) ) ) |
allocate memory for n data of a data type type and clear it by zero.
| #define zFree | ( | m | ) | do{ if( (m) ){ free( m ); (m) = NULL; } } while(0) |
free memory allocated at m. m is reset to be the null pointer after freeing the memory.
| #define zCopy | ( | t, | |
| s, | |||
| d | |||
| ) | ( (t *)memcpy( d, s, sizeof(t) ) ) |
copy s to d, where both are supposed to be types of t.
| #define zRealloc | ( | m, | |
| t, | |||
| n | |||
| ) | (t *)realloc( (void *)m, sizeof(t)*(n) ) |
reallocate memory where m points. n is the number of data to be reallocated. type is the type of the data.
| void* zClone | ( | void * | src, |
| size_t | size | ||
| ) |
clone a memory space.
zClone() clones a memory space src with a size size and returns a pointer to the newly allocated memory if succeeding. Otherwise, the null pointer is returned.
1.8.13