Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
no need to copy the strings before comparison
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 26 Jan 2016 19:59:25 +0000 (20:59 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 26 Jan 2016 19:59:25 +0000 (20:59 +0100)
examples/simdag/dax/dax_test.c

index de65c4c..0f3f36b 100644 (file)
@@ -18,11 +18,10 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test,
 
 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)
+  );
 }
 
 int main(int argc, char **argv)