From e3eed7f8d238e895922851315447f5df9c475f11 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Wed, 2 Nov 2011 15:46:22 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- compat/strtoimax.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 compat/strtoimax.c (limited to 'compat') diff --git a/compat/strtoimax.c b/compat/strtoimax.c new file mode 100644 index 000000000..ac09ed89e --- /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 +} -- cgit v1.2.1