Add a spa_debug_type_find_short_name method

Using the short name of a type without the base part is common enough
that a common utility method is warranted.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
This commit is contained in:
Pantelis Antoniou 2020-02-19 10:55:29 +02:00 committed by Wim Taymans
parent 8b874a9514
commit 634a9558e4

View file

@ -57,6 +57,20 @@ static inline const char *spa_debug_type_find_name(const struct spa_type_info *i
return info->name;
}
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)
return NULL;
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)
{
if (info == NULL)