MCPcopy Index your code
hub / github.com/F-Stack/f-stack / ng_ID_rehash

Function ng_ID_rehash

lib/ff_ng_base.c:1013–1039  ·  view source on GitHub ↗

* Allocate a bigger ID hash. */

Source from the content-addressed store, hash-verified

1011 * Allocate a bigger ID hash.
1012 */
1013static void
1014ng_ID_rehash()
1015{
1016 struct nodehash *new;
1017 uint32_t hash;
1018 u_long hmask;
1019 node_p node, node2;
1020 int i;
1021
1022 new = hashinit_flags((V_ng_ID_hmask + 1) * 2, M_NETGRAPH_NODE, &hmask,
1023 HASH_NOWAIT);
1024 if (new == NULL)
1025 return;
1026
1027 for (i = 0; i <= V_ng_ID_hmask; i++)
1028 LIST_FOREACH_SAFE(node, &V_ng_ID_hash[i], nd_idnodes, node2) {
1029#ifdef INVARIANTS
1030 LIST_REMOVE(node, nd_idnodes);
1031#endif
1032 hash = (node->nd_ID % (hmask + 1));
1033 LIST_INSERT_HEAD(&new[hash], node, nd_idnodes);
1034 }
1035
1036 hashdestroy(V_ng_ID_hash, M_NETGRAPH_NODE, V_ng_name_hmask);
1037 V_ng_ID_hash = new;
1038 V_ng_ID_hmask = hmask;
1039}
1040
1041/************************************************************************
1042 Hook routines

Callers 1

ng_make_node_commonFunction · 0.70

Calls 2

hashinit_flagsFunction · 0.70
hashdestroyFunction · 0.70

Tested by

no test coverage detected