summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-07-03 07:57:02 +0200
committerThomas Haller <thaller@redhat.com>2015-07-03 09:24:02 +0200
commit53dcdf8516e105a02c578cc911abf6a4910bdfa8 (patch)
tree97643168cd5f78a57c1100e745ff863e2b92932d
parentb2a6022de83b84b03bdec8ca26b34444f5d3356d (diff)
downloadNetworkManager-53dcdf8516e105a02c578cc911abf6a4910bdfa8.tar.gz
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)
-rw-r--r--src/nm-config.c20
1 files 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;
- }
- for (j = 0; j < updated->len; j++) {
- if (!strcmp (list[i], updated->pdata[j]))
- break;
+ 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]);
}
- if (j == updated->len)
- g_ptr_array_add (updated, list[i]);
- else
- g_free (list[i]);
}
g_free (list);
g_free (data);