From d8bc11a592110abdd14d11dfcb2ce623653ecab5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 21 Mar 2023 08:54:21 -0400 Subject: *: Add a hash_clean_and_free() function Add a hash_clean_and_free() function as well as convert the code to use it. This function also takes a double pointer to the hash to set it NULL. Also it cleanly does nothing if the pointer is NULL( as a bunch of code tested for ). Signed-off-by: Donald Sharp --- ospf6d/ospf6_gr_helper.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'ospf6d/ospf6_gr_helper.c') diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index bf570a0b2..3df0580fc 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -110,10 +110,8 @@ static void ospf6_enable_rtr_hash_destroy(struct ospf6 *ospf6) if (ospf6->ospf6_helper_cfg.enable_rtr_list == NULL) return; - hash_clean(ospf6->ospf6_helper_cfg.enable_rtr_list, - ospf6_disable_rtr_hash_free); - hash_free(ospf6->ospf6_helper_cfg.enable_rtr_list); - ospf6->ospf6_helper_cfg.enable_rtr_list = NULL; + hash_clean_and_free(&ospf6->ospf6_helper_cfg.enable_rtr_list, + ospf6_disable_rtr_hash_free); } /* -- cgit v1.2.3