From f9520b353a16a117bec381dfd9688d819809a741 Mon Sep 17 00:00:00 2001 From: suter Date: Fri, 30 May 2014 20:40:35 +0200 Subject: [PATCH] replace sprintf by bprintf --- src/msg/msg_io.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index a54d6a1b8c..0a3ce20b82 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -189,17 +189,17 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) */ msg_file_t MSG_file_open(const char* fullpath, void* data) { - char name[2048]; + char *name; msg_file_priv_t priv = xbt_new(s_msg_file_priv_t, 1); priv->data = data; priv->fullpath = xbt_strdup(fullpath); priv->simdata = xbt_new0(s_simdata_file_t,1); priv->simdata->smx_file = simcall_file_open(fullpath, MSG_host_self()); - sprintf(name, "%s:%i:%s",MSG_host_get_name(MSG_host_self()),MSG_process_self_PID(),fullpath); + name = bprintf("%s:%i:%s",MSG_host_get_name(MSG_host_self()),MSG_process_self_PID(),fullpath); xbt_lib_set(file_lib, name, MSG_FILE_LEVEL, priv); msg_file_t fd = (msg_file_t) xbt_lib_get_elm_or_null(file_lib, name); __MSG_file_get_info(fd); - + xbt_free(name); return fd; } @@ -211,12 +211,13 @@ msg_file_t MSG_file_open(const char* fullpath, void* data) */ int MSG_file_close(msg_file_t fd) { - char name[2048]; + char *name; msg_file_priv_t priv = MSG_file_priv(fd); int res = simcall_file_close(priv->simdata->smx_file, MSG_host_self()); - sprintf(name, "%s:%i:%s",MSG_host_get_name(MSG_host_self()),MSG_process_self_PID(),priv->fullpath); + name = bprintf("%s:%i:%s",MSG_host_get_name(MSG_host_self()),MSG_process_self_PID(),priv->fullpath); xbt_lib_unset(file_lib, name, MSG_FILE_LEVEL, 1); + xbt_free(name); return res; } -- 2.20.1