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

Function ej_set_parse

src/pipeline/pass_envjoin.c:167–183  ·  view source on GitHub ↗

A Dockerfile Module's image set, parsed from its properties; NULL: none. */

Source from the content-addressed store, hash-verified

165
166/* A Dockerfile Module's image set, parsed from its properties; NULL: none. */
167static ej_set_t *ej_set_parse(CBMArena *a, const char *path, const char *props) {
168 if (!props || !strstr(props, "\"image_files\"")) {
169 return NULL;
170 }
171 yyjson_doc *doc = yyjson_read(props, strlen(props), 0);
172 yyjson_val *root = doc ? yyjson_doc_get_root(doc) : NULL;
173 ej_set_t *s = root ? cbm_arena_alloc(a, sizeof(*s)) : NULL;
174 if (s) {
175 *s = (ej_set_t){.dockerfile = cbm_arena_strdup(a, path ? path : "")};
176 s->files = ej_strings(a, yyjson_obj_get(root, "image_files"), &s->nfiles);
177 s->ignore = ej_strings(a, yyjson_obj_get(root, "image_ignore"), &s->nignore);
178 }
179 if (doc) {
180 yyjson_doc_free(doc);
181 }
182 return s && s->nfiles > 0 ? s : NULL;
183}
184
185static bool ej_in_image(const ej_set_t *s, const char *f) {
186 bool in = false;

Callers 2

cbm_envjoin_props_holdFunction · 0.85
ej_add_setFunction · 0.85

Calls 3

ej_stringsFunction · 0.85
cbm_arena_allocFunction · 0.50
cbm_arena_strdupFunction · 0.50

Tested by

no test coverage detected