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

Function df_add_file

src/mcp/test_impact_diff.c:145–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145static cbm_diff_file_t *df_add_file(cbm_diff_t *d, const char *path) {
146 if (d->file_count == d->file_cap) {
147 int cap = d->file_cap > 0 ? d->file_cap * DF_GROWTH : DF_FIRST_CAP;
148 cbm_diff_file_t *grown = cbm_arena_alloc(&d->arena, (size_t)cap * sizeof(*grown));
149 if (!grown) {
150 return NULL;
151 }
152 if (d->file_count > 0) {
153 memcpy(grown, d->files, (size_t)d->file_count * sizeof(*grown));
154 }
155 d->files = grown;
156 d->file_cap = cap;
157 }
158 cbm_diff_file_t *file = &d->files[d->file_count++];
159 *file = (cbm_diff_file_t){.path = path};
160 return file;
161}
162
163/* The hunks of the file being read; handed to the file when it ends. */
164typedef struct {

Callers 1

df_readFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected