scc

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

commit de253dbb0bb7b55ced104e574b9527581474234a
parent 0985a4ba081852c3f72d4c6cd1252af7bc6d075f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 15 Oct 2018 13:15:20 +0100

[lib/c] Several small fixes

Diffstat:
Mlib/c/memchr.c | 2+-
Mlib/c/vfprintf.c | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/c/memchr.c b/lib/c/memchr.c @@ -4,7 +4,7 @@ void * memchr(const void *s, int c, size_t n) { - unsigned char *bp = (unsigned char *) s; + const unsigned char *bp = s; while (n > 0 && *bp++ != c) --n; diff --git a/lib/c/vfprintf.c b/lib/c/vfprintf.c @@ -45,7 +45,7 @@ getnum(va_list *va, int flags, int *sign) if (flags & CHAR) { val = va_arg(*va, int); - uval = (unsigned char) uval; + uval = (unsigned char) val; } else if (flags & SHORT) { val = va_arg(*va, int); uval = (unsigned short) val; @@ -78,7 +78,7 @@ static char * numtostr(uintmax_t val, int flags, struct conv *conv, char *buf) { char *buf0 = buf; - int len, base = conv->base, prec = conv->prec; + int base = conv->base, prec = conv->prec; uintmax_t oval = val; if (prec == -1) @@ -197,7 +197,7 @@ strout(char *s, size_t len, int width, int fill, FILE * restrict fp) int vfprintf(FILE * restrict fp, const char *fmt, va_list va) { - int *p, ch, n, flags, width, left, fill, cnt = 0; + int ch, n, flags, width, left, fill, cnt = 0; size_t inc, len; char *s; wchar_t *ws;