aboutsummaryrefslogtreecommitdiff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_charset.h3
-rw-r--r--iconv/gconv_db.c13
-rw-r--r--iconv/gconv_int.h6
3 files changed, 18 insertions, 4 deletions
diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h
index 1e2b76bdca..b0b28079c6 100644
--- a/iconv/gconv_charset.h
+++ b/iconv/gconv_charset.h
@@ -57,4 +57,5 @@ upstr (char *dst, const char *str)
/* If NAME is an codeset alias expand it. */
-extern const char *__gconv_lookup_alias (const char *name);
+extern int __gconv_compare_alias (const char *name1, const char *name2)
+ internal_function;
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index 47861d19ca..9bd27c5e69 100644
--- a/iconv/gconv_db.c
+++ b/iconv/gconv_db.c
@@ -632,13 +632,20 @@ do_lookup_alias (const char *name)
}
-const char *
-__gconv_lookup_alias (const char *name)
+int
+internal_function
+__gconv_compare_alias (const char *name1, const char *name2)
{
+ int result;
+
/* Ensure that the configuration data is read. */
__libc_once (once, __gconv_read_conf);
- return do_lookup_alias (name) ?: name;
+ if (__gconv_compare_alias_cache (name1, name2, &result) != 0)
+ result = strcmp (do_lookup_alias (name1) ?: name1,
+ do_lookup_alias (name2) ?: name2);
+
+ return result;
}
diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h
index 13698d8ac4..3b5f195b04 100644
--- a/iconv/gconv_int.h
+++ b/iconv/gconv_int.h
@@ -188,6 +188,12 @@ extern int __gconv_lookup_cache (const char *toset, const char *fromset,
int flags)
internal_function;
+/* Compare the two name for whether they are after alias expansion the
+ same. This function uses the cache and fails if none is
+ loaded. */
+extern int __gconv_compare_alias_cache (const char *name1, const char *name2,
+ int *result) internal_function;
+
/* Free data associated with a step's structure. */
extern void __gconv_release_step (struct __gconv_step *step)
internal_function;