git-config: always treat --int as 64-bit internally
[gitweb.git] / config.c
index 4be6c7ba2bc0b48de4e465ad2f4c26bd114c3729..3ffe134c57f6076aeb13761ea2e741cb1df40dd1 100644 (file)
--- a/config.c
+++ b/config.c
@@ -534,6 +534,15 @@ static int git_parse_int(const char *value, int *ret)
        return 1;
 }
 
+static int git_parse_int64(const char *value, int64_t *ret)
+{
+       intmax_t tmp;
+       if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(int64_t)))
+               return 0;
+       *ret = tmp;
+       return 1;
+}
+
 int git_parse_ulong(const char *value, unsigned long *ret)
 {
        uintmax_t tmp;
@@ -565,6 +574,14 @@ int git_config_int(const char *name, const char *value)
        return ret;
 }
 
+int64_t git_config_int64(const char *name, const char *value)
+{
+       int64_t ret;
+       if (!git_parse_int64(value, &ret))
+               die_bad_number(name, value);
+       return ret;
+}
+
 unsigned long git_config_ulong(const char *name, const char *value)
 {
        unsigned long ret;