summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-10 17:39:30 -0400
committerJunio C Hamano <gitster@pobox.com>2014-06-12 10:29:43 -0700
commitb000c59b0c80fc187e5e0e48dc9396cd60576c4e (patch)
treeeceae4f00fdd8ddc384ec7d04739686e7b3ea4e1 /commit.h
parent10322a0aaf84382d8901f9ab59e59c39f0c035bb (diff)
downloadgit-b000c59b0c80fc187e5e0e48dc9396cd60576c4e.tar.gz
logmsg_reencode: return const buffer
The return value from logmsg_reencode may be either a newly allocated buffer or a pointer to the existing commit->buffer. We would not want the caller to accidentally free() or modify the latter, so let's mark it as const. We can cast away the constness in logmsg_free, but only once we have determined that it is a free-able buffer. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/commit.h b/commit.h
index 1cb55ae63d..4df48cb688 100644
--- a/commit.h
+++ b/commit.h
@@ -115,10 +115,10 @@ struct userformat_want {
extern int has_non_ascii(const char *text);
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
-extern char *logmsg_reencode(const struct commit *commit,
- char **commit_encoding,
- const char *output_encoding);
-extern void logmsg_free(char *msg, const struct commit *commit);
+extern const char *logmsg_reencode(const struct commit *commit,
+ char **commit_encoding,
+ const char *output_encoding);
+extern void logmsg_free(const char *msg, const struct commit *commit);
extern void get_commit_format(const char *arg, struct rev_info *);
extern const char *format_subject(struct strbuf *sb, const char *msg,
const char *line_separator);