From 844ae4b47e1c97a52ff58d68dc6eff42cf69470e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 9 Apr 2023 18:02:51 +0200 Subject: [PATCH] mbrtoc32: Add comments. * lib/mbrtoc32.c: Add comment regarding AIX. * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Add comment regarding GNULIB_defined_mbstate_t. --- ChangeLog | 7 +++++++ lib/mbrtoc32.c | 9 ++++++++- m4/mbrtoc32.m4 | 7 +++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6d4c360be..fa513fa2dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-04-09 Bruno Haible + + mbrtoc32: Add comments. + * lib/mbrtoc32.c: Add comment regarding AIX. + * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Add comment regarding + GNULIB_defined_mbstate_t. + 2023-04-08 Bruno Haible Avoid Autoconf "was expanded before it was required" warning. diff --git a/lib/mbrtoc32.c b/lib/mbrtoc32.c index 6d09fe6db4..85c4d04997 100644 --- a/lib/mbrtoc32.c +++ b/lib/mbrtoc32.c @@ -1,5 +1,5 @@ /* Convert multibyte character to 32-bit wide character. - Copyright (C) 2020-2022 Free Software Foundation, Inc. + Copyright (C) 2020-2023 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -30,6 +30,13 @@ /* Implement mbrtoc32() on top of mbtowc() for the non-UTF-8 locales and directly for the UTF-8 locales. */ +/* Note: On AIX (64-bit) we can implement mbrtoc32 in two equivalent ways: + - in a way that parallels the override of mbrtowc; this is the code branch + here; + - in a way that invokes the overridden mbrtowc; this would be the #else + branch below. + They are equivalent. */ + # if defined _WIN32 && !defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ diff --git a/m4/mbrtoc32.m4 b/m4/mbrtoc32.m4 index 91c8c55685..a193c97c96 100644 --- a/m4/mbrtoc32.m4 +++ b/m4/mbrtoc32.m4 @@ -1,5 +1,5 @@ -# mbrtoc32.m4 serial 9 -dnl Copyright (C) 2014-2022 Free Software Foundation, Inc. +# mbrtoc32.m4 serial 9.1 +dnl Copyright (C) 2014-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,6 +9,9 @@ AC_DEFUN([gl_FUNC_MBRTOC32], AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how our overridden mbrtowc is implemented. + dnl We then implement mbrtoc32 accordingly. gl_MBSTATE_T_BROKEN AC_REQUIRE([gl_TYPE_CHAR32_T]) -- 2.39.5