From 28bd70d811391be10c55ce4aee1b6ee991d7a86b Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 16 Mar 2011 00:15:31 -0500 Subject: unbreak and eliminate NO_C99_FORMAT In the spirit of v1.5.0.2~21 (Check for PRIuMAX rather than NO_C99_FORMAT in fast-import.c, 2007-02-20), use PRIuMAX from git-compat-util.h on all platforms instead of C99-specific formats like %zu with dangerous fallbacks to %u or %lu. So now C99-challenged platforms can build git without provoking warnings or errors from printf, even if pointers do not have the same size as an int or long. The need for a fallback PRIuMAX is detected in git-compat-util.h with "#ifndef PRIuMAX". So while at it, simplify the Makefile and configure script by eliminating the NO_C99_FORMAT knob altogether. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- sha1_file.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'sha1_file.c') diff --git a/sha1_file.c b/sha1_file.c index 27730c334..ea99f6f31 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -25,13 +25,8 @@ #endif #endif -#ifdef NO_C99_FORMAT -#define SZ_FMT "lu" -static unsigned long sz_fmt(size_t s) { return (unsigned long)s; } -#else -#define SZ_FMT "zu" -static size_t sz_fmt(size_t s) { return s; } -#endif +#define SZ_FMT PRIuMAX +static inline uintmax_t sz_fmt(size_t s) { return s; } const unsigned char null_sha1[20]; -- cgit v1.2.1