summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-04-25 18:27:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-04-25 18:31:13 (GMT)
commit11f9e8de3d1a3d484c452141f1fcdbd707457ec0 (patch)
treea5dad66bc4f77b7137b129f9bc79f0ed43e7d866 /environment.c
parentb56166ca57678795b4159b6a48b64fbacb93e73d (diff)
downloadgit-11f9e8de3d1a3d484c452141f1fcdbd707457ec0.zip
git-11f9e8de3d1a3d484c452141f1fcdbd707457ec0.tar.gz
git-11f9e8de3d1a3d484c452141f1fcdbd707457ec0.tar.bz2
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>
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/environment.c b/environment.c
index fd0501e..4e49ee0 100644
--- a/environment.c
+++ b/environment.c
@@ -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");