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

Function cbm_arena_alloc

internal/cbm/arena.c:35–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void *cbm_arena_alloc(CBMArena *a, size_t n) {
36 if (!a || n == 0) {
37 return NULL;
38 }
39 // 8-byte alignment
40 n = (n + 7) & ~(size_t)7;
41
42 if (a->nblocks == 0) {
43 return NULL;
44 }
45
46 if (a->used + n > a->block_size) {
47 if (!arena_grow(a, n)) {
48 return NULL;
49 }
50 }
51
52 char *ptr = a->blocks[a->nblocks - SKIP_ONE] + a->used;
53 a->used += n;
54 return ptr;
55}
56
57char *cbm_arena_strdup(CBMArena *a, const char *s) {
58 if (!s)

Callers 15

oa_operationFunction · 0.70
cbm_doclinks_pushFunction · 0.70
twin_keysFunction · 0.70
jv_reserveFunction · 0.70
jv_clean_docFunction · 0.70
jv_pushFunction · 0.70
jv_tmp_allocFunction · 0.70
lexical_binding_keyFunction · 0.70
walk_usagesFunction · 0.70

Calls 1

arena_growFunction · 0.70

Tested by 15

gic_long_makeFunction · 0.40
pv2_stress_inputFunction · 0.40
pf_config_boundaryFunction · 0.40
pt_current_sidFunction · 0.40
pt_populateFunction · 0.40
pt_acl_linux_attributeFunction · 0.40
ptr_read_okFunction · 0.40
gfi_raw_tree_formatFunction · 0.40
gfb_openFunction · 0.40
gfb_frameFunction · 0.40
gfb_concatFunction · 0.40
ov_copyFunction · 0.40