vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Tue Mar 29 20:39:20 2011 +0300| [7e8f1ce662ff4bfaef9566303be720d7bc90f88c] | committer: Rémi Denis-Courmont
Youpiiiiiiiiiiiiiiiiiiie! ... err, remove vlc_object_find() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7e8f1ce662ff4bfaef9566303be720d7bc90f88c --- include/vlc_objects.h | 4 -- modules/lua/libs/objects.c | 47 +------------------------ src/libvlccore.sym | 1 - src/misc/objects.c | 82 -------------------------------------------- 4 files changed, 1 insertions(+), 133 deletions(-) diff --git a/include/vlc_objects.h b/include/vlc_objects.h index e1ece31..d29dcef 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -64,7 +64,6 @@ struct vlc_object_t *****************************************************************************/ VLC_EXPORT( void *, vlc_object_create, ( vlc_object_t *, size_t ) ) LIBVLC_MALLOC LIBVLC_USED; VLC_EXPORT( void, vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) ); -VLC_EXPORT( void *, vlc_object_find, ( vlc_object_t *, int, int ) ) LIBVLC_USED LIBVLC_DEPRECATED; VLC_EXPORT( vlc_object_t *, vlc_object_find_name, ( vlc_object_t *, const char *, int ) ) LIBVLC_USED LIBVLC_DEPRECATED; VLC_EXPORT( void *, vlc_object_hold, ( vlc_object_t * ) ); VLC_EXPORT( void, vlc_object_release, ( vlc_object_t * ) ); @@ -80,9 +79,6 @@ VLC_EXPORT( char *, vlc_object_get_name, ( const vlc_object_t * ) ) LIBVLC_USED; #define vlc_object_attach(a,b) \ vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) ) -#define vlc_object_find(a,b,c) \ - vlc_object_find( VLC_OBJECT(a),b,c) - #define vlc_object_find_name(a,b,c) \ vlc_object_find_name( VLC_OBJECT(a),b,c) diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c index a10a5f3..b412850 100644 --- a/modules/lua/libs/objects.c +++ b/modules/lua/libs/objects.c @@ -82,26 +82,6 @@ int vlclua_gc_release( lua_State *L ) return 0; } -static int vlc_object_type_from_string( const char *psz_name ) -{ - static const struct - { - int i_type; - const char *psz_name; - } pp_objects[] = - { { VLC_OBJECT_INPUT, "input" }, - { VLC_OBJECT_VOUT, "vout" }, - { VLC_OBJECT_AOUT, "aout" }, - { 0, "" } }; - int i; - for( i = 0; pp_objects[i].i_type; i++ ) - { - if( !strcmp( psz_name, pp_objects[i].psz_name ) ) - return pp_objects[i].i_type; - } - return 0; -} - static int vlc_object_search_mode_from_string( const char *psz_name ) { static const struct @@ -124,32 +104,7 @@ static int vlc_object_search_mode_from_string( const char *psz_name ) static int vlclua_object_find( lua_State *L ) { - const char *psz_type = luaL_checkstring( L, 2 ); - const char *psz_mode = luaL_checkstring( L, 3 ); - - vlc_object_t *p_this; - int i_type = vlc_object_type_from_string( psz_type ); - int i_mode = vlc_object_search_mode_from_string( psz_mode ); - vlc_object_t *p_result; - - if( !i_type ) - return luaL_error( L, "\"%s\" is not a valid object type.", psz_type ); - if( !i_mode ) - return luaL_error( L, "\"%s\" is not a valid search mode.", psz_mode ); - - if( lua_type( L, 1 ) == LUA_TNIL ) - p_this = vlclua_get_this( L ); - else - { - vlc_object_t **p_obj = luaL_checkudata( L, 1, "vlc_object" ); - p_this = *p_obj; - } - - p_result = vlc_object_find( p_this, i_type, i_mode ); - if( !p_result ) - lua_pushnil( L ); - else - vlclua_push_vlc_object( L, p_result, vlclua_gc_release ); + lua_pushnil( L ); return 1; } diff --git a/src/libvlccore.sym b/src/libvlccore.sym index 4c66152..fafbbd7 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -579,7 +579,6 @@ vlc_mutex_unlock vlc_global_mutex vlc_object_attach vlc_object_create -vlc_object_find vlc_object_find_name vlc_object_hold vlc_object_kill diff --git a/src/misc/objects.c b/src/misc/objects.c index b786053..dcf76fc 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -85,8 +85,6 @@ static int DumpCommand( vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void * ); -static vlc_object_t * FindParent ( vlc_object_t *, int ); -static vlc_object_t * FindChild ( vlc_object_internals_t *, int ); static vlc_object_t * FindParentName( vlc_object_t *, const char * ); static vlc_object_t * FindChildName ( vlc_object_internals_t *, const char * ); static void PrintObject( vlc_object_internals_t *, const char * ); @@ -414,60 +412,6 @@ void vlc_object_kill( vlc_object_t *p_this ) } } -#undef vlc_object_find -/***************************************************************************** - * find a typed object and increment its refcount - ***************************************************************************** - * This function recursively looks for a given object type. i_mode can be one - * of FIND_PARENT, FIND_CHILD or FIND_ANYWHERE. - *****************************************************************************/ -void * vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode ) -{ - vlc_object_t *p_found; - - /* If we are of the requested type ourselves, don't look further */ - if( vlc_internals (p_this)->i_object_type == i_type ) - { - vlc_object_hold( p_this ); - return p_this; - } - - /* Otherwise, recursively look for the object */ - if (i_mode == FIND_ANYWHERE) - return vlc_object_find (VLC_OBJECT(p_this->p_libvlc), i_type, FIND_CHILD); - - switch (i_type) - { - case VLC_OBJECT_VOUT: - case VLC_OBJECT_AOUT: - break; - case VLC_OBJECT_INPUT: - /* input can only be accessed like this from children, - * otherwise we could not promise that it is initialized */ - if (i_mode != FIND_PARENT) - return NULL; - break; - default: - return NULL; - } - - libvlc_lock (p_this->p_libvlc); - switch (i_mode) - { - case FIND_PARENT: - p_found = FindParent (p_this, i_type); - break; - case FIND_CHILD: - p_found = FindChild (vlc_internals (p_this), i_type); - break; - default: - assert (0); - } - libvlc_unlock (p_this->p_libvlc); - return p_found; -} - - static int objnamecmp(const vlc_object_t *obj, const char *name) { char *objname = vlc_object_get_name(obj); @@ -822,18 +766,6 @@ void vlc_list_release( vlc_list_t *p_list ) /* Following functions are local */ -static vlc_object_t *FindParent (vlc_object_t *p_this, int i_type) -{ - for (vlc_object_t *parent = p_this->p_parent; - parent != NULL; - parent = parent->p_parent) - { - if (vlc_internals (parent)->i_object_type == i_type) - return vlc_object_hold (parent); - } - return NULL; -} - static vlc_object_t *FindParentName (vlc_object_t *p_this, const char *name) { for (vlc_object_t *parent = p_this->p_parent; @@ -847,20 +779,6 @@ static vlc_object_t *FindParentName (vlc_object_t *p_this, const char *name) return NULL; } -static vlc_object_t *FindChild (vlc_object_internals_t *priv, int i_type) -{ - for (priv = priv->first; priv != NULL; priv = priv->next) - { - if (priv->i_object_type == i_type) - return vlc_object_hold (vlc_externals (priv)); - - vlc_object_t *found = FindChild (priv, i_type); - if (found != NULL) - return found; - } - return NULL; -} - static vlc_object_t *FindChildName (vlc_object_internals_t *priv, const char *name) { _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
