struct patch_id *has_commit_patch_id(struct commit *commit, struct patch_ids *ids) { struct patch_id patch; if (!patch_id_defined(commit)) return NULL; memset(&patch, 0, sizeof(patch)); if (init_patch_id_entry(&patch, commit, ids)) return NULL; return hashmap_get(&ids->patches, &patch, NULL); }
struct patch_id *add_commit_patch_id(struct commit *commit, struct patch_ids *ids) { struct patch_id *key = xcalloc(1, sizeof(*key)); if (!patch_id_defined(commit)) return NULL; if (init_patch_id_entry(key, commit, ids)) { free(key); return NULL; } hashmap_add(&ids->patches, key); return key; }