summaryrefslogtreecommitdiffstats
path: root/config.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-16 12:44:57 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-16 18:46:24 +0200
commita70a9bf6eec832b808a805de318601684b19f18e (patch)
treeaca5b36515a0cf6fc94eec7e2cdf6573fb29f6dd /config.c
parentThe third batch (diff)
downloadgit-a70a9bf6eec832b808a805de318601684b19f18e.tar.xz
git-a70a9bf6eec832b808a805de318601684b19f18e.zip
config: fix constness of out parameter for `git_config_get_expiry()`
The type of the out parameter of `git_config_get_expiry()` is a pointer to a constant string, which creates the impression that ownership of the returned data wasn't transferred to the caller. This isn't true though and thus quite misleading. Adapt the parameter to be of type `char **` and adjust callers accordingly. While at it, refactor `get_shared_index_expire_date()` to drop the static `shared_index_expire` variable. It is only used in that function, and furthermore we would only hit the code where we parse the expiry date a single time because we already use a static `prepared` variable to track whether we did parse it. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/config.c b/config.c
index 6421894614..dfa4df1417 100644
--- a/config.c
+++ b/config.c
@@ -2766,9 +2766,9 @@ int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-int git_config_get_expiry(const char *key, const char **output)
+int git_config_get_expiry(const char *key, char **output)
{
- int ret = git_config_get_string(key, (char **)output);
+ int ret = git_config_get_string(key, output);
if (ret)
return ret;
if (strcmp(*output, "now")) {