debug: make function to get short name

This commit is contained in:
Wim Taymans 2020-03-05 18:17:27 +01:00
parent b070752add
commit d4fcbaa5d1

View file

@ -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)