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 <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b56166ca57
commit
11f9e8de3d
@ -271,7 +271,7 @@ const char *get_git_work_tree(void)
|
||||
return the_repository->worktree;
|
||||
}
|
||||
|
||||
char *get_object_directory(void)
|
||||
const char *get_object_directory(void)
|
||||
{
|
||||
if (!the_repository->objects->odb)
|
||||
BUG("git environment hasn't been setup");
|
||||
|
Reference in New Issue
Block a user