Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use parse values as double instead of casting them to int
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Jul 2009 18:03:22 +0000 (18:03 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Jul 2009 18:03:22 +0000 (18:03 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6489 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/actions/actions.c

index e76db4e..f7c0178 100644 (file)
 #include "xbt.h"                /* calloc, printf */
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
 #include "xbt.h"                /* calloc, printf */
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+                 "Messages specific for this msg example");
+
+/* Helper function */
+static double parse_double(const char *string) {
+  double value;
+  char *endptr;
+
+  value=strtod(string, &endptr);
+  if (*endptr != '\0')
+         THROW1(unknown_error, 0, "%s is not a double", string);
+  return value;
+}
+
 
 /* Helper function */
 static double parse_double(const char *string)
 
 /* Helper function */
 static double parse_double(const char *string)