struct hmapx_node *node;
struct converter *converter;
- hash = hsh_hash_string (tocode) ^ hsh_hash_string (fromcode);
+ hash = hash_string (tocode, hash_string (fromcode, 0));
HMAPX_FOR_EACH_WITH_HASH (converter, node, hash, &map)
if (!strcmp (tocode, converter->tocode)
&& !strcmp (fromcode, converter->fromcode))
conv = create_iconv (to, from);
+ if ( (iconv_t) -1 == conv )
+ return xstrdup (text);
+
do {
const char *ip = text;
result = iconv (conv, (ICONV_CONST char **) &text, &inbytes,
break;
default:
/* should never happen */
+ fprintf (stderr, "Character conversion error: %s\n", strerror (the_error));
NOT_REACHED ();
break;
}
i18n_done (void)
{
struct hmapx_node *node;
- iconv_t conv;
- HMAPX_FOR_EACH (conv, node, &map)
- iconv_close (conv);
+ struct converter *cvtr;
+ HMAPX_FOR_EACH (cvtr, node, &map)
+ {
+ iconv_close (cvtr->conv);
+ free (cvtr);
+ }
hmapx_destroy (&map);