From: cherierm Date: Tue, 26 Sep 2006 13:48:51 +0000 (+0000) Subject: Declare all variables at the begining for ANSI C standard compatibility. X-Git-Tag: v3.3~2535 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dfbcdfb4d3e827babc166137fc8fe7083e10d499 Declare all variables at the begining for ANSI C standard compatibility. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2824 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/gras/Virtu/gras_module.c b/src/gras/Virtu/gras_module.c index b0cc37bad7..401742fb8d 100644 --- a/src/gras/Virtu/gras_module.c +++ b/src/gras/Virtu/gras_module.c @@ -165,6 +165,8 @@ static void moddata_freep(void *p) { } void gras_module_join(const char *name) { + gras_procdata_t *pd; + void *moddata; gras_module_t mod = (gras_module_t)xbt_set_get_by_name(_gras_modules, name); VERB2("Join to module %s (%p)",name,mod); @@ -182,8 +184,8 @@ void gras_module_join(const char *name) { mod->refcount++; /* JOIN */ - gras_procdata_t *pd=gras_procdata_get(); - void *moddata; + pd=gras_procdata_get(); + if (!pd->moddata) /* Damn. I must be the first module on this process. Scary ;) */ pd->moddata = xbt_dynar_new(sizeof(gras_module_t),&moddata_freep); @@ -197,12 +199,13 @@ void gras_module_join(const char *name) { DEBUG2("Module %s joined successfully (ID=%d)", name,*(mod->p_id)); } void gras_module_leave(const char *name) { + void *moddata; gras_module_t mod = (gras_module_t)xbt_set_get_by_name(_gras_modules, name); VERB1("Leave module %s",name); /* LEAVE */ - void *moddata = gras_moddata_by_id( *(mod->p_id) ); + moddata = gras_moddata_by_id( *(mod->p_id) ); (*mod->leave_f)(moddata); /* EXIT */