ref: ac6ae0f0c282b05d7e8351893bfc49c1e9b3f02c
parent: 5310badb8f39560835f0db678d6784217c92766f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Sep 11 05:51:16 EDT 2018
[lib/c] Don't assume a the CHAR_BIT value
--- a/lib/c/strcspn.c
+++ b/lib/c/strcspn.c
@@ -1,3 +1,4 @@
+#include <limits.h>
#include <string.h>
#undef strcspn
@@ -4,7 +5,7 @@
size_t
strcspn(const char *s1, const char *s2)
{
- char buf[256];
+ char buf[sizeof(char) * CHAR_BIT];
unsigned char ch;
size_t n;
--- a/lib/c/strspn.c
+++ b/lib/c/strspn.c
@@ -1,3 +1,4 @@
+#include <limits.h>
#include <string.h>
#undef strspn
@@ -4,7 +5,7 @@
size_t
strspn(const char *s1, const char *s2)
{
- char buf[256];
+ char buf[sizeof(char) * CHAR_BIT];
unsigned char ch;
size_t n;