Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use right test for error checking.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 7 May 2013 08:46:01 +0000 (10:46 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 7 May 2013 08:46:01 +0000 (10:46 +0200)
src/xbt/config.c

index 41abae5..2b352b1 100644 (file)
@@ -684,7 +684,7 @@ void *xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *key, const char *value) {
 
   case xbt_cfgelm_int:
     i = strtol(value, &ret, 0);
-    if (value == NULL) {
+    if (ret == value) {
       xbt_die("Value of option %s not valid. Should be an integer", key);
     }
 
@@ -693,7 +693,7 @@ void *xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *key, const char *value) {
 
   case xbt_cfgelm_double:
     d = strtod(value, &ret);
-    if (value == NULL) {
+    if (ret == value) {
       xbt_die("Value of option %s not valid. Should be a double", key);
     }
 
@@ -710,7 +710,7 @@ void *xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *key, const char *value) {
 
     *(val++) = '\0';
     i = strtol(val, &ret, 0);
-    if (val == NULL) {
+    if (ret == val) {
       xbt_die("Value of option %s not valid. Should be an peer (machine:port)", key);
     }