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

Function sb_put

internal/cbm/doc_pdf.c:1016–1036  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1014} sbuf_t;
1015
1016static void sb_put(sbuf_t *b, const char *s, size_t n) {
1017 if (b->fail) {
1018 return;
1019 }
1020 if (b->n + n + 1 > b->cap) {
1021 size_t ncap = b->cap ? b->cap * 2 : 256;
1022 while (ncap < b->n + n + 1) {
1023 ncap *= 2;
1024 }
1025 char *g = (char *)cbm_realloc(CBM_MEM_CLASS_EXTRACT, b->p, ncap);
1026 if (!g) {
1027 b->fail = true;
1028 return;
1029 }
1030 b->p = g;
1031 b->cap = ncap;
1032 }
1033 memcpy(b->p + b->n, s, n);
1034 b->n += n;
1035 b->p[b->n] = '\0';
1036}
1037
1038static void sb_cps(sbuf_t *b, const uint32_t *s, int n) {
1039 char u[PDF_U8_MAX];

Callers 2

sb_cpsFunction · 0.85
scan_pageFunction · 0.85

Calls 1

cbm_reallocFunction · 0.85

Tested by

no test coverage detected