]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: update hash_create(), hash_create_size()
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 19 Jun 2017 22:49:44 +0000 (22:49 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Sat, 1 Jul 2017 23:18:37 +0000 (19:18 -0400)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
28 files changed:
bgpd/bgp_advertise.c
bgpd/bgp_aspath.c
bgpd/bgp_attr.c
bgpd/bgp_community.c
bgpd/bgp_ecommunity.c
bgpd/bgp_lcommunity.c
bgpd/bgp_nexthop.c
bgpd/bgp_updgrp.c
bgpd/bgpd.c
lib/command.c
lib/distribute.c
lib/frr_pthread.c
lib/if_rmap.c
lib/qobj.c
lib/routemap.c
lib/thread.c
nhrpd/nhrp_cache.c
nhrpd/nhrp_peer.c
nhrpd/nhrp_vc.c
nhrpd/reqid.c
pimd/pim_iface.c
pimd/pim_igmp.c
pimd/pim_msdp.c
pimd/pim_oil.c
pimd/pim_upstream.c
pimd/pimd.c
tests/lib/test_srcdest_table.c
zebra/zebra_mpls.c

index f005b2018338ff0a0c7ccf429ee59e02feb661a5..c44e06773264dc6709146262ad0ff0e3ab057b2c 100644 (file)
@@ -267,7 +267,7 @@ bgp_sync_init (struct peer *peer)
        BGP_ADV_FIFO_INIT (&sync->withdraw);
        BGP_ADV_FIFO_INIT (&sync->withdraw_low);
        peer->sync[afi][safi] = sync;
-       peer->hash[afi][safi] = hash_create (baa_hash_key, baa_hash_cmp);
+       peer->hash[afi][safi] = hash_create (baa_hash_key, baa_hash_cmp, NULL);
       }
 }
 
index f9daeb2ed34ff4f41cf89208dbe5a95b15593927..f304b3a1b707a01f7e1acb0708f40073633cee31 100644 (file)
@@ -2134,7 +2134,7 @@ aspath_cmp (const void *arg1, const void *arg2)
 void
 aspath_init (void)
 {
-  ashash = hash_create_size (32768, aspath_key_make, aspath_cmp);
+  ashash = hash_create_size (32768, aspath_key_make, aspath_cmp, NULL);
 }
 
 void
index 6a7ec473b8d5d50e5e7a6da0b0f19721bfe1ea22..d343ce236b0533024a22a41f38ee90d10bcdb29f 100644 (file)
@@ -215,7 +215,7 @@ cluster_unintern (struct cluster_list *cluster)
 static void
 cluster_init (void)
 {
-  cluster_hash = hash_create (cluster_hash_key_make, cluster_hash_cmp);
+  cluster_hash = hash_create (cluster_hash_key_make, cluster_hash_cmp, NULL);
 }
 
 static void
@@ -403,9 +403,9 @@ encap_hash_cmp (const void *p1, const void *p2)
 static void
 encap_init (void)
 {
-  encap_hash = hash_create (encap_hash_key_make, encap_hash_cmp);
+  encap_hash = hash_create (encap_hash_key_make, encap_hash_cmp, NULL);
 #if ENABLE_BGP_VNC
-  vnc_hash = hash_create (encap_hash_key_make, encap_hash_cmp);
+  vnc_hash = hash_create (encap_hash_key_make, encap_hash_cmp, NULL);
 #endif
 }
 
@@ -517,7 +517,7 @@ transit_hash_cmp (const void *p1, const void *p2)
 static void
 transit_init (void)
 {
-  transit_hash = hash_create (transit_hash_key_make, transit_hash_cmp);
+  transit_hash = hash_create (transit_hash_key_make, transit_hash_cmp, NULL);
 }
 
 static void
@@ -765,7 +765,7 @@ attrhash_cmp (const void *p1, const void *p2)
 static void
 attrhash_init (void)
 {
-  attrhash = hash_create (attrhash_key_make, attrhash_cmp);
+  attrhash = hash_create (attrhash_key_make, attrhash_cmp, "BGP Attributes");
 }
 
 /*
index bd67829d779fef2a26acf86d7f290578abf89ef5..be4cdac0acbaf7b6fbb431980f92ecfaa530e557 100644 (file)
@@ -686,7 +686,7 @@ void
 community_init (void)
 {
   comhash = hash_create ((unsigned int (*) (void *))community_hash_make,
-                        (int (*) (const void *, const void *))community_cmp);
+                        (int (*) (const void *, const void *))community_cmp, NULL);
 }
 
 void
index fa1ad813f196dc4f73aa7624cdbb1a8cae2914a6..0555d1bbe32a3472849f3eced99b566e24f99942 100644 (file)
@@ -284,7 +284,7 @@ ecommunity_cmp (const void *arg1, const void *arg2)
 void
 ecommunity_init (void)
 {
-  ecomhash = hash_create (ecommunity_hash_make, ecommunity_cmp);
+  ecomhash = hash_create (ecommunity_hash_make, ecommunity_cmp, NULL);
 }
 
 void
index 4a969c8b9051ebd2ffb32eccda93877b792ee216..23c19f70ceef64591923403853c5f541ef54dcff 100644 (file)
@@ -286,7 +286,7 @@ lcommunity_hash (void)
 void
 lcommunity_init (void)
 {
-  lcomhash = hash_create (lcommunity_hash_make, lcommunity_cmp);
+  lcomhash = hash_create (lcommunity_hash_make, lcommunity_cmp, NULL);
 }
 
 void
index 4216a2d49bfcbeea87a7d5534737fc9507e93156..d0c4d2c945b0c28ae96d6a25f5923bdd59e5e889 100644 (file)
@@ -140,7 +140,7 @@ void
 bgp_address_init (struct bgp *bgp)
 {
   bgp->address_hash = hash_create (bgp_address_hash_key_make,
-                                  bgp_address_hash_cmp);
+                                  bgp_address_hash_cmp, NULL);
 }
 
 void
index b1b33363638af74eaa2cbe572067bd9e2b22a786..722eed91c03f7fb04c4fc2251c9daf85e87a547a 100644 (file)
@@ -87,7 +87,7 @@ sync_init (struct update_subgroup *subgrp)
   BGP_ADV_FIFO_INIT (&subgrp->sync->update);
   BGP_ADV_FIFO_INIT (&subgrp->sync->withdraw);
   BGP_ADV_FIFO_INIT (&subgrp->sync->withdraw_low);
-  subgrp->hash = hash_create (baa_hash_key, baa_hash_cmp);
+  subgrp->hash = hash_create (baa_hash_key, baa_hash_cmp, NULL);
 
   /* We use a larger buffer for subgrp->work in the event that:
    * - We RX a BGP_UPDATE where the attributes alone are just
@@ -1559,7 +1559,7 @@ update_bgp_group_init (struct bgp *bgp)
 
   AF_FOREACH (afid)
     bgp->update_groups[afid] = hash_create (updgrp_hash_key_make,
-                                           updgrp_hash_cmp);
+                                           updgrp_hash_cmp, NULL);
 }
 
 void
index 033a3d194d398265d052dea54b95206ff269ca6e..65b53be653642a0f5307c903f0682237fd10e38d 100644 (file)
@@ -2910,7 +2910,7 @@ bgp_create (as_t *as, const char *name, enum bgp_instance_type inst_type)
   bgp->peer_self->host = XSTRDUP(MTYPE_BGP_PEER_HOST, "Static announcement");
   bgp->peer = list_new ();
   bgp->peer->cmp = (int (*)(void *, void *)) peer_cmp;
-  bgp->peerhash = hash_create (peer_hash_key_make, peer_hash_cmp);
+  bgp->peerhash = hash_create (peer_hash_key_make, peer_hash_cmp, NULL);
 
   bgp->group = list_new ();
   bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp;
index 77fada1636fe7a60c13aaa1704ffdba312833cae..de8899687cc1c2eabe23a0a6971e3e98a4675ece 100644 (file)
@@ -233,7 +233,7 @@ install_node (struct cmd_node *node,
   // add start node
   struct cmd_token *token = cmd_token_new (START_TKN, CMD_ATTR_NORMAL, NULL, NULL);
   graph_new_node (node->cmdgraph, token, (void (*)(void *)) &cmd_token_del);
-  node->cmd_hash = hash_create (cmd_hash_key, cmd_hash_cmp);
+  node->cmd_hash = hash_create (cmd_hash_key, cmd_hash_cmp, NULL);
 }
 
 /**
index c771f018c2f119c24a7c7833ec0c67a865e840cc..79d7b18ff5e122ce5ca6d144954d025d0fc4b7a7 100644 (file)
@@ -522,7 +522,8 @@ void
 distribute_list_init (int node)
 {
   disthash = hash_create (distribute_hash_make,
-                          (int (*) (const void *, const void *)) distribute_cmp);
+                         (int (*) (const void *, const void *))
+                         distribute_cmp, NULL);
 
   /* vtysh command-extraction doesn't grok install_element(node, ) */
   if (node == RIP_NODE) {
index 614c722be1e1c30d72b92c516178c77cdce5b6cb..4b9bed452427a7b0593b4338929214b123671ad2 100644 (file)
@@ -55,7 +55,7 @@ void frr_pthread_init()
         pthread_mutex_lock(&pthread_table_mtx);
         {
                 pthread_table =
-                    hash_create(pthread_table_hash_key, pthread_table_hash_cmp);
+                    hash_create(pthread_table_hash_key, pthread_table_hash_cmp, NULL);
         }
         pthread_mutex_unlock(&pthread_table_mtx);
 }
index f9c6a55d7b97f2a797ef6b20479d77dc8aab06d7..32bebd67ff5e6499dc9a3168b5bdac290f542a56 100644 (file)
@@ -316,7 +316,7 @@ if_rmap_reset ()
 void
 if_rmap_init (int node)
 {
-  ifrmaphash = hash_create (if_rmap_hash_make, if_rmap_hash_cmp);
+  ifrmaphash = hash_create (if_rmap_hash_make, if_rmap_hash_cmp, NULL);
   if (node == RIPNG_NODE) {
   } else if (node == RIP_NODE) {
     install_element (RIP_NODE, &if_rmap_cmd);
index 4cf7fbca7b2850b3324b155f7d775589feeaee9a..8fa8163970b9ae9bb4235de66daf59ffd445b289 100644 (file)
@@ -97,7 +97,7 @@ void qobj_init (void)
   if (!nodes)
     {
       pthread_rwlock_init (&nodes_lock, NULL);
-      nodes = hash_create (qobj_key, qobj_cmp);
+      nodes = hash_create (qobj_key, qobj_cmp, NULL);
     }
 }
 
index 9eb28888ad6db9142194c558d5faa750763e022c..caba8afd71ff081e962579d5d27ca3ecd9e8eff6 100644 (file)
@@ -1767,7 +1767,7 @@ route_map_dep_hash_alloc(void *p)
   dep_entry = XCALLOC(MTYPE_ROUTE_MAP_DEP, sizeof(struct route_map_dep));
   dep_entry->dep_name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, dep_name);
   dep_entry->dep_rmap_hash = hash_create(route_map_dep_hash_make_key,
-                                        route_map_rmap_hash_cmp);
+                                        route_map_rmap_hash_cmp, NULL);
   dep_entry->this_hash = NULL;
 
   return((void *)dep_entry);
@@ -2986,11 +2986,11 @@ route_map_init (void)
   /* Make vector for match and set. */
   route_match_vec = vector_init (1);
   route_set_vec = vector_init (1);
-  route_map_master_hash = hash_create(route_map_hash_key_make, route_map_hash_cmp);
+  route_map_master_hash = hash_create(route_map_hash_key_make, route_map_hash_cmp, NULL);
 
   for (i = 1; i < ROUTE_MAP_DEP_MAX; i++)
     route_map_dep_hash[i] = hash_create(route_map_dep_hash_make_key,
-                                       route_map_dep_hash_cmp);
+                                       route_map_dep_hash_cmp, NULL);
 
   cmd_variable_handler_register(rmap_var_handlers);
 
index 71b0bb2aed4dc69f4cf7dcd2a551e37bf934e6b9..4e72d4c96f96144a45c3514c662ab8cc8d1875a4 100644 (file)
@@ -388,7 +388,7 @@ thread_master_create (const char *name)
 
   rv->cpu_record = hash_create ((unsigned int (*) (void *))cpu_record_hash_key,
                                 (int (*) (const void *, const void *))
-                                cpu_record_hash_cmp);
+                                cpu_record_hash_cmp, NULL);
 
 
   /* Initialize the timer queues */
index 2d92842b5c2428260d9f935c7680be88e7cb4913..bd884bbc51390781012e964afc65490406322257 100644 (file)
@@ -81,7 +81,7 @@ struct nhrp_cache *nhrp_cache_get(struct interface *ifp, union sockunion *remote
        struct nhrp_cache key;
 
        if (!nifp->cache_hash) {
-               nifp->cache_hash = hash_create(nhrp_cache_protocol_key, nhrp_cache_protocol_cmp);
+               nifp->cache_hash = hash_create(nhrp_cache_protocol_key, nhrp_cache_protocol_cmp, NULL);
                if (!nifp->cache_hash)
                        return NULL;
        }
index d9e8627a14e4173e29cc4e2c08d9145bd62713ef..95541b88b640ab22fca8d55f094ed55f16610a9d 100644 (file)
@@ -182,7 +182,7 @@ struct nhrp_peer *nhrp_peer_get(struct interface *ifp, const union sockunion *re
        struct nhrp_vc *vc;
 
        if (!nifp->peer_hash) {
-               nifp->peer_hash = hash_create(nhrp_peer_key, nhrp_peer_cmp);
+               nifp->peer_hash = hash_create(nhrp_peer_key, nhrp_peer_cmp, NULL);
                if (!nifp->peer_hash) return NULL;
        }
 
index 57fb462ab6efd94391688d6e9260c66b85318200..a5547a7a7e6b22572b4aeb52e781dd721f4021e2 100644 (file)
@@ -196,7 +196,7 @@ void nhrp_vc_init(void)
 {
        size_t i;
 
-       nhrp_vc_hash = hash_create(nhrp_vc_key, nhrp_vc_cmp);
+       nhrp_vc_hash = hash_create(nhrp_vc_key, nhrp_vc_cmp, NULL);
        for (i = 0; i < ZEBRA_NUM_OF(childlist_head); i++)
                list_init(&childlist_head[i]);
 }
index 24b3199397be01ae7d1a8c8e458824080bd32e67..61fbfd7795d663454c94099287393df5bc98b89e 100644 (file)
@@ -17,7 +17,7 @@ static int nhrp_reqid_cmp(const void *data, const void *key)
 uint32_t nhrp_reqid_alloc(struct nhrp_reqid_pool *p, struct nhrp_reqid *r, void (*cb)(struct nhrp_reqid *, void *))
 {
        if (!p->reqid_hash) {
-               p->reqid_hash = hash_create(nhrp_reqid_key, nhrp_reqid_cmp);
+               p->reqid_hash = hash_create(nhrp_reqid_key, nhrp_reqid_cmp, NULL);
                p->next_request_id = 1;
        }
 
index afaa9517242bdfe32a63b314d49035815c6a9229..f4125af9b4c75509f9987a892398921d685ff913 100644 (file)
@@ -180,7 +180,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim)
   pim_ifp->pim_ifchannel_list->cmp = (int (*)(void *, void *)) pim_ifchannel_compare;
 
   pim_ifp->pim_ifchannel_hash = hash_create (pim_ifchannel_hash_key,
-                                             pim_ifchannel_equal);
+                                             pim_ifchannel_equal, NULL);
 
   ifp->info = pim_ifp;
 
index c883a2c8bb46c9052751de3db8e4240a6888be16..ae5f365b829fda5045d382d90fe21ba5887d2375 100644 (file)
@@ -822,7 +822,7 @@ static struct igmp_sock *igmp_sock_new(int fd,
   igmp->igmp_group_list->del = (void (*)(void *)) igmp_group_free;
 
   igmp->igmp_group_hash = hash_create (igmp_group_hash_key,
-                                       igmp_group_hash_equal);
+                                       igmp_group_hash_equal, NULL);
 
   igmp->fd                          = fd;
   igmp->interface                   = ifp;
index 18e24dae32a231ff371ec9f16f3227ed76649e27..71a2869818dab49ae37bcc8782a962987993be7a 100644 (file)
@@ -1570,13 +1570,13 @@ pim_msdp_init(struct thread_master *master)
   msdp->master = master;
 
   msdp->peer_hash = hash_create(pim_msdp_peer_hash_key_make,
-                                 pim_msdp_peer_hash_eq);
+                                 pim_msdp_peer_hash_eq, NULL);
   msdp->peer_list = list_new();
   msdp->peer_list->del = (void (*)(void *))pim_msdp_peer_free;
   msdp->peer_list->cmp = (int (*)(void *, void *))pim_msdp_peer_comp;
 
   msdp->sa_hash = hash_create(pim_msdp_sa_hash_key_make,
-                                 pim_msdp_sa_hash_eq);
+                                 pim_msdp_sa_hash_eq, NULL);
   msdp->sa_list = list_new();
   msdp->sa_list->del = (void (*)(void *))pim_msdp_sa_free;
   msdp->sa_list->cmp = (int (*)(void *, void *))pim_msdp_sa_comp;
index 71ca576d9380d0d27938488fa471efbeeaf3d31e..66be2be6f5ca087d14d4d5074b4a28a988e2ad1b 100644 (file)
@@ -103,7 +103,7 @@ void
 pim_oil_init (void)
 {
   pim_channel_oil_hash = hash_create_size (8192, pim_oil_hash_key,
-                                          pim_oil_equal);
+                                          pim_oil_equal, NULL);
 
   pim_channel_oil_list = list_new();
   if (!pim_channel_oil_list) {
index d7ebdea45d854590ebb697cee57a9d94499cf9fd..442cb02a15632e6b68206c277a413c87d34f4fe5 100644 (file)
@@ -1760,7 +1760,7 @@ pim_upstream_init (void)
                                      pim_upstream_hash_key,
                                      pim_upstream_sg_running);
   pim_upstream_hash = hash_create_size (8192, pim_upstream_hash_key,
-                                       pim_upstream_equal);
+                                       pim_upstream_equal, NULL);
 
   pim_upstream_list = list_new ();
   pim_upstream_list->del = (void (*)(void *)) pim_upstream_free;
index ec1fe5b6d0f2c34abf5213b4c4c6cb4ee4b529be..b1d566f51ba8e3df7732683029f918e7dccd1283 100644 (file)
@@ -250,7 +250,7 @@ pim_instance_init (vrf_id_t vrf_id, afi_t afi)
   pim->spt.switchover = PIM_SPT_IMMEDIATE;
   pim->spt.plist = NULL;
 
-  pim->rpf_hash = hash_create_size (256, pim_rpf_hash_key, pim_rpf_equal);
+  pim->rpf_hash = hash_create_size (256, pim_rpf_hash_key, pim_rpf_equal, NULL);
 
   if (PIM_DEBUG_ZEBRA)
     zlog_debug ("%s: NHT rpf hash init ", __PRETTY_FUNCTION__);
index 07f60668e7db832007494838e1b34cc77b99a0bc..792e2696e90ab7fbf83d75b4dcc93bcdd61c7458 100644 (file)
@@ -140,7 +140,7 @@ test_state_new(void)
   rv->table = srcdest_table_init();
   assert(rv->table);
 
-  rv->log = hash_create(log_key, log_cmp);
+  rv->log = hash_create(log_key, log_cmp, NULL);
   return rv;
 }
 
index a8e7f5372ccf3c7b910c8fd5600e214a16fb34d9..e08ff08cf6e6b82c6ad7bf47b6a2c06b45408afe 100644 (file)
@@ -2994,8 +2994,8 @@ zebra_mpls_init_tables (struct zebra_vrf *zvrf)
 {
   if (!zvrf)
     return;
-  zvrf->slsp_table = hash_create(label_hash, label_cmp);
-  zvrf->lsp_table = hash_create(label_hash, label_cmp);
+  zvrf->slsp_table = hash_create(label_hash, label_cmp, NULL);
+  zvrf->lsp_table = hash_create(label_hash, label_cmp, NULL);
   zvrf->fec_table[AFI_IP] = route_table_init();
   zvrf->fec_table[AFI_IP6] = route_table_init();
   zvrf->mpls_flags = 0;