mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 13:30:26 +02:00
i18n: Remove non-local exists from `u32_locale_casecoll ()'.
* libguile/i18n.c (u32_locale_casecoll): Add RESULT argument. Return zero or ERRNO. (compare_u32_strings_ci): Adjust accordingly.
This commit is contained in:
parent
cdf52ff020
commit
c543e41eb4
1 changed files with 23 additions and 14 deletions
|
@ -777,26 +777,27 @@ compare_u32_strings (SCM s1, SCM s2, SCM locale, const char *func_name)
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
u32_locale_casecoll (const char *func_name, const scm_t_uint32 *c_s1,
|
u32_locale_casecoll (const char *func_name, const scm_t_uint32 *c_s1,
|
||||||
const scm_t_uint32 *c_s2)
|
const scm_t_uint32 *c_s2,
|
||||||
|
int *result)
|
||||||
{
|
{
|
||||||
int result, ret;
|
/* Note: Since this is called from `RUN_IN_LOCALE_SECTION', it must note
|
||||||
const char *loc = uc_locale_language ();
|
make any non-local exit. */
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
const char *loc = uc_locale_language ();
|
||||||
|
|
||||||
ret = u32_casecoll (c_s1, u32_strlen (c_s1),
|
ret = u32_casecoll (c_s1, u32_strlen (c_s1),
|
||||||
c_s2, u32_strlen (c_s2),
|
c_s2, u32_strlen (c_s2),
|
||||||
loc, UNINORM_NFC, &result);
|
loc, UNINORM_NFC, result);
|
||||||
if (ret != 0)
|
|
||||||
scm_syserror (func_name);
|
|
||||||
|
|
||||||
return result;
|
return ret == 0 ? ret : errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
compare_u32_strings_ci (SCM s1, SCM s2, SCM locale, const char *func_name)
|
compare_u32_strings_ci (SCM s1, SCM s2, SCM locale, const char *func_name)
|
||||||
#define FUNC_NAME func_name
|
#define FUNC_NAME func_name
|
||||||
{
|
{
|
||||||
int result;
|
int result, ret = 0;
|
||||||
scm_t_locale c_locale;
|
scm_t_locale c_locale;
|
||||||
scm_t_wchar *c_s1, *c_s2;
|
scm_t_wchar *c_s1, *c_s2;
|
||||||
SCM_VALIDATE_OPTIONAL_LOCALE_COPY (3, locale, c_locale);
|
SCM_VALIDATE_OPTIONAL_LOCALE_COPY (3, locale, c_locale);
|
||||||
|
@ -807,13 +808,21 @@ compare_u32_strings_ci (SCM s1, SCM s2, SCM locale, const char *func_name)
|
||||||
if (c_locale)
|
if (c_locale)
|
||||||
RUN_IN_LOCALE_SECTION
|
RUN_IN_LOCALE_SECTION
|
||||||
(c_locale,
|
(c_locale,
|
||||||
result = u32_locale_casecoll (func_name,
|
ret = u32_locale_casecoll (func_name,
|
||||||
(const scm_t_uint32 *) c_s1,
|
|
||||||
(const scm_t_uint32 *) c_s2);
|
|
||||||
else
|
|
||||||
result = u32_locale_casecoll (func_name,
|
|
||||||
(const scm_t_uint32 *) c_s1,
|
(const scm_t_uint32 *) c_s1,
|
||||||
(const scm_t_uint32 *) c_s2);
|
(const scm_t_uint32 *) c_s2,
|
||||||
|
&result));
|
||||||
|
else
|
||||||
|
ret = u32_locale_casecoll (func_name,
|
||||||
|
(const scm_t_uint32 *) c_s1,
|
||||||
|
(const scm_t_uint32 *) c_s2,
|
||||||
|
&result);
|
||||||
|
|
||||||
|
if (SCM_UNLIKELY (ret != 0))
|
||||||
|
{
|
||||||
|
errno = ret;
|
||||||
|
scm_syserror (FUNC_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
scm_remember_upto_here_2 (s1, s2);
|
scm_remember_upto_here_2 (s1, s2);
|
||||||
scm_remember_upto_here (locale);
|
scm_remember_upto_here (locale);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue