MCPcopy Create free account
hub / github.com/F-Stack/f-stack / HashInsert

Method HashInsert

adapter/micro_thread/hash_list.h:90–107  ·  view source on GitHub ↗

* @brief hash insert key. */

Source from the content-addressed store, hash-verified

88 * @brief hash insert key.
89 */
90 int HashInsert(HashKey* key) {
91 if (!key || !_buckets) {
92 return -1;
93 }
94
95 if ((key->_hash_value != 0) || (key->_next_entry != NULL)) {
96 return -2;
97 }
98
99 key->_hash_value = key->HashValue();
100 int idx = (key->_hash_value) % _max;
101
102 HashKey* next_item = _buckets[idx];
103 _buckets[idx] = key;
104 key->_next_entry = next_item;
105 _count++;
106 return 0;
107 }
108
109 /**
110 * @brief hash lookup key.

Callers 5

InsertSessionMethod · 0.80
InsertNetItemMethod · 0.80
InsertDestLinkMethod · 0.80
GetMsgBufMethod · 0.80
CacheTcpKeepConnMethod · 0.80

Calls 1

HashValueMethod · 0.45

Tested by

no test coverage detected