aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-03-12 10:56:04 -0700
committerJunio C Hamano <gitster@pobox.com>2026-03-12 10:56:04 -0700
commit9a591a99d000059f10e9095bb2adee2d28c4318d (patch)
treeb61e128c6365a548b4a66349b3524027923bcb01 /builtin
parent642aa4f3936d2d39f6d96df5abfe0edf427bb446 (diff)
parenta98ea50288c9fd39b501710635977478fb1f0a05 (diff)
downloadgit-9a591a99d000059f10e9095bb2adee2d28c4318d.tar.xz
Merge branch 'sk/oidmap-clear-with-custom-free-func'
A bit of OIDmap API enhancement and cleanup. * sk/oidmap-clear-with-custom-free-func: builtin/rev-list: migrate missing_objects cleanup to oidmap_clear_with_free() oidmap: make entry cleanup explicit in oidmap_clear
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rev-list.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index ddea8aa251..854d82ece3 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -88,9 +88,19 @@ static int arg_print_omitted; /* print objects omitted by filter */
struct missing_objects_map_entry {
struct oidmap_entry entry;
- const char *path;
+ char *path;
unsigned type;
};
+
+static void missing_objects_map_entry_free(void *e)
+{
+ struct missing_objects_map_entry *entry =
+ container_of(e, struct missing_objects_map_entry, entry);
+
+ free(entry->path);
+ free(entry);
+}
+
static struct oidmap missing_objects;
enum missing_action {
MA_ERROR = 0, /* fail if any missing objects are encountered */
@@ -935,10 +945,9 @@ int cmd_rev_list(int argc,
while ((entry = oidmap_iter_next(&iter))) {
print_missing_object(entry, arg_missing_action ==
MA_PRINT_INFO);
- free((void *)entry->path);
}
- oidmap_clear(&missing_objects, true);
+ oidmap_clear_with_free(&missing_objects, missing_objects_map_entry_free);
}
stop_progress(&progress);