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>
This commit is contained in:

committed by
Junio C Hamano

parent
10322a0aaf
commit
b000c59b0c
@ -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);
|
||||
|
Reference in New Issue
Block a user