summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorNick Alcock <nix@esperi.org.uk>2011-11-02 15:46:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-11-02 20:06:30 (GMT)
commite3eed7f8d238e895922851315447f5df9c475f11 (patch)
tree23a236f94d6d13c52fc022530702db0696463d2f /compat
parentf696543dad6c7ba27b0c4fab167a5687263a9ba0 (diff)
downloadgit-e3eed7f8d238e895922851315447f5df9c475f11.zip
git-e3eed7f8d238e895922851315447f5df9c475f11.tar.gz
git-e3eed7f8d238e895922851315447f5df9c475f11.tar.bz2
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 0000000..ac09ed8
--- /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
+}