Leaner implementation of macro BURN_ALLOC_MEM

This commit is contained in:
Thomas Schmitt 2011-06-06 17:37:42 +00:00
parent 5f743b8030
commit aeff7957f2
3 changed files with 19 additions and 5 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.06.06.173021" #define Cdrskin_timestamP "2011.06.06.173611"

View File

@ -582,3 +582,18 @@ void burn_allow_drive_role_4(int allowed)
{ {
burn_drive_role_4_allowed = (allowed & 0xf); burn_drive_role_4_allowed = (allowed & 0xf);
} }
/* ts B10606 */
void *burn_alloc_mem(size_t size, size_t count, int flag)
{
void *pt;
pt = calloc(size, count);
if(pt == NULL)
libdax_msgs_submit(libdax_messenger, -1, 0x00000003,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Out of virtual memory", 0, 0);
return pt;
}

View File

@ -27,13 +27,12 @@ extern volatile int burn_builtin_triggered_action; /* burn_is_aborting() */
*/ */
int burn_init_catch_on_abort(int flag); int burn_init_catch_on_abort(int flag);
/* ts B10606 */
void *burn_alloc_mem(size_t size, size_t count, int flag);
#define BURN_ALLOC_MEM(pt, typ, count) { \ #define BURN_ALLOC_MEM(pt, typ, count) { \
pt= (typ *) calloc(1, (count)*sizeof(typ)); \ pt= (typ *) burn_alloc_mem(sizeof(typ), (size_t) (count), 0); \
if(pt == NULL) { \ if(pt == NULL) { \
libdax_msgs_submit(libdax_messenger, -1, 0x00000003, \
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, \
"Out of virtual memory", 0, 0); \
ret= -1; goto ex; \ ret= -1; goto ex; \
} } } }