utils: save duplicate lookup of path in nm_utils_g_value_set_object_path_array()

This commit is contained in:
Thomas Haller
2015-12-04 13:12:04 +01:00
parent d6d343ef65
commit b9b65e7d48

View File

@@ -3471,12 +3471,14 @@ nm_utils_g_value_set_object_path_array (GValue *value,
paths = g_new (char *, g_slist_length (objects) + 1);
for (i = 0, iter = objects; iter; iter = iter->next) {
NMExportedObject *object = iter->data;
const char *path;
if (!nm_exported_object_is_exported (object))
path = nm_exported_object_get_path (object);
if (!path)
continue;
if (filter_func && !filter_func ((GObject *) object, user_data))
continue;
paths[i++] = g_strdup (nm_exported_object_get_path (object));
paths[i++] = g_strdup (path);
}
paths[i] = NULL;
g_value_take_boxed (value, paths);