Branch
Hash :
e21236c3
Author :
Date :
2025-02-20T16:09:49
*_l: Fix mistake. * lib/is_l-impl.h (FUNC): Fix array index on old NetBSD and OpenBSD. * lib/to_l-impl.h (FUNC): Likewise. * lib/strcasecmp_l.c (strcasecmp_l): Likewise. * lib/strncasecmp_l.c (strncasecmp_l): Likewise. * lib/strerror_l.c (strerror_l_r): Likewise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
/* Test whether a single-byte character belongs to a specific character class.
Copyright (C) 2025 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2025. */
#include <locale.h>
#include <stdio.h>
int
FUNC (int c, locale_t locale)
{
struct gl_locale_category_t *plc =
&locale->category[gl_log2_lcmask_to_index (gl_log2_lc_mask (LC_CTYPE))];
if (plc->is_c_locale)
/* Implementation for the "C" locale. */
return C_FUNC (c);
#if HAVE_WINDOWS_LOCALE_T
# ifndef _UCRT
/* The old MSVCRT mistreats EOF. */
if (c == EOF)
return c;
# endif
return WINDOWS_FUNC (c, plc->system_locale);
#else
/* Implementation for the global locale. */
{
int ret;
# if HAVE_WORKING_USELOCALE
locale_t saved_locale = uselocale (LC_GLOBAL_LOCALE);
# endif
ret = GLOBAL_FUNC (c);
# if HAVE_WORKING_USELOCALE
uselocale (saved_locale);
# endif
return ret;
}
#endif
}