]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: remove unnecessary housekeeping code when using linked lists
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 24 Sep 2018 20:42:03 +0000 (17:42 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 24 Sep 2018 20:47:38 +0000 (17:47 -0300)
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 <renato@opensourcerouting.org>
ospfd/ospf_opaque.c
ospfd/ospf_ri.c
ospfd/ospf_te.c

index bbc559ca371d821885b199565bcd499a4c0aea28..e3c830d71b16d64a9f26ed5e81c373a8aeea6ae4 100644 (file)
@@ -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);
 
index e95fc43aabe3916ccfe2c89d4377023ad1f07bcf..22262c804f91b35b6b8b0744b82160dcdee2c71c 100644 (file)
@@ -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);
        }
index f45682c770b05821231dc29998a0d6f782485527..12122e76467c512cfdda5da92f9815c367cc9407 100644 (file)
@@ -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);
        }