From 962d3f8474d73505fbb35ad67cfb1d25787cd857 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 24 Sep 2018 17:42:03 -0300 Subject: [PATCH] ospfd: remove unnecessary housekeeping code when using linked lists The head and tail pointers of linked lists should never be modified manually, the linked list API guarantees that these pointers are always valid and up-to-date. Signed-off-by: Renato Westphal --- ospfd/ospf_opaque.c | 8 -------- ospfd/ospf_ri.c | 9 --------- ospfd/ospf_te.c | 4 ---- 3 files changed, 21 deletions(-) diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index bbc559ca37..e3c830d71b 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -438,10 +438,6 @@ void ospf_delete_opaque_functab(uint8_t lsa_type, uint8_t opaque_type) /* Dequeue listnode entry from the list. */ listnode_delete(funclist, functab); - /* Avoid misjudgement in the next lookup. */ - if (listcount(funclist) == 0) - funclist->head = funclist->tail = NULL; - XFREE(MTYPE_OSPF_OPAQUE_FUNCTAB, functab); break; } @@ -2122,10 +2118,6 @@ void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa0) /* Dequeue listnode entry from the list. */ listnode_delete(oipt->id_list, oipi); - /* Avoid misjudgement in the next lookup. */ - if (listcount(oipt->id_list) == 0) - oipt->id_list->head = oipt->id_list->tail = NULL; - /* Disassociate internal control information with the given lsa. */ free_opaque_info_per_id((void *)oipi); diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index e95fc43aab..22262c804f 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -380,10 +380,6 @@ static void unset_pce_domain(uint16_t type, uint32_t domain, if (found) { listnode_delete(pce->pce_domain, old); - /* Avoid misjudgement in the next lookup. */ - if (listcount(pce->pce_domain) == 0) - pce->pce_domain->head = pce->pce_domain->tail = NULL; - /* Finally free the old domain */ XFREE(MTYPE_OSPF_PCE_PARAMS, old); } @@ -430,11 +426,6 @@ static void unset_pce_neighbor(uint16_t type, uint32_t domain, if (found) { listnode_delete(pce->pce_neighbor, old); - /* Avoid misjudgement in the next lookup. */ - if (listcount(pce->pce_neighbor) == 0) - pce->pce_neighbor->head = pce->pce_neighbor->tail = - NULL; - /* Finally free the old domain */ XFREE(MTYPE_OSPF_PCE_PARAMS, old); } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index f45682c770..12122e7646 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -897,10 +897,6 @@ static int ospf_mpls_te_del_if(struct interface *ifp) /* Dequeue listnode entry from the list. */ listnode_delete(iflist, lp); - /* Avoid misjudgement in the next lookup. */ - if (listcount(iflist) == 0) - iflist->head = iflist->tail = NULL; - XFREE(MTYPE_OSPF_MPLS_TE, lp); }