summaryrefslogtreecommitdiffstats
path: root/source3/lib/charcnv.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-07-24 14:58:36 -0400
committerVolker Lendecke <vl@samba.org>2009-07-25 12:58:06 -0400
commit6b167ae53b1774950d76a15ba92d9f24e59bc565 (patch)
treeafcd1e4d72bba05e5dd42e03d8b089e7f64a8f9c /source3/lib/charcnv.c
parentddcfdd8ecf3c8c1fa391140715ae6b4038ef10ad (diff)
downloadsamba-6b167ae53b1774950d76a15ba92d9f24e59bc565.tar.gz
samba-6b167ae53b1774950d76a15ba92d9f24e59bc565.tar.xz
samba-6b167ae53b1774950d76a15ba92d9f24e59bc565.zip
Use a switch statement in charset_name()
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r--source3/lib/charcnv.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 272f107138c..9ac9930267e 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -54,14 +54,30 @@ static bool initialized;
**/
static const char *charset_name(charset_t ch)
{
- const char *ret = NULL;
-
- if (ch == CH_UTF16LE) ret = "UTF-16LE";
- else if (ch == CH_UTF16BE) ret = "UTF-16BE";
- else if (ch == CH_UNIX) ret = lp_unix_charset();
- else if (ch == CH_DOS) ret = lp_dos_charset();
- else if (ch == CH_DISPLAY) ret = lp_display_charset();
- else if (ch == CH_UTF8) ret = "UTF8";
+ const char *ret;
+
+ switch (ch) {
+ case CH_UTF16LE:
+ ret = "UTF-16LE";
+ break;
+ case CH_UTF16BE:
+ ret = "UTF-16BE";
+ break;
+ case CH_UNIX:
+ ret = lp_unix_charset();
+ break;
+ case CH_DOS:
+ ret = lp_dos_charset();
+ break;
+ case CH_DISPLAY:
+ ret = lp_display_charset();
+ break;
+ case CH_UTF8:
+ ret = "UTF8";
+ break;
+ default:
+ ret = NULL;
+ }
#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
if (ret && !strcmp(ret, "LOCALE")) {