Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do throw an exception only when the requested factory was not found, not all the...
[simgrid.git] / src / xbt / config.c
index 99559a7..1eb5071 100644 (file)
@@ -9,6 +9,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <stdio.h>
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
@@ -238,11 +239,11 @@ xbt_cfg_register(xbt_cfg_t cfg,
     break;
 
   case xbt_cfgelm_string:
-   res->content = xbt_dynar_new(sizeof(char*),&xbt_cfg_str_free);
+   res->content = xbt_dynar_new(sizeof(char*),xbt_cfg_str_free);
    break;
 
   case xbt_cfgelm_peer:
-   res->content = xbt_dynar_new(sizeof(xbt_peer_t),&xbt_peer_free_voidp);
+   res->content = xbt_dynar_new(sizeof(xbt_peer_t),xbt_peer_free_voidp);
    break;
 
   default:
@@ -795,7 +796,8 @@ xbt_cfg_set_peer(xbt_cfg_t cfg,const char*name,
 void xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
 
   xbt_cfgelm_t variable;
-  int cpt,seen;
+  unsigned int cpt;
+  int seen;
 
   variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
   
@@ -825,7 +827,7 @@ void xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
 
 void xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
   xbt_cfgelm_t variable;
-  int cpt;
+  unsigned int cpt;
   double seen;
 
   variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_double);
@@ -857,7 +859,7 @@ void xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
 void
 xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
   xbt_cfgelm_t variable;
-  int cpt;
+  unsigned int cpt;
   char *seen;
 
   variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
@@ -891,7 +893,7 @@ xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
 void
 xbt_cfg_rm_peer(xbt_cfg_t cfg,const char*name, const char *peer,int port) {
   xbt_cfgelm_t variable;
-  int cpt;
+  unsigned int cpt;
   xbt_peer_t seen;
 
   variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_peer);
@@ -955,7 +957,7 @@ xbt_cfg_empty(xbt_cfg_t cfg,const char*name) {
 
   if (variable) {
     if (variable->cb_rm) {
-      int cpt;
+      unsigned int cpt;
       void *ignored;
       xbt_dynar_foreach(variable->content,cpt,ignored) {
         (*variable->cb_rm)(name, cpt);
@@ -1227,7 +1229,7 @@ XBT_TEST_UNIT("use",test_config_use,"Data retrieving tests") {
     dyn = xbt_cfg_get_dynar(myset,"user");
 
     if (xbt_dynar_length(dyn) != 3) 
-      xbt_test_fail1("Dynar length = %d, I expected 3", (int)xbt_dynar_length(dyn));
+      xbt_test_fail1("Dynar length = %lu, I expected 3", xbt_dynar_length(dyn));
 
     if (strcmp(xbt_dynar_get_as(dyn,0,char*),"foo"))
       xbt_test_fail1("Dynar[0] = %s, I expected foo",   xbt_dynar_get_as(dyn,0,char*));