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

lexical_binding_keyFunction · 0.70
walk_usagesFunction · 0.70
cbm_error_ranges_strFunction · 0.70
compute_fingerprintFunction · 0.70
extract_decoratorsFunction · 0.70
extract_cpp_base_classesFunction · 0.70
make_single_baseFunction · 0.70
collect_csharp_basesFunction · 0.70
extract_ts_basesFunction · 0.70
extract_php_basesFunction · 0.70

Calls 1

arena_growFunction · 0.70

Tested by

no test coverage detected