Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce scope for variable.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 24 Feb 2021 10:49:59 +0000 (11:49 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 24 Feb 2021 10:49:59 +0000 (11:49 +0100)
src/simix/smx_global.cpp
src/xbt_modinter.h

index b8a4412..3d2ec1d 100644 (file)
@@ -307,7 +307,6 @@ void SIMIX_global_init(int *argc, char **argv)
     atexit(SIMIX_clean);
 }
 
-int smx_cleaned = 0;
 /**
  * @ingroup SIMIX_API
  * @brief Clean the SIMIX simulation
@@ -316,10 +315,11 @@ int smx_cleaned = 0;
  */
 void SIMIX_clean()
 {
+  static bool smx_cleaned = false;
   if (smx_cleaned)
     return; // to avoid double cleaning by java and C
 
-  smx_cleaned = 1;
+  smx_cleaned = true;
   XBT_DEBUG("SIMIX_clean called. Simulation's over.");
   if (not simix_global->actors_to_run.empty() && SIMIX_get_clock() <= 0.0) {
     XBT_CRITICAL("   ");
index b01737f..e746052 100644 (file)
@@ -22,7 +22,6 @@ void xbt_dict_postexit(void);
 void *mmalloc_preinit(void);
 void mmalloc_postexit(void);
 
-extern int smx_cleaned;
 extern int xbt_initialized;
 
 SG_END_DECL