libc/darwin: Don't use MB_CUR_MAX for mbstate_t - scc - simple c99 compiler
(HTM) git clone git://git.simple-cc.org/scc
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit 01d3b234128ef43576161834ef6f06c79dcaf5a8
(DIR) parent 6f9272021fd3925a09a9e445d2ee890d29017a28
(HTM) Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 10 Mar 2025 10:05:45 +0100
libc/darwin: Don't use MB_CUR_MAX for mbstate_t
The definition of mbstate_t was directly copied from the darwin
headers, but it wrongly assumes that MB_CUR_MAX is defined, but
wchar.h does not. The simpliest way to solve the situation is to
hardcode the number 4, because other solutions would need an
internal macro (for example, _MB_CUR_MAX) that is converted to
MB_CUR_MAX if stdlib.h is included. Anyway that solution still
have problems, because this affects to the ABI of darwin, so
our changes to MB_CUR_MAX should not affect to this ABI.
Diffstat:
M include/bits/darwin/sys/cdefs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/include/bits/darwin/sys/cdefs.h b/include/bits/darwin/sys/cdefs.h
@@ -1,7 +1,7 @@
#ifdef _NEED_MBSTATE_T
#ifndef _MBSTATE_T
typedef struct {
- unsigned char state[MB_CUR_MAX];
+ unsigned char state[4];
size_t count;
} mbstate_t;
#define _MBSTATE_T