From: Martin Quinson Date: Tue, 26 Jan 2016 20:42:36 +0000 (+0100) Subject: I said there is no need to copy before strcmp X-Git-Tag: v3_13~1060 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9f1b83fd35a713664c907baf85e6d7e2715c4a83?ds=sidebyside I said there is no need to copy before strcmp --- diff --git a/teshsuite/simdag/platforms/flatifier.cpp b/teshsuite/simdag/platforms/flatifier.cpp index a3c3cba420..581b75580f 100644 --- a/teshsuite/simdag/platforms/flatifier.cpp +++ b/teshsuite/simdag/platforms/flatifier.cpp @@ -31,20 +31,18 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(flatifier, static int name_compare_hosts(const void *n1, const void *n2) { - char name1[80], name2[80]; - strcpy(name1, sg_host_get_name(*((sg_host_t *) n1))); - strcpy(name2, sg_host_get_name(*((sg_host_t *) n2))); - - return strcmp(name1, name2); + return strcmp( + sg_host_get_name(*(sg_host_t *) n1), + sg_host_get_name(*(sg_host_t *) n2) + ); } static int name_compare_links(const void *n1, const void *n2) { - char name1[80], name2[80]; - strcpy(name1, sg_link_name(*((SD_link_t *) n1))); - strcpy(name2, sg_link_name(*((SD_link_t *) n2))); - - return strcmp(name1, name2); + return strcmp( + sg_link_name(*(SD_link_t *) n1), + sg_link_name(*(SD_link_t *) n2) + ); } static int parse_cmdline(int *timings, int *downgrade, char **platformFile, int argc, char **argv)