diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-08-13 13:29:45 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-08-13 13:29:45 -0400 |
commit | 3e282018ffb5806cafafeb5d0d6f8d67c9bb86e8 (patch) | |
tree | 47d0af89eab6fabeb70b4d8726f78b1d6039852d | |
parent | 7d284a409e9a07f03635ea77652d8d665f30ccda (diff) |
directly replace fputc() and fgetc() with putc_unlocked() and getc_unlocked() when not using POSIX >= 199506
-rw-r--r-- | src/stdio/__printf.c | 2 | ||||
-rw-r--r-- | src/stdio/fgetc.c | 5 | ||||
-rw-r--r-- | src/stdio/fputc.c | 5 | ||||
-rw-r--r-- | src/stdio/getc_unlocked.c | 5 | ||||
-rw-r--r-- | src/stdio/printf.c | 1 | ||||
-rw-r--r-- | src/stdio/putc_unlocked.c | 5 |
6 files changed, 10 insertions, 13 deletions
diff --git a/src/stdio/__printf.c b/src/stdio/__printf.c index af3e3e6a..5b27bbdd 100644 --- a/src/stdio/__printf.c +++ b/src/stdio/__printf.c @@ -1,5 +1,7 @@ #include "_stdio.h" #include "stddef.h" +#include "../wctype/wint_t.c" +#include "../wctype/wctrans_t.c" #include "wchar.h" #include "inttypes.h" #include "unistd.h" diff --git a/src/stdio/fgetc.c b/src/stdio/fgetc.c index f03fd545..56f1a348 100644 --- a/src/stdio/fgetc.c +++ b/src/stdio/fgetc.c @@ -3,8 +3,9 @@ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 199506L #undef getc_unlocked +#define getc_unlocked fgetc #include "getc_unlocked.c" -#endif +#else /** read a character from a file stream **/ int fgetc(FILE *stream) @@ -19,6 +20,8 @@ int fgetc(FILE *stream) return c; } +#endif + /*** reads the next character from ARGUMENT(stream) as an TYPE(unsigned char) converted to an TYPE(int). The file position indicator diff --git a/src/stdio/fputc.c b/src/stdio/fputc.c index 3123103b..1e44b85c 100644 --- a/src/stdio/fputc.c +++ b/src/stdio/fputc.c @@ -3,8 +3,9 @@ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 199506L #undef putc_unlocked +#define putc_unlocked fputc #include "putc_unlocked.c" -#endif +#else /** write a character to a file stream **/ int fputc(int c, FILE *stream) @@ -16,6 +17,8 @@ int fputc(int c, FILE *stream) return ret; } +#endif + /*** writes the character ARGUMENT(c) (converted to an TYPE(unsigned char)) to ARGUMENT(stream). The character is written at the current diff --git a/src/stdio/getc_unlocked.c b/src/stdio/getc_unlocked.c index 8e688a64..c5186bcc 100644 --- a/src/stdio/getc_unlocked.c +++ b/src/stdio/getc_unlocked.c @@ -9,11 +9,6 @@ #define read(_fd, _buf, _size) __syscall(__syscall_lookup(read), _fd, _buf, _size) #endif -#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 199506 -#define getc_unlocked __getc_unlocked - static -#endif - int getc_unlocked(FILE * stream) { char c = 0; diff --git a/src/stdio/printf.c b/src/stdio/printf.c index c7bb7a91..1dedbbea 100644 --- a/src/stdio/printf.c +++ b/src/stdio/printf.c @@ -5,7 +5,6 @@ /** write formatted output **/ int printf(const char *format, ...) { - int ret = 0; va_list ap; struct io_options opt = {0}; diff --git a/src/stdio/putc_unlocked.c b/src/stdio/putc_unlocked.c index 4f658eb5..99af7b39 100644 --- a/src/stdio/putc_unlocked.c +++ b/src/stdio/putc_unlocked.c @@ -9,11 +9,6 @@ #define write(_fd, _buf, _size) __syscall(__syscall_lookup(write), _fd, _buf, _size) #endif -#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 199506 -#define putc_unlocked __putc_unlocked - static -#endif - /** write a character to a file stream with explicit client locking **/ int putc_unlocked(int c, FILE *stream) { |