config: backport refactoring to no_auto_default_merge_from_file()

The original backport was different then what was done on master.
Make 'nm-config.c' more similar to what we have on master.

Fixes: d510f0a039

(cherry picked from commit 643f042b9b)
This commit is contained in:
Thomas Haller 2015-07-03 07:57:02 +02:00
parent b2a6022de8
commit 53dcdf8516

View file

@ -244,18 +244,18 @@ no_auto_default_merge_from_file (const char *no_auto_default_file, const char *c
&& g_file_get_contents (no_auto_default_file, &data, NULL, NULL)) {
list = g_strsplit (data, "\n", -1);
for (i = 0; list[i]; i++) {
if (!*list[i]) {
if (!*list[i])
g_free (list[i]);
continue;
else {
for (j = 0; j < updated->len; j++) {
if (!strcmp (list[i], updated->pdata[j]))
break;
}
if (j == updated->len)
g_ptr_array_add (updated, list[i]);
else
g_free (list[i]);
}
for (j = 0; j < updated->len; j++) {
if (!strcmp (list[i], updated->pdata[j]))
break;
}
if (j == updated->len)
g_ptr_array_add (updated, list[i]);
else
g_free (list[i]);
}
g_free (list);
g_free (data);