Git fork

Add a compat/strtoumax.c for Solaris 8.

Solaris 8 was pre-c99, and they weren't willing to commit to
the strtoumax definition according to /usr/include/inttypes.h.

This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.
If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c
will be used instead. That routine passes its arguments to
strtoull unless NO_STRTOULL is defined. If NO_STRTOULL, then
the routine uses strtoul (unsigned long).

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Acked-by: Shawn O Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>

authored by

Jason Riedy and committed by
Junio C Hamano
bc6b4f52 f496454e

+28
+13
Makefile
··· 28 28 # 29 29 # Define NO_STRLCPY if you don't have strlcpy. 30 30 # 31 + # Define NO_STRTOUMAX if you don't have strtoumax in the C library. 32 + # If your compiler also does not support long long or does not have 33 + # strtoull, define NO_STRTOULL. 34 + # 31 35 # Define NO_SETENV if you don't have setenv in the C library. 32 36 # 33 37 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. ··· 353 357 NO_UNSETENV = YesPlease 354 358 NO_SETENV = YesPlease 355 359 NO_C99_FORMAT = YesPlease 360 + NO_STRTOUMAX = YesPlease 356 361 endif 357 362 ifeq ($(uname_R),5.9) 358 363 NO_UNSETENV = YesPlease 359 364 NO_SETENV = YesPlease 360 365 NO_C99_FORMAT = YesPlease 366 + NO_STRTOUMAX = YesPlease 361 367 endif 362 368 INSTALL = ginstall 363 369 TAR = gtar ··· 516 522 ifdef NO_STRLCPY 517 523 COMPAT_CFLAGS += -DNO_STRLCPY 518 524 COMPAT_OBJS += compat/strlcpy.o 525 + endif 526 + ifdef NO_STRTOUMAX 527 + COMPAT_CFLAGS += -DNO_STRTOUMAX 528 + COMPAT_OBJS += compat/strtoumax.o 529 + endif 530 + ifdef NO_STRTOULL 531 + COMPAT_CFLAGS += -DNO_STRTOULL 519 532 endif 520 533 ifdef NO_SETENV 521 534 COMPAT_CFLAGS += -DNO_SETENV
+10
compat/strtoumax.c
··· 1 + #include "../git-compat-util.h" 2 + 3 + uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base) 4 + { 5 + #if defined(NO_STRTOULL) 6 + return strtoul(nptr, endptr, base); 7 + #else 8 + return strtoull(nptr, endptr, base); 9 + #endif 10 + }
+5
git-compat-util.h
··· 139 139 extern size_t gitstrlcpy(char *, const char *, size_t); 140 140 #endif 141 141 142 + #ifdef NO_STRTOUMAX 143 + #define strtoumax gitstrtoumax 144 + extern uintmax_t gitstrtoumax(const char *, char **, int); 145 + #endif 146 + 142 147 extern void release_pack_memory(size_t); 143 148 144 149 static inline char* xstrdup(const char *str)