p_a->info.i_seekpoint = 0;
}
-#define ACCESS_SET_CALLBACKS( read, block, control, seek ) \
- p_access->pf_read = read; \
- p_access->pf_block = block; \
- p_access->pf_control = control; \
- p_access->pf_seek = seek; \
-
-#define STANDARD_READ_ACCESS_INIT \
- access_InitFields( p_access ); \
- ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \
- MALLOC_ERR( p_access->p_sys, access_sys_t ); \
- p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) );
-
-#define STANDARD_BLOCK_ACCESS_INIT \
- access_InitFields( p_access ); \
- ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek ); \
- MALLOC_ERR( p_access->p_sys, access_sys_t ); \
- p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) );
+#define ACCESS_SET_CALLBACKS( read, block, control, seek ) \
+ p_access->pf_read = read; \
+ p_access->pf_block = block; \
+ p_access->pf_control = control; \
+ p_access->pf_seek = seek;
+
+#define STANDARD_READ_ACCESS_INIT \
+ access_InitFields( p_access ); \
+ ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \
+ p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t )); \
+ if( !p_sys ) return VLC_ENOMEM;
+
+#define STANDARD_BLOCK_ACCESS_INIT \
+ access_InitFields( p_access ); \
+ ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek ); \
+ p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) ); \
+ if( !p_sys ) return VLC_ENOMEM;
#endif
}
/* Malloc with automatic error */
-#define MALLOC_VOID( var, type ) do { var = (type*)malloc( sizeof( type) ); \
- if( !var ) return; } while(0)
#define MALLOC_NULL( var, type ) do { var = (type*)malloc( sizeof( type) ); \
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 FREENULL(a) do { free( a ); a = NULL; } while(0)
#define DEMUX_INIT_COMMON() do { \
p_demux->pf_control = Control; \
p_demux->pf_demux = Demux; \
- MALLOC_ERR( p_demux->p_sys, demux_sys_t ); \
+ p_demux->p_sys = malloc( sizeof( demux_sys_t ) ); \
+ if( !p_demux->p_sys ) return VLC_ENOMEM;\
memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); } while(0)
#define STANDARD_DEMUX_INIT_MSG( msg ) do { \