Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Free the revision walks' arguments and state
Diffstat (limited to 'source')
-rw-r--r--source/ui-blame.c6
-rw-r--r--source/ui-log.c5
-rw-r--r--source/ui-patch.c4
-rw-r--r--source/ui-stats.c4
4 files changed, 13 insertions, 6 deletions
diff --git a/source/ui-blame.c b/source/ui-blame.c
index b07e57d..eef8602 100644
--- a/source/ui-blame.c
+++ b/source/ui-blame.c
@@ -48,7 +48,8 @@ static void run_blame(struct blame_scoreboard *sb, struct rev_info *revs,
strvec_push(&argv, rev);
repo_init_revisions(the_repository, revs, NULL);
revs->diffopt.flags.allow_textconv = 1;
- setup_revisions(argv.nr, argv.v, revs, NULL);
+ setup_revisions_from_strvec(&argv, revs, NULL);
+ strvec_clear(&argv);
init_scoreboard(sb);
sb->revs = revs;
sb->repo = the_repository;
@@ -242,7 +243,7 @@ static void print_blame_page(const struct object_id *oid, const char *path,
enum object_type type;
char *buf;
size_t size;
- struct rev_info revs;
+ struct rev_info revs = REV_INFO_INIT;
struct blame_scoreboard sb;
int binary;
@@ -315,6 +316,7 @@ cleanup:
cgit_print_layout_end();
string_list_clear(&suspect_details, 1);
free(buf);
+ release_revisions(&revs);
}
static int walk_tree(const struct object_id *oid, struct strbuf *base,
diff --git a/source/ui-log.c b/source/ui-log.c
index 2211aa0..ef52951 100644
--- a/source/ui-log.c
+++ b/source/ui-log.c
@@ -453,7 +453,7 @@ int cgit_log_columns(int graph)
void cgit_print_log(const char *tip, int ofs, int cnt, const char *grep, const char *pattern,
const char *path, int pager, int commit_graph, int commit_sort, int table_columns)
{
- struct rev_info rev;
+ struct rev_info rev = REV_INFO_INIT;
struct commit *commit;
struct strvec rev_argv = STRVEC_INIT;
struct string_list tokens = STRING_LIST_INIT_DUP;
@@ -528,7 +528,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, const char *grep, const c
// The author and committer searches then match the mapped idents.
rev.mailmap = cgit_mailmap();
rev.ignore_missing = 1;
- setup_revisions(rev_argv.nr, rev_argv.v, &rev, NULL);
+ setup_revisions_from_strvec(&rev_argv, &rev, NULL);
load_ref_decorations(NULL, DECORATE_FULL_REFS);
rev.show_decorations = 1;
@@ -613,6 +613,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, const char *grep, const c
}
out:
+ release_revisions(&rev);
if (must_free_tip)
free((char *)tip);
strvec_clear(&rev_argv);
diff --git a/source/ui-patch.c b/source/ui-patch.c
index 0d29e38..3c76255 100644
--- a/source/ui-patch.c
+++ b/source/ui-patch.c
@@ -66,7 +66,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref
// process.
if (prefix)
rev.diffopt.stat_sep = xstrfmt("(limited to '%s')\n\n", prefix);
- setup_revisions(rev_argv.nr, rev_argv.v, &rev, NULL);
+ setup_revisions_from_strvec(&rev_argv, &rev, NULL);
// A single commit resolves to a range starting at its parent, so this
// only ever cuts an explicit range short and keeps one request from
// emitting a patch for the whole history.
@@ -74,6 +74,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref
rev.max_count = ctx.cfg.max_patch_count;
// The headers wait until the walk has started.
if (cgit_prepare_walk(&rev)) {
+ release_revisions(&rev);
strvec_clear(&rev_argv);
return;
}
@@ -97,5 +98,6 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref
else
printf("-- \ncgit\n\n");
}
+ release_revisions(&rev);
strvec_clear(&rev_argv);
}
diff --git a/source/ui-stats.c b/source/ui-stats.c
index a0ad442..f3ad25e 100644
--- a/source/ui-stats.c
+++ b/source/ui-stats.c
@@ -212,12 +212,13 @@ static int collect_stats(const struct cgit_period *period, struct string_list *a
strvec_pushl(&argv, "--", ctx.qry.path, NULL);
repo_init_revisions(the_repository, &rev, NULL);
rev.max_parents = 1;
- setup_revisions(argv.nr, argv.v, &rev, NULL);
+ setup_revisions_from_strvec(&argv, &rev, NULL);
// Prune the walk to the displayed window instead of traversing the
// whole history and discarding older commits. The check below still
// bounds the period edge exactly.
rev.max_age = since;
if (cgit_prepare_walk(&rev)) {
+ release_revisions(&rev);
strvec_clear(&argv);
return -1;
}
@@ -231,6 +232,7 @@ static int collect_stats(const struct cgit_period *period, struct string_list *a
release_commit_memory(the_repository->parsed_objects, commit);
commit->parents = NULL;
}
+ release_revisions(&rev);
strvec_clear(&argv);
return 0;
}