mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 14:10:08 +01:00
core: minor cleanup of nm_utils_g_value_set_strv()
Add some assertion, use an unsigned loop variable (that matches GPtrArray.len type), and add a comment.
This commit is contained in:
parent
a5e9980b34
commit
1b532b5fdc
1 changed files with 6 additions and 3 deletions
|
|
@ -3650,7 +3650,8 @@ nm_utils_setpgid (gpointer unused G_GNUC_UNUSED)
|
|||
/**
|
||||
* nm_utils_g_value_set_strv:
|
||||
* @value: a #GValue, initialized to store a #G_TYPE_STRV
|
||||
* @strings: a #GPtrArray of strings
|
||||
* @strings: a #GPtrArray of strings. %NULL values are not
|
||||
* allowed.
|
||||
*
|
||||
* Converts @strings to a #GStrv and stores it in @value.
|
||||
*/
|
||||
|
|
@ -3658,11 +3659,13 @@ void
|
|||
nm_utils_g_value_set_strv (GValue *value, GPtrArray *strings)
|
||||
{
|
||||
char **strv;
|
||||
int i;
|
||||
guint i;
|
||||
|
||||
strv = g_new (char *, strings->len + 1);
|
||||
for (i = 0; i < strings->len; i++)
|
||||
for (i = 0; i < strings->len; i++) {
|
||||
nm_assert (strings->pdata[i]);
|
||||
strv[i] = g_strdup (strings->pdata[i]);
|
||||
}
|
||||
strv[i] = NULL;
|
||||
|
||||
g_value_take_boxed (value, strv);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue