Thread (25 messages) 25 messages, 4 authors, 2017-08-24

Re: [Patch size_t V3 11/19] Use size_t for config parsing

flat view

From: Johannes Sixt <hidden>
Date: 2017-08-24 20:29:30
Subsystem: the rest · Maintainer: Linus Torvalds

Am 16.08.2017 um 22:16 schrieb Martin Koegler:
quoted hunk ↗ jump to hunk
+int git_parse_size_t(const char *value, size_t *ret)
+{
+	uintmax_t tmp;
+	if (!git_parse_unsigned(value, &tmp, maximum_signed_value_of_type(size_t)))
+		return 0;
+	*ret = tmp;
+	return 1;
+}
+
I think this requires the following on top:
diff --git a/config.c b/config.c
index 81d46602f9..b3075aa1c4 100644
--- a/config.c
+++ b/config.c
@@ -866,7 +866,7 @@ static int git_parse_ssize_t(const char *value, ssize_t *ret)
 int git_parse_size_t(const char *value, size_t *ret)
 {
 	uintmax_t tmp;
-	if (!git_parse_unsigned(value, &tmp, maximum_signed_value_of_type(size_t)))
+	if (!git_parse_unsigned(value, &tmp, maximum_unsigned_value_of_type(size_t)))
 		return 0;
 	*ret = tmp;
 	return 1;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help