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

Function pdf_map_put

internal/cbm/pdf/pdf_obj.c:251–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251bool pdf_map_put(pdf_map_t *m, uint64_t key, int64_t val) {
252 if ((m->n + 1) * 2 > m->cap && !map_grow(m)) {
253 return false;
254 }
255 uint32_t mask = m->cap - 1;
256 uint32_t i = (uint32_t)map_mix(key) & mask;
257 while (m->vals[i] >= 0) {
258 if (m->keys[i] == key) {
259 m->vals[i] = val;
260 return true;
261 }
262 i = (i + 1) & mask;
263 }
264 m->keys[i] = key;
265 m->vals[i] = val;
266 m->n++;
267 return true;
268}
269
270void pdf_map_free(pdf_map_t *m) {
271 cbm_free(CBM_MEM_CLASS_EXTRACT, m->keys);

Callers 5

pdf_font_forFunction · 0.85
do_xobjectFunction · 0.85
collect_pagesFunction · 0.85
xref_slotFunction · 0.85
load_xrefFunction · 0.85

Calls 2

map_growFunction · 0.85
map_mixFunction · 0.85

Tested by

no test coverage detected