A Dockerfile Module's image set, parsed from its properties; NULL: none. */
| 165 | |
| 166 | /* A Dockerfile Module's image set, parsed from its properties; NULL: none. */ |
| 167 | static 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 | |
| 185 | static bool ej_in_image(const ej_set_t *s, const char *f) { |
| 186 | bool in = false; |
no test coverage detected