]> git.proxmox.com Git - mirror_frr.git/commit - nhrpd/reqid.c
*: remove the checking returned value for hash_get()
authoranlan_cs <vic.lan@pica8.com>
Thu, 21 Apr 2022 06:37:12 +0000 (02:37 -0400)
committeranlan_cs <vic.lan@pica8.com>
Mon, 2 May 2022 16:41:48 +0000 (00:41 +0800)
commit8e3aae66cec563cee0add26482f279c4aae67cb1
tree8edfdd068eeabbd142cfc7c47a56fcec542110fc
parentac390ef8ac7e31f2ddbcb8bdaf1f2b507ec7522e
*: remove the checking returned value for hash_get()

Firstly, *keep no change* for `hash_get()` with NULL
`alloc_func`.

Only focus on cases with non-NULL `alloc_func` of
`hash_get()`.

Since `hash_get()` with non-NULL `alloc_func` parameter
shall not fail, just ignore the returned value of it.
The returned value must not be NULL.
So in this case, remove the unnecessary checking NULL
or not for the returned value and add `void` in front
of it.

Importantly, also *keep no change* for the two cases with
non-NULL `alloc_func` -
1) Use `assert(<returned_data> == <searching_data>)` to
   ensure it is a created node, not a found node.
   Refer to `isis_vertex_queue_insert()` of isisd, there
   are many examples of this case in isid.
2) Use `<returned_data> != <searching_data>` to judge it
   is a found node, then free <searching_data>.
   Refer to `aspath_intern()` of bgpd, there are many
   examples of this case in bgpd.

Here, <returned_data> is the returned value from `hash_get()`,
and <searching_data> is the data, which is to be put into
hash table.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
35 files changed:
bgpd/bgp_aspath.c
bgpd/bgp_clist.c
bgpd/bgp_community_alias.c
bgpd/bgp_evpn.c
bgpd/bgp_fsm.c
bgpd/bgp_keepalives.c
bgpd/bgp_network.c
bgpd/bgp_nexthop.c
bgpd/bgp_pbr.c
bgpd/bgp_updgrp.c
bgpd/bgpd.c
isisd/isis_lfa.c
isisd/isis_spf.c
lib/command.c
lib/ferr.c
lib/frrscript.c
lib/northbound.c
nhrpd/reqid.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_gr_helper.c
ospfd/ospf_asbr.c
ospfd/ospf_gr_helper.c
ospfd/ospf_sr.c
pbrd/pbr_nht.c
pimd/pim_nht.c
tests/lib/test_srcdest_table.c
vrrpd/vrrp.c
zebra/zebra_evpn.c
zebra/zebra_evpn_mac.c
zebra/zebra_evpn_mh.c
zebra/zebra_evpn_neigh.c
zebra/zebra_fpm.c
zebra/zebra_mpls.c
zebra/zebra_nhg.c
zebra/zebra_vxlan.c