From 11f9e8de3d1a3d484c452141f1fcdbd707457ec0 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 25 Apr 2022 18:27:14 +0000 Subject: cache: use const char * for get_object_directory() The get_object_directory() method returns the exact string stored at the_repository->objects->odb->path. The return type of "char *" implies that the caller must keep track of the buffer and free() it when complete. This causes significant problems later when the ODB is accessed. Use "const char *" as the return type to avoid this confusion. There are no current callers that care about the non-const definition. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- cache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cache.h') diff --git a/cache.h b/cache.h index 281f00ab1b..d8b0dc2ff1 100644 --- a/cache.h +++ b/cache.h @@ -567,7 +567,7 @@ extern char *git_work_tree_cfg; int is_inside_work_tree(void); const char *get_git_dir(void); const char *get_git_common_dir(void); -char *get_object_directory(void); +const char *get_object_directory(void); char *get_index_file(void); char *get_graft_file(struct repository *r); void set_git_dir(const char *path, int make_realpath); -- cgit v1.3