MCPcopy Create free account
hub / github.com/ElementsProject/lightning / queries_htable

Function queries_htable

devtools/sql-rewrite.py:178–189  ·  view source on GitHub ↗
(queries)

Source from the content-addressed store, hash-verified

176
177
178def queries_htable(queries):
179 # Converts a list of queries into a hash table.
180 tablesize = len(queries) * 2 - 1
181 htable = [{'name': None}] * tablesize
182
183 for q in queries:
184 pos = hash_djb2(q['name']) % tablesize
185 while htable[pos]['name'] is not None:
186 pos = (pos + 1) % tablesize
187 htable[pos] = q
188
189 return htable
190
191
192def extract_queries(pofile):

Callers 1

extract_queriesFunction · 0.85

Calls 1

hash_djb2Function · 0.70

Tested by

no test coverage detected