summaryrefslogtreecommitdiff
path: root/src/port/snprintf.c
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-03-10 17:15:28 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-03-10 17:15:28 +0100
commit0de4a082d0f8a156b5aa40719c13e9fe44d2787d (patch)
tree5275d618ec64958b05e88c989c13ad9a4a559ccf /src/port/snprintf.c
parenta6b606fd903e4c7dd188fe6a8dd35ed583e54cbf (diff)
downloadwolfbones-0de4a082d0f8a156b5aa40719c13e9fe44d2787d.tar.gz
wolfbones-0de4a082d0f8a156b5aa40719c13e9fe44d2787d.tar.bz2
cleanup in stdio.h with snprintf (on Linux works at least), also added testing for snprintf
Diffstat (limited to 'src/port/snprintf.c')
-rw-r--r--src/port/snprintf.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index 6062154..f5731b0 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -165,6 +165,7 @@
*/
#include "port/snprintf.h"
+#include "port/stdio.h"
#if HAVE_CONFIG_H
#include <config.h>
@@ -283,7 +284,7 @@
#define vasprintf rpl_vasprintf
#endif /* TEST_SNPRINTF */
-#if !defined( HAVE_SNPRINTF ) || !defined( HAVE_VSNPRINTF ) || !defined( HAVE_ASPRINTF ) || !defined( HAVE_VASPRINTF )
+#if !defined( HAVE_SNPRINTF ) || !defined( HAVE_VSNPRINTF ) || !defined( HAVE_ASPRINTF ) || !defined( HAVE_VASPRINTF ) || defined( WOLF_TEST_SNPRINTF ) || defined( WOLF_TEST_VSNPRINTF )
#include <stdio.h> /* For NULL, size_t, vsnprintf(3), and vasprintf(3). */
#ifdef VA_START
#undef VA_START
@@ -301,7 +302,9 @@
#define VA_SHIFT(ap, value, type) value = va_arg(ap, type)
#endif /* HAVE_STDARG_H */
-#if !defined HAVE_VASPRINTF || !HAVE_VASPRINTF
+#if defined NOT_USED
+
+#if !defined HAVE_VASPRINTF || HAVE_VASPRINTF
#if HAVE_STDLIB_H
#include <stdlib.h> /* For malloc(3). */
#endif /* HAVE_STDLIB_H */
@@ -327,7 +330,9 @@ static void *mymemcpy(void *, void *, size_t);
#endif /* HAVE_VA_COPY */
#endif /* !HAVE_VASPRINTF */
-#if !defined HAVE_VSNPRINTF
+#endif
+
+#if !defined HAVE_VSNPRINTF ||defined WOLF_TEST_VSNPRINTF
#include <errno.h> /* For ERANGE and errno. */
#include <limits.h> /* For *_MAX. */
#if HAVE_INTTYPES_H
@@ -1481,6 +1486,8 @@ mypow10(int exponent)
}
#endif /* !HAVE_VSNPRINTF */
+#if defined NOT_USED
+
#if !defined HAVE_VASPRINTF || !HAVE_VASPRINTF
#if defined NEED_MYMEMCPY && NEED_MYMEMCPY
void *
@@ -1512,7 +1519,9 @@ rpl_vasprintf(char **ret, const char *format, va_list ap)
}
#endif /* !HAVE_VASPRINTF */
-#if !defined HAVE_SNPRINTF
+#endif
+
+#if !defined HAVE_SNPRINTF || defined WOLF_TEST_SNPRINTF
#if HAVE_STDARG_H
int
rpl_snprintf(char *str, size_t size, const char *format, ...)
@@ -1539,6 +1548,8 @@ rpl_snprintf(va_alist) va_dcl
}
#endif /* !HAVE_SNPRINTF */
+#if defined NOT_USED
+
#if !defined HAVE_ASPRINTF || !HAVE_ASPRINTF
#if HAVE_STDARG_H
int
@@ -1563,6 +1574,8 @@ rpl_asprintf(va_alist) va_dcl
return len;
}
#endif /* !HAVE_ASPRINTF */
+#endif
+
#else /* Dummy declaration to avoid empty translation unit warnings. */
int main(void);
#endif /* !HAVE_SNPRINTF || !HAVE_VSNPRINTF || !HAVE_ASPRINTF || [...] */