From bb9894abecb7f52f904d98fe6ed42fb8292a9eb3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 17 Feb 2023 11:42:45 +0100 Subject: [PATCH] platform: minor cleanup of event_seq_check() - unindent the code by "continue" the loop for the irrelevant case. - fix indentation of comments. - avoid unnecessary g_strdup() call if the extack message is NULL. --- src/libnm-platform/nm-linux-platform.c | 29 ++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index 04ac89cc8..4423b75dd 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -7750,19 +7750,22 @@ event_seq_check(NMPlatform *platform, DelayedActionWaitForNlResponseData *data = delayed_action_get_list_wait_for_resonse(priv, netlink_protocol, i); - if (data->seq_number == seq_number) { - /* We potentially receive many parts partial responses for the same sequence number. - * Thus, we only remember the result, and collect it later. */ - if (data->seq_result < 0) { - /* we already saw an error for this sequence number. - * Preserve it. */ - } else if (seq_result != WAIT_FOR_NL_RESPONSE_RESULT_RESPONSE_UNKNOWN - || data->seq_result == WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN) - data->seq_result = seq_result; - if (data->out_extack_msg && !*data->out_extack_msg) - *data->out_extack_msg = g_strdup(extack_msg); - return; - } + if (data->seq_number != seq_number) + continue; + + /* We potentially receive many parts partial responses for the same sequence number. + * Thus, we only remember the result, and collect it later. */ + if (data->seq_result < 0) { + /* we already saw an error for this sequence number. + * Preserve it. */ + } else if (seq_result != WAIT_FOR_NL_RESPONSE_RESULT_RESPONSE_UNKNOWN + || data->seq_result == WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN) + data->seq_result = seq_result; + + if (extack_msg && data->out_extack_msg && !*data->out_extack_msg) + *data->out_extack_msg = g_strdup(extack_msg); + + return; } out: