summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-02-11 21:44:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-02-11 21:44:07 (GMT)
commitc985aaf87909ab7f8194b3cfed3a744cbff78fe9 (patch)
tree37416fd6c423c75204b505e7a71ca1812a3a1f29 /revision.c
parentcba07bb6ff58da5aa4538c4a2bbf70b717b172b3 (diff)
parent167832c2ca8e42572c0e8d329a78dbace2ecf2db (diff)
downloadgit-c985aaf87909ab7f8194b3cfed3a744cbff78fe9.zip
git-c985aaf87909ab7f8194b3cfed3a744cbff78fe9.tar.gz
git-c985aaf87909ab7f8194b3cfed3a744cbff78fe9.tar.bz2
Merge branch 'jc/unused-symbols'
Mark file-local symbols as "static", and drop functions that nobody uses. * jc/unused-symbols: shallow.c: make check_shallow_file_for_update() static remote.c: make clear_cas_option() static urlmatch.c: make match_urls() static revision.c: make save_parents() and free_saved_parents() static line-log.c: make line_log_data_init() static pack-bitmap.c: make pack_bitmap_filename() static prompt.c: remove git_getpass() nobody uses http.c: make finish_active_slot() and handle_curl_result() static
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c106
1 files changed, 55 insertions, 51 deletions
diff --git a/revision.c b/revision.c
index 4bc851c..66520c6 100644
--- a/revision.c
+++ b/revision.c
@@ -2970,6 +2970,61 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
return commit_show;
}
+define_commit_slab(saved_parents, struct commit_list *);
+
+#define EMPTY_PARENT_LIST ((struct commit_list *)-1)
+
+/*
+ * You may only call save_parents() once per commit (this is checked
+ * for non-root commits).
+ */
+static void save_parents(struct rev_info *revs, struct commit *commit)
+{
+ struct commit_list **pp;
+
+ if (!revs->saved_parents_slab) {
+ revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents));
+ init_saved_parents(revs->saved_parents_slab);
+ }
+
+ pp = saved_parents_at(revs->saved_parents_slab, commit);
+
+ /*
+ * When walking with reflogs, we may visit the same commit
+ * several times: once for each appearance in the reflog.
+ *
+ * In this case, save_parents() will be called multiple times.
+ * We want to keep only the first set of parents. We need to
+ * store a sentinel value for an empty (i.e., NULL) parent
+ * list to distinguish it from a not-yet-saved list, however.
+ */
+ if (*pp)
+ return;
+ if (commit->parents)
+ *pp = copy_commit_list(commit->parents);
+ else
+ *pp = EMPTY_PARENT_LIST;
+}
+
+static void free_saved_parents(struct rev_info *revs)
+{
+ if (revs->saved_parents_slab)
+ clear_saved_parents(revs->saved_parents_slab);
+}
+
+struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit)
+{
+ struct commit_list *parents;
+
+ if (!revs->saved_parents_slab)
+ return commit->parents;
+
+ parents = *saved_parents_at(revs->saved_parents_slab, commit);
+ if (parents == EMPTY_PARENT_LIST)
+ return NULL;
+ return parents;
+}
+
enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
{
enum commit_action action = get_commit_action(revs, commit);
@@ -3269,54 +3324,3 @@ void put_revision_mark(const struct rev_info *revs, const struct commit *commit)
fputs(mark, stdout);
putchar(' ');
}
-
-define_commit_slab(saved_parents, struct commit_list *);
-
-#define EMPTY_PARENT_LIST ((struct commit_list *)-1)
-
-void save_parents(struct rev_info *revs, struct commit *commit)
-{
- struct commit_list **pp;
-
- if (!revs->saved_parents_slab) {
- revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents));
- init_saved_parents(revs->saved_parents_slab);
- }
-
- pp = saved_parents_at(revs->saved_parents_slab, commit);
-
- /*
- * When walking with reflogs, we may visit the same commit
- * several times: once for each appearance in the reflog.
- *
- * In this case, save_parents() will be called multiple times.
- * We want to keep only the first set of parents. We need to
- * store a sentinel value for an empty (i.e., NULL) parent
- * list to distinguish it from a not-yet-saved list, however.
- */
- if (*pp)
- return;
- if (commit->parents)
- *pp = copy_commit_list(commit->parents);
- else
- *pp = EMPTY_PARENT_LIST;
-}
-
-struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit)
-{
- struct commit_list *parents;
-
- if (!revs->saved_parents_slab)
- return commit->parents;
-
- parents = *saved_parents_at(revs->saved_parents_slab, commit);
- if (parents == EMPTY_PARENT_LIST)
- return NULL;
- return parents;
-}
-
-void free_saved_parents(struct rev_info *revs)
-{
- if (revs->saved_parents_slab)
- clear_saved_parents(revs->saved_parents_slab);
-}