prepare_index(): declare return value to be (const char *)

Declare the return value to be const to make it clear that we aren't giving callers permission to write over the string that it points at. (The return value is the filename field of a struct lock_file, which can be used by a signal handler at any time and therefore shouldn't be tampered with.) Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Oct 1, 2014 at 12:28 UTC 35ff08be099b36d0be855040a296f985d25dfd0a
1 file changed +2 -2
builtin/commit.c
+2 -2
@@ -315,8 +315,8 @@ static void refresh_cache_or_die(int refresh_flags)
315 die_resolve_conflict("commit");
316 }
317
318 -static char *prepare_index(int argc, const char **argv, const char *prefix,
319 - const struct commit *current_head, int is_status)
318 +static const char *prepare_index(int argc, const char **argv, const char *prefix,
319 + const struct commit *current_head, int is_status)
320 {
321 struct string_list partial;
322 struct pathspec pathspec;