From: Arnaud Giersch Date: Mon, 5 May 2014 12:15:12 +0000 (+0200) Subject: Don't use xbt_assert for error checking, it may be disabled. X-Git-Tag: v3_11~98^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/af678c21888c7284de24c9c549d809b53a3a266a Don't use xbt_assert for error checking, it may be disabled. --- diff --git a/src/msg/msg_actions.c b/src/msg/msg_actions.c index 6ebb52218d..434b254cdb 100644 --- a/src/msg/msg_actions.c +++ b/src/msg/msg_actions.c @@ -44,8 +44,8 @@ msg_error_t MSG_action_trace_run(char *path) action_fp=NULL; if (path) { action_fp = fopen(path, "r"); - xbt_assert(action_fp != NULL, "Cannot open %s: %s", path, - strerror(errno)); + if (action_fp == NULL) + xbt_die("Cannot open %s: %s", path, strerror(errno)); } res = MSG_main(); diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 4b5fe095d1..cc9e4097d8 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -260,8 +260,8 @@ void smpi_action_trace_run(char *path) action_fp=NULL; if (path) { action_fp = fopen(path, "r"); - xbt_assert(action_fp != NULL, "Cannot open %s: %s", path, - strerror(errno)); + if (action_fp == NULL) + xbt_die("Cannot open %s: %s", path, strerror(errno)); } if (!xbt_dict_is_empty(action_queues)) { diff --git a/src/surf/trace_mgr.c b/src/surf/trace_mgr.c index 8f44eaa95d..2f0478fe18 100644 --- a/src/surf/trace_mgr.c +++ b/src/surf/trace_mgr.c @@ -339,8 +339,9 @@ tmgr_trace_t tmgr_trace_new_from_file(const char *filename) } f = surf_fopen(filename, "r"); - xbt_assert(f != NULL, "Cannot open file '%s' (path=%s)", filename, - xbt_str_join(surf_path, ":")); + if (f == NULL) + xbt_die("Cannot open file '%s' (path=%s)", filename, + xbt_str_join(surf_path, ":")); tstr = xbt_str_from_file(f); fclose(f); diff --git a/src/xbt/xbt_replay.c b/src/xbt/xbt_replay.c index ffd80026a3..f3a9fbcb79 100644 --- a/src/xbt/xbt_replay.c +++ b/src/xbt/xbt_replay.c @@ -52,8 +52,8 @@ xbt_replay_reader_t xbt_replay_reader_new(const char *filename) { xbt_replay_reader_t res = xbt_new0(s_xbt_replay_reader_t,1); res->fp = fopen(filename, "r"); - xbt_assert(res->fp != NULL, "Cannot open %s: %s", filename, - strerror(errno)); + if (res->fp == NULL) + xbt_die("Cannot open %s: %s", filename, strerror(errno)); res->filename = xbt_strdup(filename); return res; }