shared: add nm_utils_dbus_path_get_last_component() helper

This commit is contained in:
Thomas Haller 2018-04-27 15:11:50 +02:00
parent bb649fc3cd
commit 3b0d50475b
2 changed files with 17 additions and 0 deletions

View file

@ -549,6 +549,19 @@ nm_cmp_int2ptr_p_with_data (gconstpointer p_a, gconstpointer p_b, gpointer user_
/*****************************************************************************/
const char *
nm_utils_dbus_path_get_last_component (const char *dbus_path)
{
if (dbus_path) {
dbus_path = strrchr (dbus_path, '/');
if (dbus_path)
return dbus_path + 1;
}
return NULL;
}
/*****************************************************************************/
/**
* nm_utils_strsplit_set:
* @str: the string to split.

View file

@ -202,6 +202,10 @@ nm_utils_is_separator (const char c)
/*****************************************************************************/
const char *nm_utils_dbus_path_get_last_component (const char *dbus_path);
/*****************************************************************************/
const char **nm_utils_strsplit_set (const char *str, const char *delimiters);
gssize nm_utils_strv_find_first (char **list, gssize len, const char *needle);