summaryrefslogtreecommitdiff
path: root/compiler.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-28 10:50:20 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-28 10:50:20 -0700
commit304b60556397464143c6fc24edb856b03fc9781a (patch)
tree230a24f6dc769b2e54088cebe34db0a7829bf681 /compiler.h
parentbb2018587b4e14a170a648d08dcdd74dc995d8ce (diff)
downloadnasm-304b60556397464143c6fc24edb856b03fc9781a.tar.gz
nasm-304b60556397464143c6fc24edb856b03fc9781a.tar.bz2
nasm-304b60556397464143c6fc24edb856b03fc9781a.zip
Add substitutes for snprintf() and vsnprintf()
To deal with fools^Wpeople trying to keep really old systems alive, create a proper framework for substitution functions, and make it possible to deal with the lack of snprintf/vsnprintf in particular.
Diffstat (limited to 'compiler.h')
-rw-r--r--compiler.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/compiler.h b/compiler.h
index 8ceb9ee..798466f 100644
--- a/compiler.h
+++ b/compiler.h
@@ -38,13 +38,24 @@
#endif
/* Some versions of MSVC have these only with underscores in front */
-
-#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
-# define snprintf _snprintf
+#include <stdio.h>
+#include <stddef.h>
+#include <stdarg.h>
+
+#ifndef HAVE_SNPRINTF
+# ifdef HAVE__SNPRINTF
+# define snprintf _snprintf
+# else
+int snprintf(char *, size_t, const char *, ...);
+# endif
#endif
-#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
-# define vsnprintf _vsnprintf
+#ifndef HAVE_VSNPRINTF
+# ifdef HAVE__VSNPRINT
+# define vsnprintf _vsnprintf
+# else
+int vsnprintf(char *, size_t, const char *, va_list);
+# endif
#endif
#endif /* COMPILER_H */