From ff8e64839af0fa464932ce1383723e4a20d3488f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Apr 2021 11:27:42 +0800 Subject: [PATCH] mqtt_outbox: Use STAILQ_FOREACH for outbox_delete_single_expired For the delete one entry and return case, no need to use STAILQ_FOREACH_SAFE. Signed-off-by: Axel Lin --- lib/mqtt_outbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mqtt_outbox.c b/lib/mqtt_outbox.c index 1462841..77ef3ec 100644 --- a/lib/mqtt_outbox.c +++ b/lib/mqtt_outbox.c @@ -168,8 +168,8 @@ esp_err_t outbox_delete_msgtype(outbox_handle_t outbox, int msg_type) int outbox_delete_single_expired(outbox_handle_t outbox, outbox_tick_t current_tick, outbox_tick_t timeout) { int msg_id = -1; - outbox_item_handle_t item, tmp; - STAILQ_FOREACH_SAFE(item, outbox, next, tmp) { + outbox_item_handle_t item; + STAILQ_FOREACH(item, outbox, next) { if (current_tick - item->tick > timeout) { STAILQ_REMOVE(outbox, item, outbox_item, next); free(item->buffer);