From b3a756fa6fe08c4f377ce22d205ef5c1b28bd250 Mon Sep 17 00:00:00 2001 From: Takishipp Date: Mon, 17 Jul 2017 12:05:59 +0200 Subject: [PATCH 1/1] some optimizations --- src/instr/instr_config.cpp | 6 ++++-- src/instr/instr_paje_types.cpp | 8 +------- src/instr/instr_private.h | 6 ++++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index e6eb6f5182..82b951f1a3 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -63,6 +63,8 @@ static int trace_precision; static bool trace_configured = false; static bool trace_active = false; +static type_t rootType = nullptr; /* the root type */ + instr_fmt_type_t instr_fmt_type = instr_fmt_paje; static void TRACE_getopts() @@ -148,9 +150,9 @@ int TRACE_end() /* destroy all data structures of tracing (and free) */ PJ_container_free_all(); - PJ_type_free_all(); + recursiveDestroyType (PJ_type_get_root()); PJ_container_release(); - PJ_type_release(); + rootType = nullptr; xbt_dict_free(&user_link_variables); xbt_dict_free(&user_host_variables); diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index c5dc7fee01..333e8062cb 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -66,7 +66,7 @@ void PJ_type_free (type_t type) type = nullptr; } -static void recursiveDestroyType (type_t type) +void recursiveDestroyType (type_t type) { XBT_DEBUG("recursiveDestroyType %s", type->name); xbt_dict_cursor_t cursor = nullptr; @@ -78,12 +78,6 @@ static void recursiveDestroyType (type_t type) PJ_type_free(type); } -void PJ_type_free_all () -{ - recursiveDestroyType (PJ_type_get_root()); - rootType = nullptr; -} - type_t PJ_type_get (const char *name, type_t father) { type_t ret = PJ_type_get_or_null (name, father); diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index 30855a3ab2..d3d45c26c1 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -346,8 +346,10 @@ XBT_PRIVATE XBT_PRIVATE type_t PJ_type_variable_new (const char *name, const cha XBT_PRIVATE type_t PJ_type_state_new (const char *name, type_t father); XBT_PUBLIC(type_t) PJ_type_get (const char *name, const type_t father); XBT_PUBLIC(type_t) PJ_type_get_or_null (const char *name, type_t father); -void PJ_type_free_all (); -XBT_PRIVATE XBT_PRIVATE void PJ_type_free (type_t type); +XBT_PRIVATE XBT_PRIVATE void PJ_type_free (type_t type); + +/* instr_config.c */ +XBT_PRIVATE void recursiveDestroyType (type_t type); /* instr_paje_values.c */ XBT_PUBLIC(val_t) PJ_value_new (const char *name, const char *color, type_t father); -- 2.20.1