mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
debug: make function to get short name
This commit is contained in:
parent
b070752add
commit
d4fcbaa5d1
1 changed files with 11 additions and 9 deletions
|
|
@ -50,6 +50,14 @@ static inline const struct spa_type_info *spa_debug_type_find(const struct spa_t
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline const char *spa_debug_type_short_name(const char *name)
|
||||||
|
{
|
||||||
|
const char *h;
|
||||||
|
if ((h = rindex(name, ':')) != NULL)
|
||||||
|
name = h + 1;
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
static inline const char *spa_debug_type_find_name(const struct spa_type_info *info, uint32_t type)
|
static inline const char *spa_debug_type_find_name(const struct spa_type_info *info, uint32_t type)
|
||||||
{
|
{
|
||||||
if ((info = spa_debug_type_find(info, type)) == NULL)
|
if ((info = spa_debug_type_find(info, type)) == NULL)
|
||||||
|
|
@ -59,16 +67,10 @@ static inline const char *spa_debug_type_find_name(const struct spa_type_info *i
|
||||||
|
|
||||||
static inline const char *spa_debug_type_find_short_name(const struct spa_type_info *info, uint32_t type)
|
static inline const char *spa_debug_type_find_short_name(const struct spa_type_info *info, uint32_t type)
|
||||||
{
|
{
|
||||||
const char *str, *h;
|
const char *str;
|
||||||
|
if ((str = spa_debug_type_find_name(info, type)) == NULL)
|
||||||
str = spa_debug_type_find_name(info, type);
|
|
||||||
if (!str)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
return spa_debug_type_short_name(str);
|
||||||
h = rindex(str, ':');
|
|
||||||
if (h)
|
|
||||||
str = h + 1;
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t spa_debug_type_find_type(const struct spa_type_info *info, const char *name)
|
static inline uint32_t spa_debug_type_find_type(const struct spa_type_info *info, const char *name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue