diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-08-22 22:28:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-08-22 22:28:29 +0000 |
commit | 60c53a1219b9f0ee9c1787f2b160b362e7f94457 (patch) | |
tree | ae4be9e27d907c33c996e8dfbe2b969fce7500af /iconv/gconv_db.c | |
parent | dc32a7c4b2ee873f72b35ad9c7efa7f7c85bb904 (diff) | |
download | glibc-60c53a1219b9f0ee9c1787f2b160b362e7f94457.zip glibc-60c53a1219b9f0ee9c1787f2b160b362e7f94457.tar.gz glibc-60c53a1219b9f0ee9c1787f2b160b362e7f94457.tar.bz2 |
(__gconv_find_transform): Take extra parameter with flags. If GCONV_AVOID_NOCONV flag is set don't return copying transformation.
Diffstat (limited to 'iconv/gconv_db.c')
-rw-r--r-- | iconv/gconv_db.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index 9fe0759..8879fe0 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -613,7 +613,8 @@ find_derivation (const char *toset, const char *toset_expand, int internal_function __gconv_find_transform (const char *toset, const char *fromset, - struct __gconv_step **handle, size_t *nsteps) + struct __gconv_step **handle, size_t *nsteps, + int flags) { __libc_once_define (static, once); const char *fromset_expand = NULL; @@ -648,6 +649,21 @@ __gconv_find_transform (const char *toset, const char *fromset, toset_expand = found != NULL ? (*found)->toname : NULL; } + if ((flags & GCONV_AVOID_NOCONV) + /* We are not supposed to create a pseudo transformation (means + copying) when the input and output character set are the same. */ + && (strcmp (toset, fromset) == 0 + || (toset_expand != NULL && strcmp (toset_expand, fromset) == 0) + || (fromset_expand != NULL + && (strcmp (toset, fromset_expand) == 0 + || (toset_expand != NULL + && strcmp (toset_expand, fromset_expand) == 0))))) + { + /* Both character sets are the same. */ + __libc_lock_unlock (lock); + return __GCONV_NOCONV; + } + result = find_derivation (toset, toset_expand, fromset, fromset_expand, handle, nsteps); |