From f25af1e2829458e33a3a0b74c75865c89dff5f9e Mon Sep 17 00:00:00 2001 From: agiersch Date: Tue, 22 Feb 2011 13:51:22 +0000 Subject: [PATCH] Replace xbt_die(bprintf(...)) with xbt_die(...). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9689 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/gras/replay/replay.c | 3 +-- examples/gras/replay/xbt_workload.c | 4 +-- examples/msg/chord/chord.c | 2 +- .../msg/masterslave/masterslave_failure.c | 3 +-- examples/simdag/dax/dax_test.c | 5 ++-- examples/simdag/dot/dot_test.c | 5 ++-- examples/simdag/dot/simulate_dot.c | 5 ++-- include/xbt/sysdep.h | 9 +++---- src/simdag/sd_task.c | 4 +-- src/simix/smx_network.c | 3 ++- src/surf/network_gtnets.c | 3 +-- src/surf/surf.c | 3 +-- src/surf/surf_routing.c | 9 +++---- src/surf/surfxml_parse.c | 5 ++-- src/surf/trace_mgr.c | 9 +++---- src/xbt/config.c | 26 +++++++------------ teshsuite/simdag/platforms/flatifier.c | 2 +- tools/graphicator/graphicator.c | 2 +- tools/gras/stub_generator.c | 2 +- 19 files changed, 42 insertions(+), 62 deletions(-) diff --git a/examples/gras/replay/replay.c b/examples/gras/replay/replay.c index e47c1baac4..f915360295 100644 --- a/examples/gras/replay/replay.c +++ b/examples/gras/replay/replay.c @@ -185,8 +185,7 @@ static void do_command(int rank, void *c) XBT_INFO("Done receiving %.f bytes from %s", cmd->d_arg, cmd->str_arg); } else { - xbt_die(bprintf - ("unknown command: %s", xbt_workload_elm_to_string(cmd))); + xbt_die("unknown command: %s", xbt_workload_elm_to_string(cmd)); } } diff --git a/examples/gras/replay/xbt_workload.c b/examples/gras/replay/xbt_workload.c index 769d8b53a2..f3a8a79855 100644 --- a/examples/gras/replay/xbt_workload.c +++ b/examples/gras/replay/xbt_workload.c @@ -56,7 +56,7 @@ xbt_workload_elm_t xbt_workload_elm_parse(char *line) res->action = XBT_WORKLOAD_COMPUTE; sscanf(words[++i], "%lg", &(res->d_arg)); } else { - xbt_die(bprintf("Unparsable command: %s (in %s)", words[i], line)); + xbt_die("Unparsable command: %s (in %s)", words[i], line); } i++; if (words[i] && words[i][0] == '#') { @@ -119,7 +119,7 @@ char *xbt_workload_elm_to_string(xbt_workload_elm_t cmd) free(addon); break; default: - xbt_die(bprintf("Unknown command %d in '%s...'", cmd->action, res)); + xbt_die("Unknown command %d in '%s...'", cmd->action, res); } if (cmd->comment) { addon = bprintf(" (comment: %s)", cmd->comment); diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index f8ae33b34a..5b5a3b50f4 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -917,7 +917,7 @@ int main(int argc, char *argv[]) XBT_DEBUG("Set timeout to %d", timeout); } else { - xbt_die(bprintf("Invalid chord option '%s'", options[0])); + xbt_die("Invalid chord option '%s'", options[0]); } } options++; diff --git a/examples/msg/masterslave/masterslave_failure.c b/examples/msg/masterslave/masterslave_failure.c index 604af1852b..bd8c4cc7ac 100644 --- a/examples/msg/masterslave/masterslave_failure.c +++ b/examples/msg/masterslave/masterslave_failure.c @@ -124,8 +124,7 @@ int master(int argc, char *argv[]) MSG_task_destroy(task); } else { XBT_INFO("Hey ?! What's up ? "); - xbt_die(bprintf("Unexpected behavior with '%s': %d", slaves[i]->name, - a)); + xbt_die("Unexpected behavior with '%s': %d", slaves[i]->name, a); } } diff --git a/examples/simdag/dax/dax_test.c b/examples/simdag/dax/dax_test.c index a258853c33..184d715a63 100644 --- a/examples/simdag/dax/dax_test.c +++ b/examples/simdag/dax/dax_test.c @@ -126,9 +126,8 @@ int main(int argc, char **argv) SD_task_get_name(task)); break; default: - xbt_die(bprintf - ("Task %s is of unknown kind %d", SD_task_get_name(task), - SD_task_get_kind(task))); + xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), + SD_task_get_kind(task)); } SD_task_destroy(task); } diff --git a/examples/simdag/dot/dot_test.c b/examples/simdag/dot/dot_test.c index dfc57ab78b..856f417352 100644 --- a/examples/simdag/dot/dot_test.c +++ b/examples/simdag/dot/dot_test.c @@ -116,9 +116,8 @@ int main(int argc, char **argv) SD_task_get_name(task)); break; default: - xbt_die(bprintf - ("Task %s is of unknown kind %d", SD_task_get_name(task), - SD_task_get_kind(task))); + xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), + SD_task_get_kind(task)); } SD_task_destroy(task); } diff --git a/examples/simdag/dot/simulate_dot.c b/examples/simdag/dot/simulate_dot.c index a67ec8a4f7..5d3000249a 100644 --- a/examples/simdag/dot/simulate_dot.c +++ b/examples/simdag/dot/simulate_dot.c @@ -102,9 +102,8 @@ int main(int argc, char **argv) SD_task_get_name(task)); break; default: - xbt_die(bprintf - ("Task %s is of unknown kind %d", SD_task_get_name(task), - SD_task_get_kind(task))); + xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), + SD_task_get_kind(task)); } SD_task_destroy(task); } diff --git a/include/xbt/sysdep.h b/include/xbt/sysdep.h index 282eba888a..d05639b575 100644 --- a/include/xbt/sysdep.h +++ b/include/xbt/sysdep.h @@ -95,8 +95,7 @@ void *xbt_malloc(size_t n) res = malloc(n); if (!res) - xbt_die(bprintf("Memory allocation of %lu bytes failed", - (unsigned long)n)); + xbt_die("Memory allocation of %lu bytes failed", (unsigned long)n); return res; } @@ -109,8 +108,7 @@ void *xbt_malloc0(size_t n) //if (n==0) xbt_die("calloc(0) is not portable"); res = calloc(n, 1); if (!res) - xbt_die(bprintf("Memory callocation of %lu bytes failed", - (unsigned long)n)); + xbt_die("Memory callocation of %lu bytes failed", (unsigned long)n); return res; } @@ -125,8 +123,7 @@ void *xbt_realloc(void *p, size_t s) if (p) { res = realloc(p, s); if (!res) - xbt_die(bprintf("memory (re)allocation of %lu bytes failed", - (unsigned long)s)); + xbt_die("memory (re)allocation of %lu bytes failed", (unsigned long)s); } else { res = xbt_malloc(s); } diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index 57a59959d4..896d84b86c 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -1370,8 +1370,8 @@ void SD_task_schedulev(SD_task_t task, int count, SD_task_do_schedule(task); break; default: - xbt_die(bprintf("Kind of task %s not supported by SD_task_schedulev()", - SD_task_get_name(task))); + xbt_die("Kind of task %s not supported by SD_task_schedulev()", + SD_task_get_name(task)); } if (task->kind == SD_TASK_COMM_E2E) { XBT_VERB("Schedule comm task %s between %s -> %s. It costs %.f bytes", diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index e6a26c6a41..0023ad9098 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -197,7 +197,8 @@ void SIMIX_comm_destroy(smx_action_t action) XBT_DEBUG("Destroy action %p (refcount:%d)", action, action->comm.refcount); if (action->comm.refcount <= 0) - xbt_die(bprintf("the refcount of comm %p is already 0 before decreasing it. That's a bug!",action)); + xbt_die("the refcount of comm %p is already 0 before decreasing it. " + "That's a bug!", action); action->comm.refcount--; if (action->comm.refcount > 0) diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index dd73d52b27..6564fb5150 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -354,8 +354,7 @@ static surf_action_t communicate(const char *src_name, /* Add a flow to the GTNets Simulation, associated to this action */ if (gtnets_create_flow(src, dst, size, (void *) action) < 0) { - xbt_die(bprintf("Not route between host %s and host %s", src_name, - dst_name)); + xbt_die("Not route between host %s and host %s", src_name, dst_name); } #ifdef HAVE_TRACING TRACE_surf_gtnets_communicate(action, src, dst); diff --git a/src/surf/surf.c b/src/surf/surf.c index 2135195e1a..41347b7313 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -203,8 +203,7 @@ int find_model_description(s_surf_model_description_t * table, strcat(name_list, ", "); strcat(name_list, table[i].name); } - xbt_die(bprintf("Model '%s' is invalid! Valid models are: %s.", name, - name_list)); + xbt_die("Model '%s' is invalid! Valid models are: %s.", name, name_list); return -1; } diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 8c35d2f659..db11b969ce 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -2504,9 +2504,8 @@ static char *remplace(char *value, const char **src_list, int src_size, param_list = dst_list; param_size = dst_size; } else { - xbt_die(bprintf( - "bad string parameter, support only \"src\" and \"dst\", at offset: %d (\"%s\")", - i, value)); + xbt_die("bad string parameter, support only \"src\" and \"dst\", " + "at offset: %d (\"%s\")", i, value); } i = i + 3; @@ -2605,8 +2604,8 @@ static route_extended_t rulebased_get_route(routing_component_t rc, are_processing_units = 0; rule_list = routing->list_ASroute; } else - xbt_die(bprintf("Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table", - src, dst)); + xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found in " + "the local table", src, dst); int rc_src = -1; int rc_dst = -1; diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 30cc16397f..ad572ce2a2 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -553,9 +553,8 @@ static void parse_Stag_trace_connect(void) xbt_strdup(A_surfxml_trace_connect_element), free); break; default: - xbt_die(bprintf("Cannot connect trace %s to %s: kind of trace unknown", - A_surfxml_trace_connect_trace, - A_surfxml_trace_connect_element)); + xbt_die("Cannot connect trace %s to %s: kind of trace unknown", + A_surfxml_trace_connect_trace, A_surfxml_trace_connect_element); } } diff --git a/src/surf/trace_mgr.c b/src/surf/trace_mgr.c index dea5183554..23ccb0d6c8 100644 --- a/src/surf/trace_mgr.c +++ b/src/surf/trace_mgr.c @@ -69,14 +69,13 @@ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input, continue; if (sscanf(val, "%lg" " " "%lg" "\n", &event.delta, &event.value) != 2) - xbt_die(bprintf - ("%s:%d: Syntax error in trace\n%s", id, linecount, input)); + xbt_die("%s:%d: Syntax error in trace\n%s", id, linecount, input); if (last_event) { if (last_event->delta > event.delta) { - xbt_die(bprintf - ("%s:%d: Invalid trace: Events must be sorted, but time %lg > time %lg.\n%s", - id, linecount, last_event->delta, event.delta, input)); + xbt_die("%s:%d: Invalid trace: Events must be sorted, " + "but time %lg > time %lg.\n%s", + id, linecount, last_event->delta, event.delta, input); } last_event->delta = event.delta - last_event->delta; } diff --git a/src/xbt/config.c b/src/xbt/config.c index 138076c7c6..8ecc594402 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -547,8 +547,7 @@ void xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa) break; default: - xbt_die(bprintf("Config element variable %s not valid (type=%d)", name, - type)); + xbt_die("Config element variable %s not valid (type=%d)", name, type); } } @@ -645,9 +644,8 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) val = strchr(name, ':'); if (!val) { free(optionlist_cpy); - xbt_die(bprintf( - "Option '%s' badly formated. Should be of the form 'name:value'", - name)); + xbt_die("Option '%s' badly formated. Should be of the form 'name:value'", + name); } *(val++) = '\0'; @@ -679,9 +677,7 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) i = strtol(val, &val, 0); if (val == NULL) { free(optionlist_cpy); - xbt_die(bprintf( - "Value of option %s not valid. Should be an integer", - name)); + xbt_die("Value of option %s not valid. Should be an integer", name); } xbt_cfg_set_int(cfg, name, i); /* throws */ @@ -691,9 +687,7 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) d = strtod(val, &val); if (val == NULL) { free(optionlist_cpy); - xbt_die(bprintf( - "Value of option %s not valid. Should be a double", - name)); + xbt_die("Value of option %s not valid. Should be a double", name); } xbt_cfg_set_double(cfg, name, d); /* throws */ @@ -704,18 +698,16 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) val = strchr(val, ':'); if (!val) { free(optionlist_cpy); - xbt_die(bprintf( - "Value of option %s not valid. Should be an peer (machine:port)", - name)); + xbt_die("Value of option %s not valid. Should be an peer (machine:port)", + name); } *(val++) = '\0'; i = strtol(val, &val, 0); if (val == NULL) { free(optionlist_cpy); - xbt_die(bprintf( - "Value of option %s not valid. Should be an peer (machine:port)", - name)); + xbt_die("Value of option %s not valid. Should be an peer (machine:port)", + name); } xbt_cfg_set_peer(cfg, name, str, i); /* throws */ diff --git a/teshsuite/simdag/platforms/flatifier.c b/teshsuite/simdag/platforms/flatifier.c index 72dedac4b6..813c866cbd 100644 --- a/teshsuite/simdag/platforms/flatifier.c +++ b/teshsuite/simdag/platforms/flatifier.c @@ -65,7 +65,7 @@ int main(int argc, char **argv) TRY { SD_create_environment(platformFile); } CATCH(e) { - xbt_die(bprintf("Error while loading %s: %s",platformFile,e.msg)); + xbt_die("Error while loading %s: %s",platformFile,e.msg); } printf("\n"); diff --git a/tools/graphicator/graphicator.c b/tools/graphicator/graphicator.c index a05e9382b7..c93965fded 100644 --- a/tools/graphicator/graphicator.c +++ b/tools/graphicator/graphicator.c @@ -100,7 +100,7 @@ int main(int argc, char **argv) TRY { SD_create_environment(platformFile); } CATCH(e) { - xbt_die(bprintf("Error while loading %s: %s",platformFile,e.msg)); + xbt_die("Error while loading %s: %s",platformFile,e.msg); } //creating the graph structure diff --git a/tools/gras/stub_generator.c b/tools/gras/stub_generator.c index 8e3caa70ef..7d4d55729d 100644 --- a/tools/gras/stub_generator.c +++ b/tools/gras/stub_generator.c @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) deployment_file = argv[i]; surf_parse_open(deployment_file); if (surf_parse()) - xbt_die(bprintf("Parse error in %s", deployment_file)); + xbt_die("Parse error in %s", deployment_file); surf_parse_close(); } -- 2.20.1