diff options
author | Volker Lendecke <vl@samba.org> | 2009-07-24 14:58:36 -0400 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-07-25 12:58:06 -0400 |
commit | 6b167ae53b1774950d76a15ba92d9f24e59bc565 (patch) | |
tree | afcd1e4d72bba05e5dd42e03d8b089e7f64a8f9c | |
parent | ddcfdd8ecf3c8c1fa391140715ae6b4038ef10ad (diff) | |
download | samba-6b167ae53b1774950d76a15ba92d9f24e59bc565.tar.gz samba-6b167ae53b1774950d76a15ba92d9f24e59bc565.tar.bz2 samba-6b167ae53b1774950d76a15ba92d9f24e59bc565.zip |
Use a switch statement in charset_name()
-rw-r--r-- | source3/lib/charcnv.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 272f107138..9ac9930267 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")) { |