From 970e2c3003a63371db1104cfcff3f684f4f186af Mon Sep 17 00:00:00 2001 From: mquinson Date: Mon, 13 Jul 2009 18:03:22 +0000 Subject: [PATCH] Use parse values as double instead of casting them to int git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6489 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/msg/actions/actions.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index e76db4e1d4..f7c017814a 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -11,7 +11,19 @@ #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) -- 2.20.1