shithub: scc

Download patch

ref: 7c42356fedc0939eac2a02572d28c77506b5470c
parent: c6ad0cd513bc5c0a7875553227f262fa46d02831
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Sep 16 03:19:14 EDT 2018

[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.

--- 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;
 
--- 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));
--- 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;
 
--- 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
--- 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
--- 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