From: Frederic Suter Date: Wed, 29 Nov 2017 08:49:52 +0000 (+0100) Subject: fix newly introduced issues X-Git-Tag: v3.18~212 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5e24d669301ee52c043d5833ebeb89f07d8b2799 fix newly introduced issues --- diff --git a/examples/msg/io-storage/io-storage.c b/examples/msg/io-storage/io-storage.c index 7d22079814..9b07128545 100644 --- a/examples/msg/io-storage/io-storage.c +++ b/examples/msg/io-storage/io-storage.c @@ -17,27 +17,22 @@ static int host(int argc, char *argv[]){ xbt_dict_cursor_t cursor = NULL; char* mount_name; char* storage_name; - msg_storage_t storage = NULL; /* - Retrieve all mount points of current host */ xbt_dict_t storage_list = MSG_host_get_mounted_storage_list(MSG_host_self()); - xbt_dict_foreach (storage_list, cursor, mount_name, storage_name) { - /* - For each disk mounted on host: - - Retrieve disk's information */ + /* - For each disk mounted on host, display disk name and mount point */ + xbt_dict_foreach (storage_list, cursor, mount_name, storage_name) XBT_INFO("Storage name: %s, mount name: %s", storage_name, mount_name); - storage = MSG_storage_get_by_name(storage_name); - } + xbt_dict_free(&storage_list); /* - Write 200,000 bytes on Disk4 */ - storage = MSG_storage_get_by_name("Disk4"); - - /* - Open an non-existing file which amounts to create it. */ + msg_storage_t storage = MSG_storage_get_by_name("Disk4"); sg_size_t write = MSG_storage_write(storage, 200000); // Write 200,000 bytes XBT_INFO("Wrote %llu bytes on 'Disk4'", write); - /* - Retrieve the size of created file and read it completely */ + /* - Now read 200,000 bytes */ sg_size_t read = MSG_storage_read(storage, 200000); XBT_INFO("Read %llu bytes on 'Disk4'", read);