From 53dcdf8516e105a02c578cc911abf6a4910bdfa8 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 3 Jul 2015 07:57:02 +0200 Subject: [PATCH] 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: d510f0a039c9e988f606cae1a83c35c66ace3bf1 (cherry picked from commit 643f042b9b181655fda6989ecf297b65c615f66c) --- src/nm-config.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/nm-config.c b/src/nm-config.c index b17471d6ed..7520c18e3b 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -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);