diff options
author | Thomas Haller <thaller@redhat.com> | 2022-03-23 13:08:36 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-03-28 18:27:36 +0200 |
commit | cfe594903ecfba7242043e8dd8a1c4c7c7f7f1fa (patch) | |
tree | 5a651d18a586d6396291c66e3d8d5c1f104d223b | |
parent | a0db72bf6d69459ad347c824e1848cf584733bef (diff) | |
download | NetworkManager-cfe594903ecfba7242043e8dd8a1c4c7c7f7f1fa.tar.gz |
keyfile: simplify code path in write_setting_value()
Avoid nested blocks. Check one condition after the other and handle it.
-rw-r--r-- | src/libnm-core-impl/nm-keyfile.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libnm-core-impl/nm-keyfile.c b/src/libnm-core-impl/nm-keyfile.c index a2ad57c72f..fb475cf23b 100644 --- a/src/libnm-core-impl/nm-keyfile.c +++ b/src/libnm-core-impl/nm-keyfile.c @@ -3849,6 +3849,14 @@ write_setting_value(KeyfileWriterInfo *info, _parse_info_find(setting, key, &setting_info, NULL, &pip); + if (pip && pip->has_writer_full) { + pip->writer_full(info, setting_info, property_info, pip, setting); + return; + } + + if (pip && pip->writer_skip) + return; + if (!pip) { if (!setting_info) { /* the setting type is unknown. That is highly unexpected @@ -3865,13 +3873,6 @@ write_setting_value(KeyfileWriterInfo *info, return; if (nm_streq(key, NM_SETTING_NAME)) return; - } else { - if (pip->has_writer_full) { - pip->writer_full(info, setting_info, property_info, pip, setting); - return; - } - if (pip->writer_skip) - return; } nm_assert(property_info->param_spec); |