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

Function result_push

src/simhash/minhash.c:458–473  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

456
457/* Append a candidate to the result buffer, growing if needed. */
458static bool result_push(cbm_lsh_index_t *idx, const cbm_lsh_entry_t *candidate) {
459 if (idx->result_count >= idx->result_cap) {
460 int new_cap =
461 idx->result_cap < RESULT_INIT_CAP ? RESULT_INIT_CAP : idx->result_cap * GROW_FACTOR;
462 const cbm_lsh_entry_t **new_buf =
463 cbm_realloc(CBM_MEM_CLASS_SEMANTIC, idx->result_buf,
464 (size_t)new_cap * sizeof(const cbm_lsh_entry_t *));
465 if (!new_buf) {
466 return false;
467 }
468 idx->result_buf = new_buf;
469 idx->result_cap = new_cap;
470 }
471 idx->result_buf[idx->result_count++] = candidate;
472 return true;
473}
474
475void cbm_lsh_query(const cbm_lsh_index_t *idx, const cbm_minhash_t *fp,
476 const cbm_lsh_entry_t ***out, int *count) {

Callers 1

cbm_lsh_queryFunction · 0.85

Calls 1

cbm_reallocFunction · 0.85

Tested by

no test coverage detected