mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 21:10:08 +01:00
shared: add nm_g_array_append_new() helper
This commit is contained in:
parent
99296d4c6c
commit
fb6e9795b7
1 changed files with 12 additions and 0 deletions
|
|
@ -1519,6 +1519,18 @@ nm_g_array_len (const GArray *arr)
|
|||
return arr ? arr->len : 0u;
|
||||
}
|
||||
|
||||
#define nm_g_array_append_new(arr, type) \
|
||||
({ \
|
||||
GArray *_arr = (arr); \
|
||||
gsize _l; \
|
||||
\
|
||||
nm_assert (_arr); \
|
||||
_l = ((gsize) _arr->len) + 1u; \
|
||||
nm_assert (_l > _arr->len); \
|
||||
g_array_set_size (_arr, _l); \
|
||||
&g_array_index (arr, type, _l); \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline guint
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue