MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / result_push

Function result_push

src/simhash/minhash.c:437–451  ·  view source on GitHub ↗

Append a candidate to the result buffer, growing if needed. */

Source from the content-addressed store, hash-verified

435
436/* Append a candidate to the result buffer, growing if needed. */
437static bool result_push(cbm_lsh_index_t *idx, const cbm_lsh_entry_t *candidate) {
438 if (idx->result_count >= idx->result_cap) {
439 int new_cap =
440 idx->result_cap < RESULT_INIT_CAP ? RESULT_INIT_CAP : idx->result_cap * GROW_FACTOR;
441 const cbm_lsh_entry_t **new_buf =
442 realloc(idx->result_buf, (size_t)new_cap * sizeof(const cbm_lsh_entry_t *));
443 if (!new_buf) {
444 return false;
445 }
446 idx->result_buf = new_buf;
447 idx->result_cap = new_cap;
448 }
449 idx->result_buf[idx->result_count++] = candidate;
450 return true;
451}
452
453void cbm_lsh_query(const cbm_lsh_index_t *idx, const cbm_minhash_t *fp,
454 const cbm_lsh_entry_t ***out, int *count) {

Callers 1

cbm_lsh_queryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected