Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-04-13 23:01:52 +0300
committerJunio C Hamano <gitster@pobox.com>2022-04-14 09:56:10 +0300
commit81ffbf838070bf68970688e4a11399f58c562cce (patch)
tree41d5d0f3e01f8be7c9c0895e1c63e33eb8f85eea /reflog-walk.c
parentab1f6926e90e00ac2ea649e67355f0a0669c0541 (diff)
revisions API: release "reflog_info" in release revisions()
Add a missing reflog_walk_info_release() to "reflog-walk.c" and use it in release_revisions(). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reflog-walk.c')
-rw-r--r--reflog-walk.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/reflog-walk.c b/reflog-walk.c
index 8ac4b284b6..7aa6595a51 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -8,7 +8,7 @@
struct complete_reflogs {
char *ref;
- const char *short_ref;
+ char *short_ref;
struct reflog_info {
struct object_id ooid, noid;
char *email;
@@ -51,9 +51,16 @@ static void free_complete_reflog(struct complete_reflogs *array)
}
free(array->items);
free(array->ref);
+ free(array->short_ref);
free(array);
}
+static void complete_reflogs_clear(void *util, const char *str)
+{
+ struct complete_reflogs *array = util;
+ free_complete_reflog(array);
+}
+
static struct complete_reflogs *read_complete_reflog(const char *ref)
{
struct complete_reflogs *reflogs =
@@ -116,6 +123,21 @@ void init_reflog_walk(struct reflog_walk_info **info)
(*info)->complete_reflogs.strdup_strings = 1;
}
+void reflog_walk_info_release(struct reflog_walk_info *info)
+{
+ size_t i;
+
+ if (!info)
+ return;
+
+ for (i = 0; i < info->nr; i++)
+ free(info->logs[i]);
+ string_list_clear_func(&info->complete_reflogs,
+ complete_reflogs_clear);
+ free(info->logs);
+ free(info);
+}
+
int add_reflog_for_walk(struct reflog_walk_info *info,
struct commit *commit, const char *name)
{