summaryrefslogtreecommitdiff
path: root/patch-ids.c
diff options
context:
space:
mode:
Diffstat (limited to 'patch-ids.c')
-rw-r--r--patch-ids.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/patch-ids.c b/patch-ids.c
index 12aa6d4..f51021a 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -71,7 +71,7 @@ int init_patch_ids(struct repository *r, struct patch_ids *ids)
int free_patch_ids(struct patch_ids *ids)
{
- hashmap_free_entries(&ids->patches, struct patch_id, ent);
+ hashmap_clear_and_free(&ids->patches, struct patch_id, ent);
return 0;
}
@@ -89,7 +89,7 @@ static int init_patch_id_entry(struct patch_id *patch,
return 0;
}
-struct patch_id *has_commit_patch_id(struct commit *commit,
+struct patch_id *patch_id_iter_first(struct commit *commit,
struct patch_ids *ids)
{
struct patch_id patch;
@@ -104,6 +104,18 @@ struct patch_id *has_commit_patch_id(struct commit *commit,
return hashmap_get_entry(&ids->patches, &patch, ent, NULL);
}
+struct patch_id *patch_id_iter_next(struct patch_id *cur,
+ struct patch_ids *ids)
+{
+ return hashmap_get_next_entry(&ids->patches, cur, ent);
+}
+
+int has_commit_patch_id(struct commit *commit,
+ struct patch_ids *ids)
+{
+ return !!patch_id_iter_first(commit, ids);
+}
+
struct patch_id *add_commit_patch_id(struct commit *commit,
struct patch_ids *ids)
{