diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-09-18 12:58:54 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-09-18 12:58:54 +0200 |
commit | c543e41eb4e1437d3f994b6b8d54540b33145aa7 (patch) | |
tree | c09e30e9c154b8b12f25744d7c1d29cdffab02d6 /libguile/i18n.c | |
parent | cdf52ff02071055387eaa37e92a3a603abcf0f61 (diff) | |
download | guile-c543e41eb4e1437d3f994b6b8d54540b33145aa7.tar.gz |
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.
Diffstat (limited to 'libguile/i18n.c')
-rw-r--r-- | libguile/i18n.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/libguile/i18n.c b/libguile/i18n.c index cab4a7de0..511184c6c 100644 --- a/libguile/i18n.c +++ b/libguile/i18n.c @@ -777,26 +777,27 @@ compare_u32_strings (SCM s1, SCM s2, SCM locale, const char *func_name) static inline int 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; - const char *loc = uc_locale_language (); + /* Note: Since this is called from `RUN_IN_LOCALE_SECTION', it must note + make any non-local exit. */ + int ret; + const char *loc = uc_locale_language (); ret = u32_casecoll (c_s1, u32_strlen (c_s1), c_s2, u32_strlen (c_s2), - loc, UNINORM_NFC, &result); - if (ret != 0) - scm_syserror (func_name); + loc, UNINORM_NFC, result); - return result; + return ret == 0 ? ret : errno; } static inline int compare_u32_strings_ci (SCM s1, SCM s2, SCM locale, const char *func_name) #define FUNC_NAME func_name { - int result; + int result, ret = 0; scm_t_locale c_locale; scm_t_wchar *c_s1, *c_s2; 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) RUN_IN_LOCALE_SECTION (c_locale, - result = u32_locale_casecoll (func_name, - (const scm_t_uint32 *) c_s1, - (const scm_t_uint32 *) c_s2); - else - result = u32_locale_casecoll (func_name, + ret = u32_locale_casecoll (func_name, (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 (locale); |