From 910291fab4ea1b4741b059f02f00bcbed46d02ee Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Fri, 27 May 2016 14:47:02 +0200 Subject: [PATCH] remove a couple of dumb sprintf --- teshsuite/msg/host_on_off/host_on_off.c | 7 ++----- .../msg/host_on_off_processes/host_on_off_processes.c | 6 ++---- teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c | 9 +++------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/teshsuite/msg/host_on_off/host_on_off.c b/teshsuite/msg/host_on_off/host_on_off.c index fe7a4fd977..fcb42c63a6 100644 --- a/teshsuite/msg/host_on_off/host_on_off.c +++ b/teshsuite/msg/host_on_off/host_on_off.c @@ -13,9 +13,7 @@ static int slave(int argc, char *argv[]) msg_task_t task = NULL; XBT_ATTRIB_UNUSED int res; int id = -1; - char mailbox[80]; - - sprintf(mailbox, "jupi"); + const char * mailbox = "jupi"; while (1) { res = MSG_task_receive(&(task), mailbox); @@ -41,10 +39,9 @@ static int master(int argc, char *argv[]) double task_comp_size = 5E7; double task_comm_size = 1E6; - char mailbox[256]; + const char * mailbox = "jupi"; msg_task_t task = NULL; msg_host_t jupiter = MSG_host_by_name("Jupiter"); - sprintf(mailbox, "jupi"); task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL); XBT_INFO("Sending \"%s\"", task->name); diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c index 0aa4cbfb77..86199c85b7 100644 --- a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c +++ b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c @@ -39,8 +39,7 @@ static int process_sleep(int argc, char *argv[]) static int commTX(int argc, char *argv[]) { msg_task_t task = NULL; - char mailbox[80]; - sprintf(mailbox, "comm"); + const char * mailbox = "comm"; XBT_INFO(" Start TX"); task = MSG_task_create("COMM", 0, 100000000, NULL); MSG_task_isend(task, mailbox); @@ -53,8 +52,7 @@ static int commTX(int argc, char *argv[]) static int commRX(int argc, char *argv[]) { msg_task_t task = NULL; - char mailbox[80]; - sprintf(mailbox, "comm"); + const char * mailbox = "comm"; XBT_INFO(" Start RX"); msg_error_t error = MSG_task_receive(&(task), mailbox); if (error==MSG_OK) { diff --git a/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c b/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c index 020e7777e1..929ee1a7a1 100644 --- a/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c +++ b/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c @@ -14,11 +14,9 @@ static int master(int argc, char *argv[]) double task_comm_size = 1E6; double timeout = 1; - char mailbox[256]; + const char * mailbox = "jupi"; xbt_ex_t ex; - sprintf(mailbox, "jupi"); - msg_task_t task = MSG_task_create("normal", task_comp_size, task_comm_size, NULL); XBT_INFO("Sending task: \"%s\"", task->name); MSG_task_send_with_timeout(task, mailbox, timeout); @@ -83,10 +81,9 @@ static int slave(int argc, char *argv[]) msg_task_t task; XBT_ATTRIB_UNUSED int res; int id = -1; - char mailbox[80]; + const char * mailbox = "jupi"; double start, end; - sprintf(mailbox, "jupi"); - + while (1) { task = NULL; res = MSG_task_receive(&(task), mailbox); -- 2.20.1