scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit bad1e0359187402e8c928618c513b654ad1797f8
parent 78c4546494ca40bc3b41ae4dd67bb396dee9e5bd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 17 Oct 2018 18:20:01 +0100

[lib/c] Initialize pointers of FILE

After moving to a allocation on demand the pointers
are not longer initialized, so it means that it is
impossible to read or write a byte using stdio.

Diffstat:
Mlib/c/__getc.c | 2++
Mlib/c/__putc.c | 2++
2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/c/__getc.c b/lib/c/__getc.c @@ -27,7 +27,9 @@ __getc(FILE *fp) errno = ENOMEM; return EOF; } + fp->len = BUFSIZ; fp->flags |= _IOALLOC; + fp->lp = fp->rp = fp->wp = fp->buf; } if ((cnt = _read(fp->fd, fp->buf, fp->len)) <= 0) { diff --git a/lib/c/__putc.c b/lib/c/__putc.c @@ -50,7 +50,9 @@ __putc(int ch, FILE *fp) errno = ENOMEM; return EOF; } + fp->len = BUFSIZ; fp->flags |= _IOALLOC; + fp->lp = fp->rp = fp->wp = fp->buf; } if (first) {