typedef struct { Noh_String path; Noh_String id; } Id; typedef struct { Id *elems; size_t count; size_t capacity; } Id_Store; Id_Store id_store = {0}; SV get_id(SV path) { for (size_t i = 0; i < id_store.count; i++) { if (noh_sv_eq(path, noh_sv_from_string(id_store.elems[i].path))) return noh_sv_from_string(id_store.elems[i].id); } uuid_t uuid; uuid_generate(uuid); char uuid_str[36]; uuid_unparse(uuid, uuid_str); Noh_String new_id = {0}; noh_string_append_cstr(&new_id, "urn:uuid:"); noh_string_append_cstr(&new_id, uuid_str); Noh_String stored_path = {0}; noh_string_append_sv(&stored_path, path); noh_da_append(&id_store, ((Id){ .path = stored_path, .id = new_id })); return noh_sv_from_string(new_id); }