From: RĂ©mi Denis-Courmont Date: Wed, 27 Jan 2010 18:26:01 +0000 (+0200) Subject: vlc_object_create: remove legacy support for negative sizes X-Git-Tag: 1.1.0-ff~813 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=66852fb38b7e4848cee9cd135db23284a3b99d77;p=vlc vlc_object_create: remove legacy support for negative sizes --- diff --git a/include/vlc_objects.h b/include/vlc_objects.h index 17e7cd964d..d58d2ee156 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -65,7 +65,7 @@ struct vlc_object_t /***************************************************************************** * Prototypes *****************************************************************************/ -VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) ) LIBVLC_MALLOC LIBVLC_USED; +VLC_EXPORT( void *, vlc_object_create, ( vlc_object_t *, size_t ) ) LIBVLC_MALLOC LIBVLC_USED; VLC_EXPORT( void, __vlc_object_set_destructor, ( vlc_object_t *, vlc_destructor_t ) ); VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) ); @@ -86,8 +86,7 @@ VLC_EXPORT( char *, vlc_object_get_name, ( const vlc_object_t * ) ) LIBVLC_USED; /**}@*/ -#define vlc_object_create(a,b) \ - __vlc_object_create( VLC_OBJECT(a), b ) +#define vlc_object_create(a,b) vlc_object_create( VLC_OBJECT(a), b ) #define vlc_object_set_destructor(a,b) \ __vlc_object_set_destructor( VLC_OBJECT(a), b ) diff --git a/src/libvlccore.sym b/src/libvlccore.sym index efa2ac5b5e..55caa496bd 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -531,7 +531,7 @@ vlc_mutex_lock vlc_mutex_trylock vlc_mutex_unlock __vlc_object_attach -__vlc_object_create +vlc_object_create __vlc_object_detach __vlc_object_find vlc_object_find_name diff --git a/src/misc/objects.c b/src/misc/objects.c index 0e92c926b6..d5c98c00f6 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -174,39 +174,17 @@ void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size, return p_new; } - +#undef vlc_object_create /** * Allocates and initializes a vlc object. * - * @param i_type known object type (all of them are negative integer values), - * or object byte size (always positive). + * @param i_size object byte size * * @return the new object, or NULL on error. */ -void * __vlc_object_create( vlc_object_t *p_this, int i_type ) +void *vlc_object_create( vlc_object_t *p_this, size_t i_size ) { - const char * psz_type; - size_t i_size; - - switch( i_type ) - { - case VLC_OBJECT_DECODER: - i_size = sizeof(decoder_t); - psz_type = "decoder"; - break; - case VLC_OBJECT_AOUT: - i_size = sizeof(aout_instance_t); - psz_type = "audio output"; - break; - default: - assert( i_type > 0 ); /* unknown type?! */ - i_size = i_type; - i_type = VLC_OBJECT_GENERIC; - psz_type = "generic"; - break; - } - - return vlc_custom_create( p_this, i_size, i_type, psz_type ); + return vlc_custom_create( p_this, i_size, VLC_OBJECT_GENERIC, "generic" ); }