Commit cf4676c1 authored by Thomas Guillem's avatar Thomas Guillem

core: rename vlc_*alloc to vlc_obj_*alloc

In order to avoid confusion with future vlc_alloc.
parent 7167b234
...@@ -67,8 +67,8 @@ VLC_API char *vlc_object_get_name( const vlc_object_t * ) VLC_USED; ...@@ -67,8 +67,8 @@ VLC_API char *vlc_object_get_name( const vlc_object_t * ) VLC_USED;
#define vlc_list_children(a) \ #define vlc_list_children(a) \
vlc_list_children( VLC_OBJECT(a) ) vlc_list_children( VLC_OBJECT(a) )
VLC_API VLC_MALLOC void *vlc_malloc(vlc_object_t *, size_t); VLC_API VLC_MALLOC void *vlc_obj_alloc(vlc_object_t *, size_t, size_t);
VLC_API VLC_MALLOC void *vlc_calloc(vlc_object_t *, size_t, size_t); VLC_API VLC_MALLOC void *vlc_obj_calloc(vlc_object_t *, size_t, size_t);
VLC_API void vlc_free(vlc_object_t *, void *); VLC_API void vlc_obj_free(vlc_object_t *, void *);
/** @} */ /** @} */
...@@ -341,7 +341,7 @@ static uint16_t channel_maps[] = { ...@@ -341,7 +341,7 @@ static uint16_t channel_maps[] = {
static int Open (vlc_object_t *obj) static int Open (vlc_object_t *obj)
{ {
demux_t *demux = (demux_t *)obj; demux_t *demux = (demux_t *)obj;
demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); demux_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -73,7 +73,7 @@ static int Open(vlc_object_t *object) ...@@ -73,7 +73,7 @@ static int Open(vlc_object_t *object)
if (!input) if (!input)
return VLC_EGENERIC; return VLC_EGENERIC;
access_sys_t *sys = vlc_malloc(object, sizeof (*sys)); access_sys_t *sys = vlc_obj_alloc(object, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -83,7 +83,7 @@ struct sout_access_out_sys_t { ...@@ -83,7 +83,7 @@ struct sout_access_out_sys_t {
int OpenAvio(vlc_object_t *object) int OpenAvio(vlc_object_t *object)
{ {
stream_t *access = (stream_t*)object; stream_t *access = (stream_t*)object;
access_sys_t *sys = vlc_malloc(object, sizeof(*sys)); access_sys_t *sys = vlc_obj_alloc(object, 1, sizeof(*sys));
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
sys->context = NULL; sys->context = NULL;
...@@ -159,7 +159,7 @@ int OutOpenAvio(vlc_object_t *object) ...@@ -159,7 +159,7 @@ int OutOpenAvio(vlc_object_t *object)
config_ChainParse( access, "sout-avio-", ppsz_sout_options, access->p_cfg ); config_ChainParse( access, "sout-avio-", ppsz_sout_options, access->p_cfg );
sout_access_out_sys_t *sys = vlc_malloc(object, sizeof(*sys)); sout_access_out_sys_t *sys = vlc_obj_alloc(object, 1, sizeof(*sys));
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
sys->context = NULL; sys->context = NULL;
......
...@@ -653,7 +653,7 @@ static int blurayOpen(vlc_object_t *object) ...@@ -653,7 +653,7 @@ static int blurayOpen(vlc_object_t *object)
} }
/* */ /* */
p_demux->p_sys = p_sys = vlc_calloc(object, 1, sizeof(*p_sys)); p_demux->p_sys = p_sys = vlc_obj_calloc(object, 1, sizeof(*p_sys));
if (unlikely(!p_sys)) if (unlikely(!p_sys))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -225,7 +225,7 @@ static int DemuxOpen(vlc_object_t *obj) ...@@ -225,7 +225,7 @@ static int DemuxOpen(vlc_object_t *obj)
if (track == 0 /* Whole disc -> use access plugin */) if (track == 0 /* Whole disc -> use access plugin */)
goto error; goto error;
demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); demux_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
goto error; goto error;
...@@ -619,7 +619,7 @@ static int AccessOpen(vlc_object_t *obj) ...@@ -619,7 +619,7 @@ static int AccessOpen(vlc_object_t *obj)
return VLC_EGENERIC; return VLC_EGENERIC;
} }
access_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); access_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
{ {
ioctl_Close(obj, dev); ioctl_Close(obj, dev);
......
...@@ -188,7 +188,7 @@ static int Open(vlc_object_t *obj) ...@@ -188,7 +188,7 @@ static int Open(vlc_object_t *obj)
if (list == NULL) if (list == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
access_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); access_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
{ {
free(list); free(list);
......
...@@ -176,7 +176,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -176,7 +176,7 @@ static int Open( vlc_object_t *p_this )
p_demux->info.i_title = 0; p_demux->info.i_title = 0;
p_demux->info.i_seekpoint = 0; p_demux->info.i_seekpoint = 0;
p_demux->p_sys = p_sys = vlc_calloc( p_this, 1, sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = vlc_obj_calloc( p_this, 1, sizeof( demux_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -53,7 +53,7 @@ struct access_sys_t ...@@ -53,7 +53,7 @@ struct access_sys_t
*****************************************************************************/ *****************************************************************************/
int DirInit (stream_t *access, DIR *dir) int DirInit (stream_t *access, DIR *dir)
{ {
access_sys_t *sys = vlc_malloc(VLC_OBJECT(access), sizeof (*sys)); access_sys_t *sys = vlc_obj_alloc(VLC_OBJECT(access), 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
goto error; goto error;
......
...@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this )
/* Set up p_access */ /* Set up p_access */
ACCESS_SET_CALLBACKS( NULL, Block, Control, NULL ); ACCESS_SET_CALLBACKS( NULL, Block, Control, NULL );
p_access->p_sys = p_sys = vlc_malloc( p_this, sizeof( access_sys_t ) ); p_access->p_sys = p_sys = vlc_obj_alloc( p_this, 1, sizeof( access_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -205,7 +205,7 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -205,7 +205,7 @@ int FileOpen( vlc_object_t *p_this )
#endif #endif
} }
access_sys_t *p_sys = vlc_malloc(p_this, sizeof (*p_sys)); access_sys_t *p_sys = vlc_obj_alloc(p_this, 1, sizeof (*p_sys));
if (unlikely(p_sys == NULL)) if (unlikely(p_sys == NULL))
goto error; goto error;
p_access->pf_read = Read; p_access->pf_read = Read;
......
...@@ -692,7 +692,7 @@ static int InOpen( vlc_object_t *p_this ) ...@@ -692,7 +692,7 @@ static int InOpen( vlc_object_t *p_this )
bool b_directory; bool b_directory;
/* Init p_access */ /* Init p_access */
p_sys = p_access->p_sys = (access_sys_t*)vlc_calloc( p_this, 1, sizeof( access_sys_t ) ); p_sys = p_access->p_sys = (access_sys_t*)vlc_obj_calloc( p_this, 1, sizeof( access_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys->data = NULL; p_sys->data = NULL;
...@@ -778,7 +778,7 @@ static int OutOpen( vlc_object_t *p_this ) ...@@ -778,7 +778,7 @@ static int OutOpen( vlc_object_t *p_this )
sout_access_out_t *p_access = (sout_access_out_t *)p_this; sout_access_out_t *p_access = (sout_access_out_t *)p_this;
access_sys_t *p_sys; access_sys_t *p_sys;
p_sys = vlc_calloc( p_this, 1, sizeof( *p_sys ) ); p_sys = vlc_obj_calloc( p_this, 1, sizeof( *p_sys ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -156,7 +156,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -156,7 +156,7 @@ static int Open( vlc_object_t *p_this )
int ret = VLC_EGENERIC; int ret = VLC_EGENERIC;
vlc_credential credential; vlc_credential credential;
access_sys_t *p_sys = vlc_malloc( p_this, sizeof(*p_sys) ); access_sys_t *p_sys = vlc_obj_alloc( p_this, 1, sizeof(*p_sys) );
if( unlikely(p_sys == NULL) ) if( unlikely(p_sys == NULL) )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -184,7 +184,7 @@ nop: ...@@ -184,7 +184,7 @@ nop:
if( length == 0 ) if( length == 0 )
goto nop; /* avoid division by zero */ goto nop; /* avoid division by zero */
demux_sys_t *p_sys = vlc_malloc( p_this, sizeof( *p_sys ) ); demux_sys_t *p_sys = vlc_obj_alloc( p_this, 1, sizeof( *p_sys ) );
if( p_sys == NULL ) if( p_sys == NULL )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -112,7 +112,7 @@ static int Open(vlc_object_t *object) ...@@ -112,7 +112,7 @@ static int Open(vlc_object_t *object)
{ {
stream_t *access = (stream_t *)object; stream_t *access = (stream_t *)object;
access_sys_t *sys = vlc_malloc(object, sizeof (*sys)); access_sys_t *sys = vlc_obj_alloc(object, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -240,7 +240,7 @@ static int OpenCommon(vlc_object_t *object, imem_sys_t **sys_ptr, const char *ps ...@@ -240,7 +240,7 @@ static int OpenCommon(vlc_object_t *object, imem_sys_t **sys_ptr, const char *ps
char *tmp; char *tmp;
/* */ /* */
imem_sys_t *sys = vlc_calloc(object, 1, sizeof(*sys)); imem_sys_t *sys = vlc_obj_calloc(object, 1, sizeof(*sys));
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -131,7 +131,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -131,7 +131,7 @@ static int Open( vlc_object_t *p_this )
p_demux->pf_control = Control; p_demux->pf_control = Control;
/* Allocate structure */ /* Allocate structure */
p_demux->p_sys = p_sys = vlc_calloc( p_this, 1, sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = vlc_obj_calloc( p_this, 1, sizeof( demux_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -621,7 +621,7 @@ static int ...@@ -621,7 +621,7 @@ static int
Open(vlc_object_t *p_obj) Open(vlc_object_t *p_obj)
{ {
stream_t *p_access = (stream_t *)p_obj; stream_t *p_access = (stream_t *)p_obj;
access_sys_t *p_sys = vlc_calloc(p_obj, 1, sizeof (*p_sys)); access_sys_t *p_sys = vlc_obj_calloc(p_obj, 1, sizeof (*p_sys));
if (unlikely(p_sys == NULL)) if (unlikely(p_sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -160,7 +160,7 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -160,7 +160,7 @@ static int DemuxOpen( vlc_object_t *p_this )
p_demux->info.i_title = 0; p_demux->info.i_title = 0;
p_demux->info.i_seekpoint = 0; p_demux->info.i_seekpoint = 0;
p_demux->p_sys = p_sys = vlc_calloc( p_this, 1, sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = vlc_obj_calloc( p_this, 1, sizeof( demux_sys_t ) );
if( p_sys == NULL ) return VLC_ENOMEM; if( p_sys == NULL ) return VLC_ENOMEM;
p_sys->i_sample_rate = var_InheritInteger( p_demux, CFG_PREFIX "samplerate" ); p_sys->i_sample_rate = var_InheritInteger( p_demux, CFG_PREFIX "samplerate" );
......
...@@ -255,7 +255,7 @@ static int Open(vlc_object_t *obj) ...@@ -255,7 +255,7 @@ static int Open(vlc_object_t *obj)
{ {
demux_t *demux = (demux_t *)obj; demux_t *demux = (demux_t *)obj;
demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); demux_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -425,7 +425,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -425,7 +425,7 @@ static int Open( vlc_object_t *p_this )
demux_t *p_demux = (demux_t*)p_this; demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys; demux_sys_t *p_sys;
p_sys = vlc_calloc( p_this, 1, sizeof(demux_sys_t) ); p_sys = vlc_obj_calloc( p_this, 1, sizeof(demux_sys_t) );
if( !p_sys ) return VLC_ENOMEM; if( !p_sys ) return VLC_ENOMEM;
p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" ); p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" );
......
...@@ -626,7 +626,7 @@ static int satip_open(vlc_object_t *obj) ...@@ -626,7 +626,7 @@ static int satip_open(vlc_object_t *obj)
bool multicast = var_InheritBool(access, "satip-multicast"); bool multicast = var_InheritBool(access, "satip-multicast");
access->p_sys = sys = vlc_calloc(obj, 1, sizeof(*sys)); access->p_sys = sys = vlc_obj_calloc(obj, 1, sizeof(*sys));
if (sys == NULL) if (sys == NULL)
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -55,7 +55,7 @@ static int Open (vlc_object_t *obj) ...@@ -55,7 +55,7 @@ static int Open (vlc_object_t *obj)
stream_t *access = (stream_t *)obj; stream_t *access = (stream_t *)obj;
size_t len = strlen (access->psz_location); size_t len = strlen (access->psz_location);
access_sys_t *sys = vlc_malloc(obj, sizeof(*sys) + len); access_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof(*sys) + len);
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -246,7 +246,7 @@ static int Open( vlc_object_t* p_this ) ...@@ -246,7 +246,7 @@ static int Open( vlc_object_t* p_this )
if( !p_access->psz_location ) if( !p_access->psz_location )
return VLC_EGENERIC; return VLC_EGENERIC;
p_sys = p_access->p_sys = vlc_calloc( p_this, 1, sizeof( access_sys_t ) ); p_sys = p_access->p_sys = vlc_obj_calloc( p_this, 1, sizeof( access_sys_t ) );
if( !p_sys ) return VLC_ENOMEM; if( !p_sys ) return VLC_ENOMEM;
p_sys->i_socket = -1; p_sys->i_socket = -1;
......
...@@ -138,7 +138,7 @@ struct demux_sys_t ...@@ -138,7 +138,7 @@ struct demux_sys_t
static int Open (vlc_object_t *obj) static int Open (vlc_object_t *obj)
{ {
demux_t *demux = (demux_t *)obj; demux_t *demux = (demux_t *)obj;
demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); demux_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -226,7 +226,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -226,7 +226,7 @@ static int Open( vlc_object_t *p_this )
/* Init p_access */ /* Init p_access */
p_sys = p_sys =
p_access->p_sys = vlc_calloc( p_this, 1, sizeof( access_sys_t ) ); p_access->p_sys = vlc_obj_calloc( p_this, 1, sizeof( access_sys_t ) );
if( !p_sys ) if( !p_sys )
{ {
free( psz_uri ); free( psz_uri );
......
...@@ -173,7 +173,7 @@ static int Open(vlc_object_t *p_this) ...@@ -173,7 +173,7 @@ static int Open(vlc_object_t *p_this)
}, *res = NULL; }, *res = NULL;
int stat; int stat;
p_sys = vlc_malloc( p_this, sizeof( *p_sys ) ); p_sys = vlc_obj_alloc( p_this, 1, sizeof( *p_sys ) );
if( unlikely( p_sys == NULL ) ) if( unlikely( p_sys == NULL ) )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -167,7 +167,7 @@ static int Control (demux_t *demux, int query, va_list args) ...@@ -167,7 +167,7 @@ static int Control (demux_t *demux, int query, va_list args)
static int Open (vlc_object_t *obj) static int Open (vlc_object_t *obj)
{ {
demux_t *demux = (demux_t *)obj; demux_t *demux = (demux_t *)obj;
demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); demux_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -100,7 +100,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -100,7 +100,7 @@ static int Open( vlc_object_t *p_this )
if( p_access->b_preparsing ) if( p_access->b_preparsing )
return VLC_EGENERIC; return VLC_EGENERIC;
sys = vlc_malloc( p_this, sizeof( *sys ) ); sys = vlc_obj_alloc( p_this, 1, sizeof( *sys ) );
if( unlikely( sys == NULL ) ) if( unlikely( sys == NULL ) )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -188,7 +188,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -188,7 +188,7 @@ static int Open( vlc_object_t *p_this )
!S_ISDIR( st.st_mode ) ) !S_ISDIR( st.st_mode ) )
return VLC_EGENERIC; return VLC_EGENERIC;
access_sys_t *p_sys = vlc_calloc( p_this, 1, sizeof( *p_sys ) ); access_sys_t *p_sys = vlc_obj_calloc( p_this, 1, sizeof( *p_sys ) );
if( unlikely(p_sys == NULL) ) if( unlikely(p_sys == NULL) )
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -385,7 +385,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -385,7 +385,7 @@ static int Open( vlc_object_t *p_this )
demux_t *p_demux = (demux_t*)p_this; demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys; demux_sys_t *p_sys;
p_sys = vlc_calloc( p_this, 1, sizeof(demux_sys_t) ); p_sys = vlc_obj_calloc( p_this, 1, sizeof(demux_sys_t) );
if( !p_sys ) return VLC_ENOMEM; if( !p_sys ) return VLC_ENOMEM;
p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" ); p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" );
......
...@@ -387,7 +387,7 @@ static int Open(vlc_object_t *obj) ...@@ -387,7 +387,7 @@ static int Open(vlc_object_t *obj)
if (demux->psz_location != NULL && *demux->psz_location != '\0') if (demux->psz_location != NULL && *demux->psz_location != '\0')
return VLC_EGENERIC; /* TODO non-default device */ return VLC_EGENERIC; /* TODO non-default device */
demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys)); demux_sys_t *sys = vlc_obj_alloc(obj, 1, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -75,8 +75,8 @@ static int Create( vlc_object_t *p_this ) ...@@ -75,8 +75,8 @@ static int Create( vlc_object_t *p_this )
if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420_10L) if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420_10L)
return -1; return -1;
filter_sys_t *p_sys = vlc_malloc( VLC_OBJECT( p_filter ), filter_sys_t *p_sys = vlc_obj_alloc( VLC_OBJECT( p_filter ), 1,
sizeof(filter_sys_t) ); sizeof(filter_sys_t) );
if (!p_sys) if (!p_sys)
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -89,8 +89,8 @@ static int Create( vlc_object_t *p_this ) ...@@ -89,8 +89,8 @@ static int Create( vlc_object_t *p_this )
return -1; return -1;
} }
filter_sys_t *p_sys = vlc_malloc( VLC_OBJECT( p_filter ), filter_sys_t *p_sys = vlc_obj_alloc( VLC_OBJECT( p_filter ), 1,
sizeof(filter_sys_t) ); sizeof(filter_sys_t) );
if (!p_sys) if (!p_sys)
return VLC_ENOMEM; return VLC_ENOMEM;
......
...@@ -146,7 +146,7 @@ static int Open(vlc_object_t *this) ...@@ -146,7 +146,7 @@ static int Open(vlc_object_t *this)
if (vout_display_IsWindowed(vd)) if (vout_display_IsWindowed(vd))
return VLC_EGENERIC; return VLC_EGENERIC;
vout_display_sys_t *sys = vlc_calloc (this, 1, sizeof(*sys)); vout_display_sys_t *sys = vlc_obj_calloc (this, 1, sizeof(*sys));
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -183,7 +183,7 @@ static int Open(vlc_object_t *this) ...@@ -183,7 +183,7 @@ static int Open(vlc_object_t *this)
goto bailout; goto bailout;
struct gl_sys *glsys = sys->gl->sys = struct gl_sys *glsys = sys->gl->sys =
vlc_malloc(this, sizeof(struct gl_sys)); vlc_obj_alloc(this, 1, sizeof(struct gl_sys));
if (unlikely(!sys->gl->sys)) if (unlikely(!sys->gl->sys))
goto bailout; goto bailout;
glsys->glESView = sys->glESView; glsys->glESView = sys->glESView;
......
...@@ -275,9 +275,9 @@ vlc_LogSet ...@@ -275,9 +275,9 @@ vlc_LogSet
vlc_vaLog vlc_vaLog
vlc_strerror vlc_strerror
vlc_strerror_c vlc_strerror_c
vlc_malloc vlc_obj_alloc
vlc_calloc vlc_obj_calloc
vlc_free vlc_obj_free
msleep msleep
mwait mwait
net_Accept net_Accept
......
...@@ -133,15 +133,8 @@ static bool ptrcmp(void *a, void *b) ...@@ -133,15 +133,8 @@ static bool ptrcmp(void *a, void *b)
return a == b; return a == b;
} }
void *vlc_malloc(vlc_object_t *obj, size_t size) static void *vlc_obj_alloc_common(vlc_object_t *obj, size_t nmemb, size_t size,
{ bool do_memset)
void *ptr = vlc_objres_new(size, dummy_release);
if (likely(ptr != NULL))
vlc_objres_push(obj, ptr);
return ptr;
}
void *vlc_calloc(vlc_object_t *obj, size_t nmemb, size_t size)
{ {
size_t tabsize = nmemb * size; size_t tabsize = nmemb * size;
...@@ -154,13 +147,24 @@ void *vlc_calloc(vlc_object_t *obj, size_t nmemb, size_t size) ...@@ -154,13 +147,24 @@ void *vlc_calloc(vlc_object_t *obj, size_t nmemb, size_t size)
void *ptr = vlc_objres_new(tabsize, dummy_release); void *ptr = vlc_objres_new(tabsize, dummy_release);
if (likely(ptr != NULL)) if (likely(ptr != NULL))
{ {
memset(ptr, 0, tabsize); if (do_memset)
memset(ptr, 0, tabsize);
vlc_objres_push(obj, ptr); vlc_objres_push(obj, ptr);
} }
return ptr; return ptr;
} }
void vlc_free(vlc_object_t *obj, void *ptr) void *vlc_obj_alloc(vlc_object_t *obj, size_t nmemb, size_t size)
{
return vlc_obj_alloc_common(obj, nmemb, size, false);
}
void *vlc_obj_calloc(vlc_object_t *obj, size_t nmemb, size_t size)
{
return vlc_obj_alloc_common(obj, nmemb, size, true);
}
void vlc_obj_free(vlc_object_t *obj, void *ptr)
{ {
vlc_objres_remove(obj, ptr, ptrcmp); vlc_objres_remove(obj, ptr, ptrcmp);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment