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

Function kl_push

internal/cbm/pdf/pdf_obj.c:752–772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750} kv_list_t;
751
752static void kl_push(kv_list_t *l, const unsigned char *key, size_t klen, pdf_val_t *val) {
753 if (l->fail) {
754 return;
755 }
756 if (l->n == l->cap) {
757 int ncap = l->cap ? l->cap * 2 : PDF_MAP_MIN;
758 kv_seq_t *g =
759 (kv_seq_t *)cbm_realloc(CBM_MEM_CLASS_EXTRACT, l->v, (size_t)ncap * sizeof(*g));
760 if (!g) {
761 l->fail = true;
762 return;
763 }
764 l->v = g;
765 l->cap = ncap;
766 }
767 l->v[l->n].kv.key = key;
768 l->v[l->n].kv.klen = klen;
769 l->v[l->n].kv.val = val;
770 l->v[l->n].seq = l->n;
771 l->n++;
772}
773
774/* A dict from key/value pairs in written order: one entry per key, the last
775 * written (keep_last) or the first. */

Callers 3

pdf_parse_valueFunction · 0.85
load_xrefFunction · 0.85
reconstructFunction · 0.85

Calls 1

cbm_reallocFunction · 0.85

Tested by

no test coverage detected