if( !var ) return NULL; } while(0)
#define MALLOC_ERR( var, type ) do { var = (type*)malloc( sizeof( type) ); \
if( !var ) return VLC_ENOMEM; } while(0)
-#define MALLOC_GOTOERR( var, type ) do { var = (type*)malloc( sizeof( type) ); \
- if( !var ) goto error; } while(0)
-#define DECMALLOC_VOID( var, type ) type* var = (type*)malloc( sizeof(type) );\
- if( !var ) return;
-#define DECMALLOC_ERR( var, type ) type* var = (type*)malloc( sizeof(type) );\
- if( !var ) return VLC_ENOMEM;
-#define DECMALLOC_NULL( var, type ) type* var = (type*)malloc( sizeof(type) );\
- if( !var ) return NULL;
#define FREENULL(a) do { free( a ); a = NULL; } while(0)
{
libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
- DECMALLOC_NULL( p_input, input_item_t );
+ input_item_t* p_input = malloc( sizeof(input_item_t ) );
+ if( !p_input )
+ return NULL;
input_item_Init( p_obj, p_input );
vlc_gc_init( p_input, input_item_Destroy );
static int DialogSend( vlc_object_t *, interaction_dialog_t * );
#define DIALOG_INIT( type ) \
- DECMALLOC_ERR( p_new, interaction_dialog_t ); \
- memset( p_new, 0, sizeof( interaction_dialog_t ) ); \
+ interaction_dialog_t* p_new = calloc( 1, sizeof( interaction_dialog_t ) ); \
+ if( !p_new ) return VLC_EGENERIC; \
p_new->b_cancelled = false; \
- p_new->i_status = NEW_DIALOG; \
- p_new->i_flags = 0; \
- p_new->i_type = INTERACT_DIALOG_##type; \
- p_new->psz_returned[0] = NULL; \
+ p_new->i_status = NEW_DIALOG; \
+ p_new->i_flags = 0; \
+ p_new->i_type = INTERACT_DIALOG_##type; \
+ p_new->psz_returned[0] = NULL; \
p_new->psz_returned[1] = NULL
#define FORMAT_DESC \
playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
input_item_t *p_input )
{
- DECMALLOC_NULL( p_item, playlist_item_t );
+ playlist_item_t* p_item = malloc( sizeof( playlist_item_t ) );
+ if( !p_item )
+ return NULL;
assert( p_input );