From 2faee382b22b79244c0c4575cb543b427660432a Mon Sep 17 00:00:00 2001 From: mquinson Date: Tue, 16 May 2006 08:55:25 +0000 Subject: [PATCH 1/1] Use xbt/host module git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2213 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/xbt/config.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/xbt/config.c b/src/xbt/config.c index f89e94ce2a..1ab5aec20a 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -15,6 +15,7 @@ #include "xbt/ex.h" #include "xbt/dynar.h" #include "xbt/dict.h" +#include "xbt/host.h" #include "xbt/config.h" /* prototypes of this module */ @@ -52,13 +53,6 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, const char *name, static void xbt_cfg_str_free(void *d){ free(*(void**)d); } -static void xbt_cfg_host_free(void *d){ - xbt_host_t h=(xbt_host_t) *(void**)d; - if (h) { - if (h->name) free(h->name); - free(h); - } -} /*----[ Memory management ]-----------------------------------------------*/ @@ -248,7 +242,7 @@ xbt_cfg_register(xbt_cfg_t cfg, break; case xbt_cfgelm_host: - res->content = xbt_dynar_new(sizeof(xbt_host_t),&xbt_cfg_host_free); + res->content = xbt_dynar_new(sizeof(xbt_host_t),&xbt_host_free_voidp); break; default: @@ -760,13 +754,10 @@ void xbt_cfg_set_host(xbt_cfg_t cfg,const char*name, const char *host,int port) { xbt_cfgelm_t variable; - xbt_host_t val=xbt_new(s_xbt_host_t,1); + xbt_host_t val=xbt_host_new(host,port); VERB3("Configuration setting: %s=%s:%d",name,host,port); - val->name = xbt_strdup(name); - val->port = port; - variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_host); if (variable->max == 1) { -- 2.20.1