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 <axel.lin@ingics.com>
This commit is contained in:
Axel Lin
2021-04-20 11:27:42 +08:00
parent 1db731f985
commit ff8e64839a

View File

@ -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);