summaryrefslogtreecommitdiff
path: root/config.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-04-10 19:46:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-10 21:52:22 (GMT)
commitf011a9654dc2a2e3238985ba7767c1058e7cb3c2 (patch)
treefd9be67e6b3e3d956b5f1264fa2719075780cb03 /config.h
parent6c7e6963c1b6d9a5344345d55dd537e4ab45158f (diff)
downloadgit-f011a9654dc2a2e3238985ba7767c1058e7cb3c2.zip
git-f011a9654dc2a2e3238985ba7767c1058e7cb3c2.tar.gz
git-f011a9654dc2a2e3238985ba7767c1058e7cb3c2.tar.bz2
git_config_parse_key(): return baselen as size_t
As with the recent change to parse_config_key(), the best type to return a string length is a size_t, as it won't cause integer truncation for a gigantic key. And as with that change, this is mostly a clarity / hygiene issue for now, as our config parser would choke on such a large key anyway. There are a few ripple effects within the config code, as callers switch to using size_t. I also adjusted a few related variables that iterate over strings. The most unexpected change is that a call to strbuf_addf() had to switch to strbuf_add(). We can't use a size_t with "%.*s", because printf precisions must have type "int" (we could cast, of course, but that would miss the point of using size_t in the first place). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.h')
-rw-r--r--config.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/config.h b/config.h
index d57df28..0608744 100644
--- a/config.h
+++ b/config.h
@@ -254,7 +254,7 @@ int git_config_set_gently(const char *, const char *);
*/
void git_config_set(const char *, const char *);
-int git_config_parse_key(const char *, char **, int *);
+int git_config_parse_key(const char *, char **, size_t *);
int git_config_key_is_valid(const char *key);
int git_config_set_multivar_gently(const char *, const char *, const char *, int);
void git_config_set_multivar(const char *, const char *, const char *, int);