From: Max Kellermann Date: Thu, 2 Oct 2008 17:01:04 +0000 (+0200) Subject: charset: charset_init() returns character set X-Git-Tag: v0.12_alpha1~104 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=de5c385e46039d2f7410b5ba4a61f92725d7ca9a;p=ncmpc.git charset: charset_init() returns character set Don't pass "noconvert" to charset_init(). Let charset_init() determine that with g_get_charset() and return its name. --- diff --git a/src/charset.c b/src/charset.c index aaec39c..701fd21 100644 --- a/src/charset.c +++ b/src/charset.c @@ -27,11 +27,13 @@ extern void screen_status_printf(const char *format, ...); static bool noconvert = true; +static const char *charset; -void -charset_init(bool disable) +const char * +charset_init(void) { - noconvert = disable; + noconvert = g_get_charset(&charset); + return charset; } unsigned @@ -75,9 +77,6 @@ utf8_to_locale(const char *utf8str) &wb, &rb, &error); if (error) { - const char *charset; - - g_get_charset(&charset); screen_status_printf(_("Error: Unable to convert characters to %s"), charset); g_error_free(error); diff --git a/src/charset.h b/src/charset.h index 24f7ef6..70173d1 100644 --- a/src/charset.h +++ b/src/charset.h @@ -23,7 +23,8 @@ #include #include -void charset_init(bool disable); +const char * +charset_init(void); /** * Returns the number of terminal cells occupied by this string. diff --git a/src/main.c b/src/main.c index 0a9f7cb..07198e7 100644 --- a/src/main.c +++ b/src/main.c @@ -334,7 +334,7 @@ main(int argc, const char *argv[]) /* charset */ setlocale(LC_CTYPE,""); /* initialize charset conversions */ - charset_init(g_get_charset(&charset)); + charset = charset_init(); #endif /* initialize i18n support */