Browse Source

objects: get module name from the variable

This is still as racy as before, but at least it does not serialize
against a global lock.
pull/85/head
Rémi Denis-Courmont 8 years ago
parent
commit
a51089e4eb
  1. 13
      include/vlc_objects.h
  2. 1
      src/libvlccore.sym
  3. 6
      src/misc/objects.c

13
include/vlc_objects.h

@ -112,7 +112,18 @@ VLC_API const char *vlc_object_typename(const vlc_object_t *obj) VLC_USED;
VLC_API vlc_object_t *vlc_object_parent(vlc_object_t *obj) VLC_USED;
#define vlc_object_parent(o) vlc_object_parent(VLC_OBJECT(o))
VLC_API char *vlc_object_get_name( const vlc_object_t * ) VLC_USED;
/**
* Tries to get the name of module bound to an object.
*
* \warning This function is intrinsically race-prone, as a module may be
* bound or unbound asynchronously by another thread.
* Do not trust the result for any purpose other than debugging/tracing.
*
* \return Normally, this returns a heap-allocated nul-terminated string
* which is the name of the module. If no module are bound to the object, it
* returns NULL. It also returns NULL on error.
*/
#define vlc_object_get_name(obj) var_GetString(obj, "module-name")
#define vlc_object_create(a,b) vlc_object_create( VLC_OBJECT(a), b )

1
src/libvlccore.sym

@ -676,7 +676,6 @@ vlc_object_hold
vlc_object_release
vlc_object_typename
vlc_object_parent
vlc_object_get_name
vlc_once
vlc_rand_bytes
vlc_drand48

6
src/misc/objects.c

@ -312,12 +312,6 @@ int vlc_object_set_name(vlc_object_t *obj, const char *name)
return VLC_SUCCESS;
}
char *vlc_object_get_name(const vlc_object_t *obj)
{
assert(obj != NULL);
return NULL;
}
/**
* Destroys a VLC object once it has no more references.
*

Loading…
Cancel
Save