From 5bbaff717e42ffed60d22407a7ccb811457852ea Mon Sep 17 00:00:00 2001 From: schnorr Date: Mon, 13 Dec 2010 16:44:38 +0000 Subject: [PATCH] [trace] checking if the user created the environment previously git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9170 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/instr/instr_interface.c | 6 ++++++ src/instr/instr_variables.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index 56cfd6a0eb..a32e80c0a0 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -28,6 +28,12 @@ void TRACE_category_with_color (const char *category, const char *color) if (!TRACE_is_active()) return; + { + //check if hosts have been created + xbt_assert1 (hosts_types != NULL && xbt_dict_length(hosts_types) != 0, + "%s must be called after environment creation", __FUNCTION__); + } + //check if category is already created char *created = xbt_dict_get_or_null(created_categories, category); if (created) return; diff --git a/src/instr/instr_variables.c b/src/instr/instr_variables.c index f7c497eafa..8cd1703161 100644 --- a/src/instr/instr_variables.c +++ b/src/instr/instr_variables.c @@ -61,6 +61,12 @@ void TRACE_user_host_variable(double time, const char *variable, snprintf(valuestr, 100, "%g", value); if (strcmp(what, "declare") == 0) { + { + //check if hosts have been created + xbt_assert1 (hosts_types != NULL && xbt_dict_length(hosts_types) != 0, + "%s must be called after environment creation", __FUNCTION__); + } + char new_type[INSTR_DEFAULT_STR_SIZE]; xbt_dict_cursor_t cursor = NULL; char *type; -- 2.20.1