summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2019-11-20 00:51:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-20 04:33:36 (GMT)
commit4982516451ed4979bc7fc1a7f002fc310b060118 (patch)
treeaad68030729a47275260b369ce139f2b92d47f3a /revision.c
parentf0f9de2bd71b41afeb2a2a77a681a15a83246a62 (diff)
downloadgit-4982516451ed4979bc7fc1a7f002fc310b060118.zip
git-4982516451ed4979bc7fc1a7f002fc310b060118.tar.gz
git-4982516451ed4979bc7fc1a7f002fc310b060118.tar.bz2
revision: make get_revision_mark() return const pointer
get_revision_mark() used to return a `char *`, even though all of the strings it was returning were string literals. Make get_revision_mark() return a `const char *` so that callers won't be tempted to modify the returned string. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 0741229..2eb9ff0 100644
--- a/revision.c
+++ b/revision.c
@@ -3934,7 +3934,7 @@ struct commit *get_revision(struct rev_info *revs)
return c;
}
-char *get_revision_mark(const struct rev_info *revs, const struct commit *commit)
+const char *get_revision_mark(const struct rev_info *revs, const struct commit *commit)
{
if (commit->object.flags & BOUNDARY)
return "-";
@@ -3956,7 +3956,7 @@ char *get_revision_mark(const struct rev_info *revs, const struct commit *commit
void put_revision_mark(const struct rev_info *revs, const struct commit *commit)
{
- char *mark = get_revision_mark(revs, commit);
+ const char *mark = get_revision_mark(revs, commit);
if (!strlen(mark))
return;
fputs(mark, stdout);