summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-12-30 22:07:56 -0800
committerShawn O. Pearce <spearce@spearce.org>2008-12-30 22:07:56 -0800
commit064301cc3528ec3bccd07dafe9af824d87a50dba (patch)
tree1554ef7957dd89f4d94f00dfbcf7989d3a409306 /src/common.h
parenta1d34bc000cee6d72c3b5e329faa58424641611f (diff)
downloadlibgit2-064301cc3528ec3bccd07dafe9af824d87a50dba.tar.gz
Fix size_t snprintf warning by using PRIuPTR format macro
This is the correct C99 format code for the size_t type when passed as an argument to the *printf family. If the platform doesn't define it, we assume %lu and just cross our fingers that its the proper setting for a size_t on this system. On most sane platforms, "unsigned long" is the underlying type of "size_t". Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index d17bf1cee..3d1f0e581 100644
--- a/src/common.h
+++ b/src/common.h
@@ -8,12 +8,17 @@
#ifdef GIT_HAS_PTHREAD
# include <pthread.h>
#endif
+#include <inttypes.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#ifndef PRIuPTR
+# define PRIuPTR "lu"
+#endif
+
#include "git/common.h"
#define GIT_PATH_MAX 4096