mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 16:00:21 +01:00
glib-aux: add nm_strvarray_remove_index() helper
This commit is contained in:
parent
6c83f7bd67
commit
60375218d1
1 changed files with 14 additions and 0 deletions
|
|
@ -3128,6 +3128,20 @@ nm_strvarray_remove_first(GArray *strv, const char *needle)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#define nm_strvarray_remove_index(strv, idx) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
GArray *const _strv = (strv); \
|
||||
typeof(idx) _idx = (idx); \
|
||||
\
|
||||
nm_assert(_strv); \
|
||||
nm_assert((uintmax_t) _idx < _strv->len); \
|
||||
nm_assert(sizeof(char *) == g_array_get_element_size(_strv)); \
|
||||
\
|
||||
g_array_remove_index(_strv, (guint) _idx); \
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
static inline void
|
||||
nm_strvarray_ensure_and_add(GArray **p, const char *str)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue