summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-12 11:02:56 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-12 11:02:56 -0400
commitecd4d00f1bdf184163cc44ed8261d9f11ca9aae0 (patch)
tree7148339b74cfd5f453be629843e4647b8ed3e7a2 /src/stdio
parentc37709cb45a4dac2c9c8ffb0fdae2361e2ead7de (diff)
remove all generated nonstd/ headers
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/__stdio.c5
-rw-r--r--src/stdio/feof.c2
-rw-r--r--src/stdio/ferror.c2
-rw-r--r--src/stdio/fileno.c2
-rw-r--r--src/stdio/popen.c2
-rw-r--r--src/stdio/setvbuf.c12
6 files changed, 19 insertions, 6 deletions
diff --git a/src/stdio/__stdio.c b/src/stdio/__stdio.c
index d607bde6..2360020f 100644
--- a/src/stdio/__stdio.c
+++ b/src/stdio/__stdio.c
@@ -1,2 +1,7 @@
#include "_stdio.h"
+
struct __stdio __stdio;
+
+/*
+STDC(0)
+*/
diff --git a/src/stdio/feof.c b/src/stdio/feof.c
index 9524d8c6..8b2455bd 100644
--- a/src/stdio/feof.c
+++ b/src/stdio/feof.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include "_stdio.h"
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** test for end-of-file **/
int feof(FILE *stream)
diff --git a/src/stdio/ferror.c b/src/stdio/ferror.c
index 9d427e1f..d4e014d4 100644
--- a/src/stdio/ferror.c
+++ b/src/stdio/ferror.c
@@ -1,5 +1,5 @@
#include <stdio.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
#include "_stdio.h"
/** tests the file stream error indicator **/
diff --git a/src/stdio/fileno.c b/src/stdio/fileno.c
index 8292001d..969f572c 100644
--- a/src/stdio/fileno.c
+++ b/src/stdio/fileno.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include "_stdio.h"
-#include "nonstd/assert.h"
+#include "../_assert.h"
int fileno(FILE * stream)
{
diff --git a/src/stdio/popen.c b/src/stdio/popen.c
index 04918003..0e0fc663 100644
--- a/src/stdio/popen.c
+++ b/src/stdio/popen.c
@@ -5,7 +5,7 @@
#include "sys/types.h"
#include "unistd.h"
-#include "nonstd/assert.h"
+#include "../_assert.h"
#include "_stdio.h"
#ifdef __STDC_VERSION__
diff --git a/src/stdio/setvbuf.c b/src/stdio/setvbuf.c
index e5800288..ecf038fd 100644
--- a/src/stdio/setvbuf.c
+++ b/src/stdio/setvbuf.c
@@ -16,11 +16,19 @@ int setvbuf(FILE *stream, char *buf, int mode, size_t size)
stream->buffering = mode;
stream->bsize = size;
+ if (mode == _IONBF) {
+ /* maybe free buffer */
+ return 0;
+ }
+
if (buf != NULL) {
stream->buf = buf;
stream->buftype = SUPPLIED;
- } else if (mode != _IONBF) {
- stream->buf = calloc(size, sizeof(char));
+ } else if (size <= BUFSIZ) {
+ stream->buf = stream->ibuf;
+ stream->buftype = INTERNAL;
+ } else {
+ stream->buf = malloc(size);
stream->buftype = ALLOCED;
}