From bc2641769ec3019ab7d794b032a6e36030581c76 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 31 Oct 2025 21:08:47 +0100 Subject: Remove wctomb It's unfortunately valid to pass a buffer smaller than MB_CUR_MAX to wctomb, so let's not trap on this. Moreover, it's supposed to be implemented in stdlib.h and not wchar.h anyway. --- include/wchar.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/wchar.h b/include/wchar.h index d031397..a840f1a 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -51,7 +51,6 @@ extern "C" { #undef wcsncpy #undef wcsrtombs #undef wcstombs -#undef wctomb #undef wmemcpy #undef wmemmove #undef wmemset @@ -228,15 +227,6 @@ _FORTIFY_FN(wcstombs) size_t wcstombs(char * _FORTIFY_POS0 __s, return __orig_wcstombs(__s, __ws, __n); } -_FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) -{ - size_t __b = __bos(__s, 0); - - if (__s && MB_LEN_MAX > __b && MB_CUR_MAX > __b) - __builtin_trap(); - return __orig_wctomb(__s, __w); -} - _FORTIFY_FN(wmemcpy) wchar_t *wmemcpy(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s, size_t __n) { -- cgit v1.3