From 90550a276bb1c29083af29e76676a94d7d55378d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 8 Apr 2016 12:25:41 +0200 Subject: platform: refactor delayed_action_wait_for_nl_response_complete() --- src/platform/nm-linux-platform.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 21f89de949..0e562d6181 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -2339,8 +2339,8 @@ _support_kernel_extended_ifa_flags_get (void) typedef struct { guint32 seq_number; - gint64 timeout_abs_ns; WaitForNlResponseResult seq_result; + gint64 timeout_abs_ns; WaitForNlResponseResult *out_seq_result; } DelayedActionWaitForNlResponseData; @@ -2814,7 +2814,6 @@ delayed_action_wait_for_nl_response_complete (NMPlatform *platform, { NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); DelayedActionWaitForNlResponseData *data; - WaitForNlResponseResult *out_seq_result; nm_assert (NM_FLAGS_HAS (priv->delayed_action.flags, DELAYED_ACTION_TYPE_WAIT_FOR_NL_RESPONSE)); nm_assert (idx < priv->delayed_action.list_wait_for_nl_response->len); @@ -2824,16 +2823,12 @@ delayed_action_wait_for_nl_response_complete (NMPlatform *platform, _LOGt_delayed_action (DELAYED_ACTION_TYPE_WAIT_FOR_NL_RESPONSE, data, "complete"); - out_seq_result = data->out_seq_result; - - g_array_remove_index_fast (priv->delayed_action.list_wait_for_nl_response, idx); - /* Note: @data is invalidated at this point */ - - if (priv->delayed_action.list_wait_for_nl_response->len <= 0) + if (priv->delayed_action.list_wait_for_nl_response->len <= 1) priv->delayed_action.flags &= ~DELAYED_ACTION_TYPE_WAIT_FOR_NL_RESPONSE; + if (data->out_seq_result) + *data->out_seq_result = seq_result; - if (out_seq_result) - *out_seq_result = seq_result; + g_array_remove_index_fast (priv->delayed_action.list_wait_for_nl_response, idx); } static void -- cgit v1.2.1