Macros LIBISO_ALLOC_MEM, LIBISO_FREE_MEM for replaceing local variables
This commit is contained in:
parent
45d316d1ca
commit
f08ae22dbe
@ -1886,4 +1886,14 @@ ex:;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void *iso_alloc_mem(size_t size, size_t count, int flag)
|
||||
{
|
||||
void *pt;
|
||||
|
||||
pt = calloc(size, count);
|
||||
if(pt == NULL)
|
||||
iso_msg_submit(-1, ISO_OUT_OF_MEM, 0, "Out of virtual memory");
|
||||
return pt;
|
||||
}
|
||||
|
||||
|
@ -539,4 +539,18 @@ int checksum_md5_xinfo_cloner(void *old_data, void **new_data, int flag);
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
void *iso_alloc_mem(size_t size, size_t count, int flag);
|
||||
|
||||
#define LIBISO_ALLOC_MEM(pt, typ, count) { \
|
||||
pt= (typ *) iso_alloc_mem(sizeof(typ), (size_t) (count), 0); \
|
||||
if(pt == NULL) { \
|
||||
ret= -1; goto ex; \
|
||||
} }
|
||||
|
||||
#define LIBISO_FREE_MEM(pt) { \
|
||||
if(pt != NULL) \
|
||||
free((char *) pt); \
|
||||
}
|
||||
|
||||
|
||||
#endif /*LIBISO_UTIL_H_*/
|
||||
|
Loading…
Reference in New Issue
Block a user