summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charcnv.c6
-rw-r--r--source3/lib/debug.c23
-rw-r--r--source3/lib/util.c5
-rw-r--r--source3/lib/util_unistr.c7
4 files changed, 25 insertions, 16 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index b1a5393461..485212b100 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -47,6 +47,7 @@ char lp_failed_convert_char(void)
static smb_iconv_t conv_handles[NUM_CHARSETS][NUM_CHARSETS];
static bool conv_silent; /* Should we do a debug if the conversion fails ? */
+static bool initialized;
/**
* Return the name of a charset to give to iconv().
@@ -92,12 +93,10 @@ static const char *charset_name(charset_t ch)
void lazy_initialize_conv(void)
{
- static int initialized = False;
-
if (!initialized) {
- initialized = True;
load_case_tables();
init_iconv();
+ initialized = true;
}
}
@@ -116,6 +115,7 @@ void gfree_charcnv(void)
}
}
}
+ initialized = false;
}
/**
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 2ded6bdc33..d835ea7c17 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -94,7 +94,7 @@ static TALLOC_CTX *tmp_debug_ctx;
/*
* This is to allow assignment to DEBUGLEVEL before the debug
- * system has been initialised.
+ * system has been initialized.
*/
static int debug_all_class_hack = 1;
static bool debug_all_class_isset_hack = True;
@@ -183,6 +183,8 @@ static char **classname_table = NULL;
Free memory pointed to by global pointers.
****************************************************************************/
+static bool initialized;
+
void gfree_debugsyms(void)
{
int i;
@@ -194,13 +196,23 @@ void gfree_debugsyms(void)
SAFE_FREE( classname_table );
}
- if ( DEBUGLEVEL_CLASS != &debug_all_class_hack )
+ if ( DEBUGLEVEL_CLASS != &debug_all_class_hack ) {
SAFE_FREE( DEBUGLEVEL_CLASS );
+ DEBUGLEVEL_CLASS = &debug_all_class_hack;
+ }
- if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack )
+ if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack ) {
SAFE_FREE( DEBUGLEVEL_CLASS_ISSET );
+ DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack;
+ }
SAFE_FREE(format_bufr);
+
+ debug_num_classes = 0;
+
+ debug_level = DEBUGLEVEL_CLASS;
+
+ initialized = false;
}
/****************************************************************************
@@ -530,13 +542,12 @@ Init debugging (one time stuff)
void debug_init(void)
{
- static bool initialised = False;
const char **p;
- if (initialised)
+ if (initialized)
return;
- initialised = True;
+ initialized = true;
for(p = default_classname_table; *p; p++) {
debug_add_class(*p);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 27a1487663..0fdc9956f1 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -189,12 +189,9 @@ void gfree_all( void )
gfree_names();
gfree_loadparm();
gfree_case_tables();
- gfree_debugsyms();
gfree_charcnv();
gfree_interfaces();
-
- /* release the talloc null_context memory last */
- talloc_disable_null_tracking();
+ gfree_debugsyms();
}
const char *my_netbios_names(int i)
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 76235ad041..4e78d1b064 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -33,6 +33,7 @@ static uint8 *valid_table;
static bool upcase_table_use_unmap;
static bool lowcase_table_use_unmap;
static bool valid_table_use_unmap;
+static bool initialized;
/**
* Destroy global objects allocated by load_case_tables()
@@ -59,6 +60,7 @@ void gfree_case_tables(void)
else
SAFE_FREE(valid_table);
}
+ initialized = false;
}
/**
@@ -70,15 +72,14 @@ void gfree_case_tables(void)
void load_case_tables(void)
{
- static int initialised;
char *old_locale = NULL, *saved_locale = NULL;
int i;
TALLOC_CTX *frame = NULL;
- if (initialised) {
+ if (initialized) {
return;
}
- initialised = 1;
+ initialized = true;
frame = talloc_stackframe();