summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorNick Alcock <nix@esperi.org.uk>2011-11-02 15:46:22 +0000
committerJunio C Hamano <gitster@pobox.com>2011-11-02 13:06:30 -0700
commite3eed7f8d238e895922851315447f5df9c475f11 (patch)
tree23a236f94d6d13c52fc022530702db0696463d2f /compat
parentf696543dad6c7ba27b0c4fab167a5687263a9ba0 (diff)
downloadgit-e3eed7f8d238e895922851315447f5df9c475f11.tar.gz
Add strtoimax() compatibility function.
Since systems that omit strtoumax() will likely omit strtomax() too, and likewise for strtoull() and strtoll(), we arrange for the make variables NO_STRTOUMAX and NO_STRTOULL to cover both the signed and unsigned functions, and define compatibility implementations for them. Signed-off-by: Nick Alcock <nix@esperi.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/strtoimax.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/compat/strtoimax.c b/compat/strtoimax.c
new file mode 100644
index 0000000000..ac09ed89e7
--- /dev/null
+++ b/compat/strtoimax.c
@@ -0,0 +1,10 @@
+#include "../git-compat-util.h"
+
+intmax_t gitstrtoimax (const char *nptr, char **endptr, int base)
+{
+#if defined(NO_STRTOULL)
+ return strtol(nptr, endptr, base);
+#else
+ return strtoll(nptr, endptr, base);
+#endif
+}