From 7513517bc3743dec2c10a49ca5a5dccd886948fb Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 1 Jan 2020 22:04:47 +0100 Subject: [PATCH] mbrtowc: Include function name in macro names. * m4/mbrtowc.m4 (gl_FUNC_MBRTOWC): Define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ, not C_LOCALE_MAYBE_EILSEQ. (gl_MBRTOWC_C_LOCALE): Change cache variable name to gl_cv_func_mbrtowc_C_locale_sans_EILSEQ. * lib/mbrtowc.c: Test MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ, not C_LOCALE_MAYBE_EILSEQ. --- ChangeLog | 10 ++++++++++ lib/mbrtowc.c | 4 ++-- m4/mbrtowc.m4 | 18 +++++++++--------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e6db1a0eb..8db5b3890b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2020-01-01 Bruno Haible + + mbrtowc: Include function name in macro names. + * m4/mbrtowc.m4 (gl_FUNC_MBRTOWC): Define + MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ, not C_LOCALE_MAYBE_EILSEQ. + (gl_MBRTOWC_C_LOCALE): Change cache variable name to + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ. + * lib/mbrtowc.c: Test MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ, not + C_LOCALE_MAYBE_EILSEQ. + 2020-01-01 Bruno Haible c32tob: New module. diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c index 60c29ca3c5..14467e6b4a 100644 --- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -20,7 +20,7 @@ /* Specification. */ #include -#if C_LOCALE_MAYBE_EILSEQ +#if MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ # include "hard-locale.h" # include #endif @@ -530,7 +530,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) return 0; # endif -# if C_LOCALE_MAYBE_EILSEQ +# if MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE)) { unsigned char uc = *s; diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4 index 8e5c7c1948..c747ea2093 100644 --- a/m4/mbrtowc.m4 +++ b/m4/mbrtowc.m4 @@ -1,4 +1,4 @@ -# mbrtowc.m4 serial 33 -*- coding: utf-8 -*- +# mbrtowc.m4 serial 34 -*- coding: utf-8 -*- dnl Copyright (C) 2001-2002, 2004-2005, 2008-2020 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -77,10 +77,10 @@ AC_DEFUN([gl_FUNC_MBRTOWC], REPLACE_MBRTOWC=1 ;; esac - case $gl_cv_C_locale_sans_EILSEQ in + case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in *yes) ;; - *) AC_DEFINE([C_LOCALE_MAYBE_EILSEQ], [1], - [Define to 1 if the C locale may have encoding errors.]) + *) AC_DEFINE([MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ], [1], + [Define if the mbrtowc function may signal encoding errors in the C locale.]) REPLACE_MBRTOWC=1 ;; esac @@ -629,11 +629,11 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether the C locale is free of encoding errors], - [gl_cv_C_locale_sans_EILSEQ], + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. - gl_cv_C_locale_sans_EILSEQ="$gl_cross_guess_normal" + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" AC_RUN_IFELSE( [AC_LANG_PROGRAM( @@ -656,11 +656,11 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], } return 0; ]])], - [gl_cv_C_locale_sans_EILSEQ=yes], - [gl_cv_C_locale_sans_EILSEQ=no], + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], [case "$host_os" in # Guess yes on native Windows. - mingw*) gl_cv_C_locale_sans_EILSEQ="guessing yes" ;; + mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; esac ]) ]) -- 2.39.5