[vlc-devel] [PATCH 1/2] objres: rename vlc_*alloc to vlc_obj_*alloc

Thomas Guillem thomas at gllm.fr
Sat Nov 11 16:54:51 CET 2017


In order to avoid confusion with vlc_alloc.
---
 include/vlc_objects.h               |  6 +++---
 modules/access/alsa.c               |  2 +-
 modules/access/attachment.c         |  2 +-
 modules/access/avio.c               |  4 ++--
 modules/access/bluray.c             |  2 +-
 modules/access/cdda.c               |  4 ++--
 modules/access/concat.c             |  2 +-
 modules/access/dc1394.c             |  2 +-
 modules/access/directory.c          |  2 +-
 modules/access/dv.c                 |  2 +-
 modules/access/file.c               |  2 +-
 modules/access/ftp.c                |  4 ++--
 modules/access/http.c               |  2 +-
 modules/access/idummy.c             |  2 +-
 modules/access/imem-access.c        |  2 +-
 modules/access/imem.c               |  2 +-
 modules/access/jack.c               |  2 +-
 modules/access/nfs.c                |  2 +-
 modules/access/oss.c                |  2 +-
 modules/access/pulse.c              |  2 +-
 modules/access/rdp.c                |  2 +-
 modules/access/satip.c              |  2 +-
 modules/access/sdp.c                |  2 +-
 modules/access/sftp.c               |  2 +-
 modules/access/shm.c                |  2 +-
 modules/access/smb.c                |  2 +-
 modules/access/srt.c                |  2 +-
 modules/access/timecode.c           |  2 +-
 modules/access/udp.c                |  2 +-
 modules/access/vdr.c                |  2 +-
 modules/access/vnc.c                |  2 +-
 modules/access/wasapi.c             |  2 +-
 modules/video_chroma/i420_10_p010.c |  4 ++--
 modules/video_chroma/i420_nv12.c    |  4 ++--
 modules/video_output/ios.m          |  4 ++--
 src/libvlccore.sym                  |  6 +++---
 src/misc/objres.c                   | 26 +++++++++++++++-----------
 37 files changed, 61 insertions(+), 57 deletions(-)

diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index 171af9cf23..aba548fe4b 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -67,8 +67,8 @@ VLC_API char *vlc_object_get_name( const vlc_object_t * ) VLC_USED;
 #define vlc_list_children(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_calloc(vlc_object_t *, size_t, size_t);
-VLC_API void vlc_free(vlc_object_t *, void *);
+VLC_API VLC_MALLOC void *vlc_obj_alloc(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_obj_free(vlc_object_t *, void *);
 
 /** @} */
diff --git a/modules/access/alsa.c b/modules/access/alsa.c
index 8985a0a1ab..3a27b32938 100644
--- a/modules/access/alsa.c
+++ b/modules/access/alsa.c
@@ -341,7 +341,7 @@ static uint16_t channel_maps[] = {
 static int Open (vlc_object_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))
         return VLC_ENOMEM;
 
diff --git a/modules/access/attachment.c b/modules/access/attachment.c
index 60166fafed..f9a03eb3f6 100644
--- a/modules/access/attachment.c
+++ b/modules/access/attachment.c
@@ -73,7 +73,7 @@ static int Open(vlc_object_t *object)
     if (!input)
         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))
         return VLC_ENOMEM;
 
diff --git a/modules/access/avio.c b/modules/access/avio.c
index 975d671d3f..7e27cbc6e5 100644
--- a/modules/access/avio.c
+++ b/modules/access/avio.c
@@ -83,7 +83,7 @@ struct sout_access_out_sys_t {
 int OpenAvio(vlc_object_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)
         return VLC_ENOMEM;
     sys->context = NULL;
@@ -159,7 +159,7 @@ int OutOpenAvio(vlc_object_t *object)
 
     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)
         return VLC_ENOMEM;
     sys->context = NULL;
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 1f2f952f34..7f45c66e02 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -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))
         return VLC_ENOMEM;
 
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index 061ad4bf48..08ed2e8c3b 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -225,7 +225,7 @@ static int DemuxOpen(vlc_object_t *obj)
     if (track == 0 /* Whole disc -> use access plugin */)
         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))
         goto error;
 
@@ -619,7 +619,7 @@ static int AccessOpen(vlc_object_t *obj)
         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))
     {
         ioctl_Close(obj, dev);
diff --git a/modules/access/concat.c b/modules/access/concat.c
index 0701c8029b..998bfb7568 100644
--- a/modules/access/concat.c
+++ b/modules/access/concat.c
@@ -188,7 +188,7 @@ static int Open(vlc_object_t *obj)
     if (list == NULL)
         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))
     {
         free(list);
diff --git a/modules/access/dc1394.c b/modules/access/dc1394.c
index 00be5417f7..c958254d0e 100644
--- a/modules/access/dc1394.c
+++ b/modules/access/dc1394.c
@@ -176,7 +176,7 @@ static int Open( vlc_object_t *p_this )
     p_demux->info.i_title = 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 )
         return VLC_ENOMEM;
 
diff --git a/modules/access/directory.c b/modules/access/directory.c
index b8067140cf..e6d2f11587 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -53,7 +53,7 @@ struct access_sys_t
  *****************************************************************************/
 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))
         goto error;
 
diff --git a/modules/access/dv.c b/modules/access/dv.c
index 3285c2a09f..0037ba2989 100644
--- a/modules/access/dv.c
+++ b/modules/access/dv.c
@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this )
     /* Set up p_access */
     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 )
         return VLC_EGENERIC;
 
diff --git a/modules/access/file.c b/modules/access/file.c
index 938b1369e8..bb5e5df71c 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -205,7 +205,7 @@ int FileOpen( vlc_object_t *p_this )
 #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))
         goto error;
     p_access->pf_read = Read;
diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index 93864b8fd0..79387772a3 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -692,7 +692,7 @@ static int InOpen( vlc_object_t *p_this )
     bool          b_directory;
 
     /* 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 )
         return VLC_ENOMEM;
     p_sys->data = NULL;
@@ -778,7 +778,7 @@ static int OutOpen( vlc_object_t *p_this )
     sout_access_out_t *p_access = (sout_access_out_t *)p_this;
     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 )
         return VLC_ENOMEM;
 
diff --git a/modules/access/http.c b/modules/access/http.c
index fe909d2081..5e50f4cce5 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -156,7 +156,7 @@ static int Open( vlc_object_t *p_this )
     int ret = VLC_EGENERIC;
     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) )
         return VLC_ENOMEM;
 
diff --git a/modules/access/idummy.c b/modules/access/idummy.c
index 32a9299223..2e197d7277 100644
--- a/modules/access/idummy.c
+++ b/modules/access/idummy.c
@@ -184,7 +184,7 @@ nop:
         if( length == 0 )
             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 )
             return VLC_ENOMEM;
 
diff --git a/modules/access/imem-access.c b/modules/access/imem-access.c
index da544c3de4..e37ed25d4f 100644
--- a/modules/access/imem-access.c
+++ b/modules/access/imem-access.c
@@ -112,7 +112,7 @@ static int Open(vlc_object_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))
         return VLC_ENOMEM;
 
diff --git a/modules/access/imem.c b/modules/access/imem.c
index 3496f8a1a9..ba7c1ea1e0 100644
--- a/modules/access/imem.c
+++ b/modules/access/imem.c
@@ -240,7 +240,7 @@ static int OpenCommon(vlc_object_t *object, imem_sys_t **sys_ptr, const char *ps
     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)
         return VLC_ENOMEM;
 
diff --git a/modules/access/jack.c b/modules/access/jack.c
index be1afd9806..3ef6028719 100644
--- a/modules/access/jack.c
+++ b/modules/access/jack.c
@@ -131,7 +131,7 @@ static int Open( vlc_object_t *p_this )
     p_demux->pf_control = Control;
 
     /* 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 )
         return VLC_ENOMEM;
 
diff --git a/modules/access/nfs.c b/modules/access/nfs.c
index 3d415e0f5f..f94b6cc746 100644
--- a/modules/access/nfs.c
+++ b/modules/access/nfs.c
@@ -621,7 +621,7 @@ static int
 Open(vlc_object_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))
         return VLC_ENOMEM;
diff --git a/modules/access/oss.c b/modules/access/oss.c
index a6e291c42f..d50a23cdb0 100644
--- a/modules/access/oss.c
+++ b/modules/access/oss.c
@@ -160,7 +160,7 @@ static int DemuxOpen( vlc_object_t *p_this )
     p_demux->info.i_title = 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;
 
     p_sys->i_sample_rate = var_InheritInteger( p_demux, CFG_PREFIX "samplerate" );
diff --git a/modules/access/pulse.c b/modules/access/pulse.c
index e2a3006c4d..c57ba2517d 100644
--- a/modules/access/pulse.c
+++ b/modules/access/pulse.c
@@ -255,7 +255,7 @@ static int Open(vlc_object_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))
         return VLC_ENOMEM;
 
diff --git a/modules/access/rdp.c b/modules/access/rdp.c
index 78321452ce..2992090219 100644
--- a/modules/access/rdp.c
+++ b/modules/access/rdp.c
@@ -425,7 +425,7 @@ static int Open( vlc_object_t *p_this )
     demux_t      *p_demux = (demux_t*)p_this;
     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;
 
     p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" );
diff --git a/modules/access/satip.c b/modules/access/satip.c
index f012e4b729..1191671ab2 100644
--- a/modules/access/satip.c
+++ b/modules/access/satip.c
@@ -626,7 +626,7 @@ static int satip_open(vlc_object_t *obj)
 
     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)
         return VLC_ENOMEM;
 
diff --git a/modules/access/sdp.c b/modules/access/sdp.c
index aea2d5ba44..3e7b26ac39 100644
--- a/modules/access/sdp.c
+++ b/modules/access/sdp.c
@@ -55,7 +55,7 @@ static int Open (vlc_object_t *obj)
     stream_t *access = (stream_t *)obj;
     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))
         return VLC_ENOMEM;
 
diff --git a/modules/access/sftp.c b/modules/access/sftp.c
index ab3ac864c2..d8f9845bb5 100644
--- a/modules/access/sftp.c
+++ b/modules/access/sftp.c
@@ -246,7 +246,7 @@ static int Open( vlc_object_t* p_this )
     if( !p_access->psz_location )
         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;
 
     p_sys->i_socket = -1;
diff --git a/modules/access/shm.c b/modules/access/shm.c
index 2139b2ef85..b3ed030344 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -138,7 +138,7 @@ struct demux_sys_t
 static int Open (vlc_object_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))
         return VLC_ENOMEM;
 
diff --git a/modules/access/smb.c b/modules/access/smb.c
index 2f792a63bc..70c79c261d 100644
--- a/modules/access/smb.c
+++ b/modules/access/smb.c
@@ -226,7 +226,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Init p_access */
     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 )
     {
         free( psz_uri );
diff --git a/modules/access/srt.c b/modules/access/srt.c
index 3193b208aa..e4d89e5ce4 100644
--- a/modules/access/srt.c
+++ b/modules/access/srt.c
@@ -173,7 +173,7 @@ static int Open(vlc_object_t *p_this)
     }, *res = NULL;
     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 ) )
         return VLC_ENOMEM;
 
diff --git a/modules/access/timecode.c b/modules/access/timecode.c
index 735d267bcd..c26b7ceacf 100644
--- a/modules/access/timecode.c
+++ b/modules/access/timecode.c
@@ -167,7 +167,7 @@ static int Control (demux_t *demux, int query, va_list args)
 static int Open (vlc_object_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))
         return VLC_ENOMEM;
diff --git a/modules/access/udp.c b/modules/access/udp.c
index fba5042a45..9677f8279f 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -100,7 +100,7 @@ static int Open( vlc_object_t *p_this )
     if( p_access->b_preparsing )
         return VLC_EGENERIC;
 
-    sys = vlc_malloc( p_this, sizeof( *sys ) );
+    sys = vlc_obj_alloc( p_this, 1, sizeof( *sys ) );
     if( unlikely( sys == NULL ) )
         return VLC_ENOMEM;
 
diff --git a/modules/access/vdr.c b/modules/access/vdr.c
index d196177628..cd9ee7fea6 100644
--- a/modules/access/vdr.c
+++ b/modules/access/vdr.c
@@ -188,7 +188,7 @@ static int Open( vlc_object_t *p_this )
         !S_ISDIR( st.st_mode ) )
         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) )
         return VLC_ENOMEM;
diff --git a/modules/access/vnc.c b/modules/access/vnc.c
index eb08926c4b..3cd4ab642b 100644
--- a/modules/access/vnc.c
+++ b/modules/access/vnc.c
@@ -385,7 +385,7 @@ static int Open( vlc_object_t *p_this )
     demux_t      *p_demux = (demux_t*)p_this;
     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;
 
     p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" );
diff --git a/modules/access/wasapi.c b/modules/access/wasapi.c
index 77d985600c..0db2a22121 100644
--- a/modules/access/wasapi.c
+++ b/modules/access/wasapi.c
@@ -387,7 +387,7 @@ static int Open(vlc_object_t *obj)
     if (demux->psz_location != NULL && *demux->psz_location != '\0')
         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))
         return VLC_ENOMEM;
 
diff --git a/modules/video_chroma/i420_10_p010.c b/modules/video_chroma/i420_10_p010.c
index a7bb6df75f..cde4813aef 100644
--- a/modules/video_chroma/i420_10_p010.c
+++ b/modules/video_chroma/i420_10_p010.c
@@ -75,8 +75,8 @@ static int Create( vlc_object_t *p_this )
     if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420_10L)
         return -1;
 
-    filter_sys_t *p_sys = vlc_malloc( VLC_OBJECT( p_filter ),
-                                      sizeof(filter_sys_t) );
+    filter_sys_t *p_sys = vlc_obj_alloc( VLC_OBJECT( p_filter ), 1,
+                                         sizeof(filter_sys_t) );
     if (!p_sys)
          return VLC_ENOMEM;
 
diff --git a/modules/video_chroma/i420_nv12.c b/modules/video_chroma/i420_nv12.c
index 0fb574db3b..4a1a606a6c 100644
--- a/modules/video_chroma/i420_nv12.c
+++ b/modules/video_chroma/i420_nv12.c
@@ -89,8 +89,8 @@ static int Create( vlc_object_t *p_this )
             return -1;
     }
 
-    filter_sys_t *p_sys = vlc_malloc( VLC_OBJECT( p_filter ),
-                                      sizeof(filter_sys_t) );
+    filter_sys_t *p_sys = vlc_obj_alloc( VLC_OBJECT( p_filter ), 1,
+                                         sizeof(filter_sys_t) );
     if (!p_sys)
          return VLC_ENOMEM;
 
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 7a5e0615e8..0740c2624c 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -146,7 +146,7 @@ static int Open(vlc_object_t *this)
     if (vout_display_IsWindowed(vd))
         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)
         return VLC_ENOMEM;
@@ -183,7 +183,7 @@ static int Open(vlc_object_t *this)
             goto bailout;
 
         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))
             goto bailout;
         glsys->glESView = sys->glESView;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 539ddff8a8..7c99021ae4 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -275,9 +275,9 @@ vlc_LogSet
 vlc_vaLog
 vlc_strerror
 vlc_strerror_c
-vlc_malloc
-vlc_calloc
-vlc_free
+vlc_obj_alloc
+vlc_obj_calloc
+vlc_obj_free
 msleep
 mwait
 net_Accept
diff --git a/src/misc/objres.c b/src/misc/objres.c
index a594a5b49d..7645cc2274 100644
--- a/src/misc/objres.c
+++ b/src/misc/objres.c
@@ -133,15 +133,8 @@ static bool ptrcmp(void *a, void *b)
     return a == b;
 }
 
-void *vlc_malloc(vlc_object_t *obj, size_t size)
-{
-    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)
+static void *vlc_obj_alloc_common(vlc_object_t *obj, size_t nmemb, size_t size,
+                                  bool do_memset)
 {
     size_t tabsize = nmemb * 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);
     if (likely(ptr != NULL))
     {
-        memset(ptr, 0, tabsize);
+        if (do_memset)
+            memset(ptr, 0, tabsize);
         vlc_objres_push(obj, 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);
 }
-- 
2.11.0



More information about the vlc-devel mailing list