Commit cd133b2d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_object_find_name: return vlc_object_t *

Casting to any other type would be (is?) unsafe as users can now freely
alias objects.
parent 78cb33cb
...@@ -85,7 +85,7 @@ __attribute__((deprecated)) ...@@ -85,7 +85,7 @@ __attribute__((deprecated))
#endif #endif
VLC_EXPORT( void *, vlc_object_get, ( libvlc_int_t *, int ) ); VLC_EXPORT( void *, vlc_object_get, ( libvlc_int_t *, int ) );
VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) ); VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void *, __vlc_object_find_name, ( vlc_object_t *, const char *, int ) ); VLC_EXPORT( vlc_object_t *, vlc_object_find_name, ( vlc_object_t *, const char *, int ) );
VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) ); VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
...@@ -110,7 +110,7 @@ VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) ); ...@@ -110,7 +110,7 @@ VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
__vlc_object_find( VLC_OBJECT(a),b,c) __vlc_object_find( VLC_OBJECT(a),b,c)
#define vlc_object_find_name(a,b,c) \ #define vlc_object_find_name(a,b,c) \
__vlc_object_find_name( VLC_OBJECT(a),b,c) vlc_object_find_name( VLC_OBJECT(a),b,c)
#define vlc_object_yield(a) \ #define vlc_object_yield(a) \
__vlc_object_yield( VLC_OBJECT(a) ) __vlc_object_yield( VLC_OBJECT(a) )
......
...@@ -469,7 +469,7 @@ __vlc_object_attach ...@@ -469,7 +469,7 @@ __vlc_object_attach
__vlc_object_create __vlc_object_create
__vlc_object_detach __vlc_object_detach
__vlc_object_find __vlc_object_find
__vlc_object_find_name vlc_object_find_name
vlc_object_get vlc_object_get
__vlc_object_kill __vlc_object_kill
__vlc_object_lock __vlc_object_lock
......
...@@ -620,15 +620,25 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode ) ...@@ -620,15 +620,25 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode )
return p_found; return p_found;
} }
#undef vlc_object_find_name
/** /**
**************************************************************************** * Finds a named object and increment its reference count.
* find a named object and increment its refcount * Beware that objects found in this manner can be "owned" by another thread,
***************************************************************************** * be of _any_ type, and be attached to any module (if any). With such an
* This function recursively looks for a given object name. i_mode can be one * object reference, you can set or get object variables, emit log messages,
* of FIND_PARENT, FIND_CHILD or FIND_ANYWHERE. * and read write-once object parameters (i_object_id, psz_object_type, etc).
*****************************************************************************/ * You CANNOT cast the object to a more specific object type, and you
void * __vlc_object_find_name( vlc_object_t *p_this, const char *psz_name, * definitely cannot invoke object type-specific callbacks with this.
int i_mode ) *
* @param p_this object to search from
* @param psz_name name of the object to search for
* @param i_mode search direction: FIND_PARENT, FIND_CHILD or FIND_ANYWHERE.
*
* @return a matching object (must be released by the caller),
* or NULL on error.
*/
vlc_object_t *vlc_object_find_name( vlc_object_t *p_this,
const char *psz_name, int i_mode )
{ {
vlc_object_t *p_found; vlc_object_t *p_found;
......
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