diff options
author | Jeff King <peff@peff.net> | 2014-06-10 17:39:30 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-12 10:29:43 -0700 |
commit | b000c59b0c80fc187e5e0e48dc9396cd60576c4e (patch) | |
tree | eceae4f00fdd8ddc384ec7d04739686e7b3ea4e1 /builtin | |
parent | do not create "struct commit" with xcalloc (diff) | |
download | tgif-b000c59b0c80fc187e5e0e48dc9396cd60576c4e.tar.xz |
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 'builtin')
-rw-r--r-- | builtin/blame.c | 2 | ||||
-rw-r--r-- | builtin/reset.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/builtin/blame.c b/builtin/blame.c index 6e22bdfbfa..85a3681306 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1405,7 +1405,7 @@ static void get_commit_info(struct commit *commit, { int len; const char *subject, *encoding; - char *message; + const char *message; commit_info_init(ret); diff --git a/builtin/reset.c b/builtin/reset.c index f4e087596b..b5312c4c65 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -93,7 +93,7 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet) static void print_new_head_line(struct commit *commit) { const char *hex, *body; - char *msg; + const char *msg; hex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV); printf(_("HEAD is now at %s"), hex); |