summaryrefslogtreecommitdiffstats
path: root/libc/stdio/printf.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-05-11 14:50:18 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-05-11 14:50:18 +0000
commitfd2907fec23831499b7c324f008df85d6f38db97 (patch)
tree898da677f1a4587abfa4266531772a1cc96a5289 /libc/stdio/printf.c
parentfd15708e6476164990e7b364dc5b2aa1600f8e89 (diff)
downloaduClibc-alpine-fd2907fec23831499b7c324f008df85d6f38db97.tar.bz2
uClibc-alpine-fd2907fec23831499b7c324f008df85d6f38db97.tar.xz
Adjust preprocessor logic to initialize QUAL_CHARS correctly for Erik's alpha
port. Also, explicitly use the macro versions of isdigit and isspace in the printf and scanf code.
Diffstat (limited to 'libc/stdio/printf.c')
-rw-r--r--libc/stdio/printf.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index efacc6bee..407bf1d8b 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -36,6 +36,10 @@
* reported by Erik Andersen (andersen@codepoet.com)
* Fix an arg promotion handling bug in _do_one_spec for %c.
* reported by Ilguiz Latypov <ilatypov@superbt.com>
+ *
+ * 5-10-2002
+ * Remove __isdigit and use new ctype.h version.
+ * Add conditional setting of QUAL_CHARS for size_t and ptrdiff_t.
*/
@@ -173,12 +177,6 @@ enum {
*/
/* TODO -- Fix the table below to take into account stdint.h. */
-#if PTRDIFF_MAX != INT_MAX
-#error fix QUAL_CHARS ptrdiff_t entry 't'!
-#endif
-#if SIZE_MAX != UINT_MAX
-#error fix QUAL_CHARS size_t entries 'z', 'Z'!
-#endif
#ifndef LLONG_MAX
#error fix QUAL_CHARS for no long long! Affects 'L', 'j', 'q', 'll'.
#else
@@ -187,11 +185,38 @@ enum {
#endif
#endif
+#ifdef PDS
+#error PDS already defined!
+#endif
+#ifdef SS
+#error SS already defined!
+#endif
+
+#if PTRDIFF_MAX == INT_MAX
+#define PDS 0
+#elif PTRDIFF_MAX == LONG_MAX
+#define PDS 4
+#elif defined(LLONG_MAX) && (PTRDIFF_MAX == LLONG_MAX)
+#define PDS 8
+#else
+#error fix QUAL_CHARS ptrdiff_t entry 't'!
+#endif
+
+#if SIZE_MAX == UINT_MAX
+#define SS 0
+#elif SIZE_MAX == ULONG_MAX
+#define SS 4
+#elif defined(LLONG_MAX) && (SIZE_MAX == ULLONG_MAX)
+#define SS 8
+#else
+#error fix QUAL_CHARS size_t entries 'z', 'Z'!
+#endif
+
#define QUAL_CHARS { \
/* j:(u)intmax_t z:(s)size_t t:ptrdiff_t \0:int */ \
/* q:long_long Z:(s)size_t */ \
'h', 'l', 'L', 'j', 'z', 't', 'q', 'Z', 0, \
- 2, 4, 8, 8, 0, 0, 8, 0, 0, /* TODO -- fix!!! */\
+ 2, 4, 8, 8, SS, PDS, 8, SS, 0, /* TODO -- fix!!! */\
1, 8 \
}
@@ -262,9 +287,6 @@ typedef struct {
/* TODO: fix printf to return 0 and set errno if format error. Standard says
only returns -1 if sets error indicator for the stream. */
-/* TODO -- __isdigit() macro */
-#define __isdigit(c) (((unsigned int)(c - '0')) < 10)
-
#ifdef __STDIO_PRINTF_FLOAT
extern size_t _dtostr(FILE * fp, long double x, struct printf_info *info);
#endif