From 6a49b4ff3853310c4b068f633408e69e735dc5d1 Mon Sep 17 00:00:00 2001 From: YangHau Date: Fri, 16 Aug 2019 01:55:59 +0800 Subject: [PATCH] Remove useless if statement If statement for detecting if a pointer is NULL is totally unnecessary. Signed-off-by: YangHau --- src/db_dump/db_dump.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/db_dump/db_dump.c b/src/db_dump/db_dump.c index 618a6784..455f1eeb 100644 --- a/src/db_dump/db_dump.c +++ b/src/db_dump/db_dump.c @@ -100,42 +100,28 @@ struct msg_store_chunk *msgs_by_id = NULL; static void free__db_sub(struct db_sub *sub) { - if (sub->client_id) { - free(sub->client_id); - } - if (sub->topic) { - free(sub->topic); - } + free(sub->client_id); + free(sub->topic); } static void free__db_client(struct db_client *client) { - if (client->client_id) { - free(client->client_id); - } + free(client->client_id); } static void free__db_client_msg(struct db_client_msg *msg) { - if (msg->client_id) { - free(msg->client_id); - } + free(msg->client_id); } static void free__db_msg(struct db_msg *msg) { - if (msg->source_id) { - free(msg->source_id); - } - if (msg->topic) { - free(msg->topic); - } - if (msg->payload) { - free(msg->payload); - } + free(msg->source_id); + free(msg->topic); + free(msg->payload); } static void