MSymbol tag3, MSymbol tag4);
void *(*mdatabase__loader) (void *);
-int mdebug__flag;
+int mdebug__flags[MDEBUG_MAX];
FILE *mdebug__output;
void
time_stack[time_stack_index - 1] = tv;
}
-#define SET_DEBUG_FLAG(env_name, mask) \
- do { \
- char *env_value = getenv (env_name); \
- \
- if (env_value) \
- { \
- if (env_value[0] == '1') \
- mdebug__flag |= (mask); \
- else if (env_value[0] == '0') \
- mdebug__flag &= ~(mask); \
- } \
- } while (0)
+static void
+SET_DEBUG_FLAG (char *env_name, enum MDebugFlag flag)
+{
+ char *env_value = getenv (env_name);
+ if (env_value)
+ {
+ int int_value = atoi (env_value);
+
+ if (flag == MDEBUG_ALL)
+ {
+ int i;
+ for (i = 0; i < MDEBUG_MAX; i++)
+ mdebug__flags[i] = int_value;
+ }
+ else
+ mdebug__flags[flag] = int_value;
+ }
+}
void
mdebug__add_object_array (M17NObjectArray *array, char *name)
void
m17n_init_core (void)
{
- int mdebug_mask = MDEBUG_INIT;
+ int mdebug_flag = MDEBUG_INIT;
merror_code = MERROR_NONE;
if (m17n__core_initialized++)
m17n_memory_full_handler = default_error_handler;
- mdebug__flag = 0;
SET_DEBUG_FLAG ("MDEBUG_ALL", MDEBUG_ALL);
SET_DEBUG_FLAG ("MDEBUG_INIT", MDEBUG_INIT);
SET_DEBUG_FLAG ("MDEBUG_FINI", MDEBUG_FINI);
void
m17n_fini_core (void)
{
- int mdebug_mask = MDEBUG_FINI;
+ int mdebug_flag = MDEBUG_FINI;
if (m17n__core_initialized == 0
|| --m17n__core_initialized > 0)
MDEBUG_POP_TIME ();
MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize the core modules."));
MDEBUG_POP_TIME ();
- if (mdebug__flag & MDEBUG_FINI)
+ if (mdebug__flags[MDEBUG_FINI])
report_object_array ();
msymbol__free_table ();
if (mdebug__output != stderr)