mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
const char *str, *h;
|
||||
|
||||
str = spa_debug_type_find_name(info, type);
|
||||
if (!str)
|
||||
const char *str;
|
||||
if ((str = spa_debug_type_find_name(info, type)) == NULL)
|
||||
return NULL;
|
||||
|
||||
h = rindex(str, ':');
|
||||
if (h)
|
||||
str = h + 1;
|
||||
return str;
|
||||
return spa_debug_type_short_name(str);
|
||||
}
|
||||
|
||||
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