# HG changeset patch # User Timo Sirainen # Date 1421276713 -7200 # Node ID 0e74934072e0399baff05dc9671fe2146ca4f9c8 # Parent e645ee117fa9e64d0d592b6b5d1cd1750a6c2d14 lib-charset: Added charset_utf8_to_utf8_begin() wrapper function. It's never supposed to fail, so it makes it nicer for the callers who need to use it. diff -r e645ee117fa9 -r 0e74934072e0 src/lib-charset/charset-utf8.c --- a/src/lib-charset/charset-utf8.c Thu Jan 15 01:03:58 2015 +0200 +++ b/src/lib-charset/charset-utf8.c Thu Jan 15 01:05:13 2015 +0200 @@ -32,6 +32,16 @@ return 0; } +struct charset_translation * +charset_utf8_to_utf8_begin(normalizer_func_t *normalizer) +{ + struct charset_translation *trans; + + if (charset_to_utf8_begin("UTF-8", normalizer, &trans) < 0) + i_unreached(); + return trans; +} + #ifndef HAVE_ICONV struct charset_translation { diff -r e645ee117fa9 -r 0e74934072e0 src/lib-charset/charset-utf8.h --- a/src/lib-charset/charset-utf8.h Thu Jan 15 01:03:58 2015 +0200 +++ b/src/lib-charset/charset-utf8.h Thu Jan 15 01:05:13 2015 +0200 @@ -15,6 +15,9 @@ int charset_to_utf8_begin(const char *charset, normalizer_func_t *normalizer, struct charset_translation **t_r) ATTR_NULL(2); +/* Translate UTF-8 to UTF-8 while validating the input. */ +struct charset_translation * +charset_utf8_to_utf8_begin(normalizer_func_t *normalizer); void charset_to_utf8_end(struct charset_translation **t); void charset_to_utf8_reset(struct charset_translation *t);