scc

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

commit d0f40db4e66fcfca1fab28192867511be509ffe4
parent dccae4cf0fa8f506673ecd239ff0589dcf63897f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 16 Sep 2018 07:19:14 +0100

[lib/c] Add __NUMCHARS

This macro holds the maximum number of different values
that are a valid char. This macro is different to CHARMAX
because not all the values that a char can hold are
a valid character.

Diffstat:
Mlib/c/strcspn.c | 2+-
Mlib/c/strpbrk.c | 2+-
Mlib/c/strspn.c | 2+-
Mrootdir/include/scc/bits/amd64-sysv/arch/string.h | 2++
Mrootdir/include/scc/bits/i386-sysv/arch/string.h | 2++
Mrootdir/include/scc/bits/z80-dos/arch/string.h | 2++
6 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/c/strcspn.c b/lib/c/strcspn.c @@ -4,7 +4,7 @@ size_t strcspn(const char *s1, const char *s2) { - char buf[128]; + char buf[__NUMCHARS]; unsigned char ch; size_t n; diff --git a/lib/c/strpbrk.c b/lib/c/strpbrk.c @@ -4,7 +4,7 @@ char * strpbrk(const char *s1, const char *s2) { - char buf[128]; + char buf[__NUMCHARS]; unsigned ch; memset(buf, 0, sizeof(buf)); diff --git a/lib/c/strspn.c b/lib/c/strspn.c @@ -4,7 +4,7 @@ size_t strspn(const char *s1, const char *s2) { - char buf[128]; + char buf[__NUMCHARS]; unsigned char ch; size_t n; diff --git a/rootdir/include/scc/bits/amd64-sysv/arch/string.h b/rootdir/include/scc/bits/amd64-sysv/arch/string.h @@ -1,3 +1,5 @@ #ifndef _SIZET typedef unsigned long size_t; #endif + +#define __NUMCHARS 128 diff --git a/rootdir/include/scc/bits/i386-sysv/arch/string.h b/rootdir/include/scc/bits/i386-sysv/arch/string.h @@ -1,3 +1,5 @@ #ifndef _SIZET typedef unsigned long size_t; #endif + +#define __NUMCHARS 128 diff --git a/rootdir/include/scc/bits/z80-dos/arch/string.h b/rootdir/include/scc/bits/z80-dos/arch/string.h @@ -1,3 +1,5 @@ #ifndef _SIZET typedef unsigned size_t; #endif + +#define __NUMCHARS 128