summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2003-04-08 03:01:02 +0000
committerMartin Pool <mbp@samba.org>2003-04-08 03:01:02 +0000
commit65289c353b77b31a746bcd36fb7fcbef01947187 (patch)
tree48bf199374987972c09cd0ee1b9bf421ff98f4d5 /source3/lib/charcnv.c
parent38ec539cf5afeed3fe75f82e9aecbab7dc7f46ec (diff)
downloadsamba-65289c353b77b31a746bcd36fb7fcbef01947187.tar.gz
samba-65289c353b77b31a746bcd36fb7fcbef01947187.tar.bz2
samba-65289c353b77b31a746bcd36fb7fcbef01947187.zip
Merge from 3_0: Build a lookup table of valid DOS characters just
once, when init_iconv is first called. Use this in check_dos_char rather than doing the conversion every time. Much faster. (This used to be commit e8f1399323745a93ba9df97553effcf2d7629850)
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r--source3/lib/charcnv.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index f025e93718..d727628e41 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -59,7 +59,7 @@ static const char *charset_name(charset_t ch)
return ret;
}
-static void lazy_initialize_conv(void)
+void lazy_initialize_conv(void)
{
static int initialized = False;
@@ -67,14 +67,16 @@ static void lazy_initialize_conv(void)
initialized = True;
load_case_tables();
init_iconv();
- init_valid_table();
}
}
/**
- Initialize iconv conversion descriptors.
-**/
-
+ * Initialize iconv conversion descriptors.
+ *
+ * This is called the first time it is needed, and also called again
+ * every time the configuration is reloaded, because the charset or
+ * codepage might have changed.
+ **/
void init_iconv(void)
{
int c1, c2;
@@ -112,6 +114,10 @@ void init_iconv(void)
}
if (did_reload) {
+ /* XXX: Does this really get called every time the dos
+ * codepage changes? */
+ /* XXX: Is the did_reload test too strict? */
+ init_doschar_table();
init_valid_table();
}
}