summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-12-07 12:08:55 +0100
committerJeremy Allison <jra@samba.org>2014-12-08 00:33:06 +0100
commite60433efa182484c9fd480d831a21970775e0c99 (patch)
treef9e7d7cf1b8d510eb347578ee5b0d0f928a6e5d8
parent49e208c2b34616d4308e0a3fcf3029c72ee7059f (diff)
downloadsamba-e60433efa182484c9fd480d831a21970775e0c99.tar.gz
samba-e60433efa182484c9fd480d831a21970775e0c99.tar.xz
samba-e60433efa182484c9fd480d831a21970775e0c99.zip
lib: Simplify load_case_tables_library()
We don't really need a talloc context here Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/util/charset/codepoints.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c
index 0984164d48..499cea42f0 100644
--- a/lib/util/charset/codepoints.c
+++ b/lib/util/charset/codepoints.c
@@ -47,15 +47,16 @@ This is the function that should be called from library code.
********************************************************************/
void load_case_tables_library(void)
{
- TALLOC_CTX *mem_ctx;
+ const char *codepagedir = get_dyn_CODEPAGEDIR();
+ size_t codepagedir_len = strlen(codepagedir);
+ char buf[codepagedir_len+13];
+
+ snprintf(buf, sizeof(buf), "%s/upcase.dat", codepagedir);
+ upcase_table = map_file(buf, 0x20000);
+
+ snprintf(buf, sizeof(buf), "%s/lowcase.dat", codepagedir);
+ lowcase_table = map_file(buf, 0x20000);
- mem_ctx = talloc_init("load_case_tables");
- if (!mem_ctx) {
- smb_panic("No memory for case_tables");
- }
- upcase_table = map_file(talloc_asprintf(mem_ctx, "%s/upcase.dat", get_dyn_CODEPAGEDIR()), 0x20000);
- lowcase_table = map_file(talloc_asprintf(mem_ctx, "%s/lowcase.dat", get_dyn_CODEPAGEDIR()), 0x20000);
- talloc_free(mem_ctx);
if (upcase_table == NULL) {
DEBUG(1, ("Failed to load upcase.dat, will use lame ASCII-only case sensitivity rules\n"));
upcase_table = (void *)-1;