aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Paland <marco@paland.com>2018-11-02 13:57:05 +0100
committerMarco Paland <marco@paland.com>2018-11-02 13:57:05 +0100
commitcc8f3bc050042270c661c0807d6555c242e0b244 (patch)
treea3b903fccdc342a34e22bb2bc02e5bb6c872d789
parente7f6a916bec92bbba2cfc4d17b95bc22dec86efa (diff)
downloadprintf-cc8f3bc050042270c661c0807d6555c242e0b244.tar.gz
printf-cc8f3bc050042270c661c0807d6555c242e0b244.tar.bz2
printf-cc8f3bc050042270c661c0807d6555c242e0b244.zip
refactor(printf): move "printf_config.h" include to header
Necessary because PRINTF_OVERRIDE_LIBC is needed in header Closes #4
-rw-r--r--printf.c15
-rw-r--r--printf.h7
2 files changed, 12 insertions, 10 deletions
diff --git a/printf.c b/printf.c
index b3433d6..ddea9e3 100644
--- a/printf.c
+++ b/printf.c
@@ -35,43 +35,38 @@
#include "printf.h"
-// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the
-// printf_config.h header file
-#ifdef PRINTF_INCLUDE_CONFIG_H
- #include "printf_config.h"
-#endif
// 'ntoa' conversion buffer size, this must be big enough to hold one converted
// numeric number including padded zeros (dynamically created on stack)
// default: 32 byte
#ifndef PRINTF_NTOA_BUFFER_SIZE
- #define PRINTF_NTOA_BUFFER_SIZE 32U
+#define PRINTF_NTOA_BUFFER_SIZE 32U
#endif
// 'ftoa' conversion buffer size, this must be big enough to hold one converted
// float number including padded zeros (dynamically created on stack)
// default: 32 byte
#ifndef PRINTF_FTOA_BUFFER_SIZE
- #define PRINTF_FTOA_BUFFER_SIZE 32U
+#define PRINTF_FTOA_BUFFER_SIZE 32U
#endif
// support for the floating point type (%f)
// default: activated
#ifndef PRINTF_DISABLE_SUPPORT_FLOAT
- #define PRINTF_SUPPORT_FLOAT
+#define PRINTF_SUPPORT_FLOAT
#endif
// support for the long long types (%llu or %p)
// default: activated
#ifndef PRINTF_DISABLE_SUPPORT_LONG_LONG
- #define PRINTF_SUPPORT_LONG_LONG
+#define PRINTF_SUPPORT_LONG_LONG
#endif
// support for the ptrdiff_t type (%t)
// ptrdiff_t is normally defined in <stddef.h> as long or long long type
// default: activated
#ifndef PRINTF_DISABLE_SUPPORT_PTRDIFF_T
- #define PRINTF_SUPPORT_PTRDIFF_T
+#define PRINTF_SUPPORT_PTRDIFF_T
#endif
///////////////////////////////////////////////////////////////////////////////
diff --git a/printf.h b/printf.h
index a51e9a5..b82e70f 100644
--- a/printf.h
+++ b/printf.h
@@ -35,6 +35,13 @@
#include <stdarg.h>
#include <stddef.h>
+// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the
+// printf_config.h header file
+// default: undefined
+#ifdef PRINTF_INCLUDE_CONFIG_H
+#include "printf_config.h"
+#endif
+
#ifdef __cplusplus
extern "C" {