else return a;
}
-/* Malloc with automatic error */
-#define MALLOC_NULL( var, type ) do { var = (type*)malloc( sizeof( type) ); \
- if( !var ) return NULL; } while(0)
-
+/* Free and set set the variable to NULL */
#define FREENULL(a) do { free( a ); a = NULL; } while(0)
#define EMPTY_STR(str) (!str || !*str)
stats_TimerStart( p_input, psz_timer_name,
STATS_TIMER_INPUT_LAUNCHING );
- MALLOC_NULL( p_input->p, input_thread_private_t );
- memset( p_input->p, 0, sizeof( input_thread_private_t ) );
+ p_input->p = calloc( 1, sizeof( input_thread_private_t ) );
+ if( !p_input->p )
+ return NULL;
/* One "randomly" selected input thread is responsible for computing
* the global stats. Check if there is already someone doing this */
msg_context_t *p_ctx = vlc_threadvar_get( &msg_context );
if( p_ctx == NULL )
{
- MALLOC_NULL( p_ctx, msg_context_t );
+ p_ctx = malloc( sizeof( msg_context_t ) );
+ if( !p_ctx )
+ return NULL;
p_ctx->psz_message = NULL;
vlc_threadvar_set( &msg_context, p_ctx );
}