From: Arnaud Giersch Date: Tue, 21 Jan 2014 09:30:36 +0000 (+0100) Subject: Global variables should be initialized to zero. X-Git-Tag: v3_11_beta~140 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0ca903cb167fbe58abe5cc9ef746613df1068d05?ds=sidebyside Global variables should be initialized to zero. --- diff --git a/include/smpi/smpi_cocci.h b/include/smpi/smpi_cocci.h index 8243e7ac3e..c4ea46fdbf 100644 --- a/include/smpi/smpi_cocci.h +++ b/include/smpi/smpi_cocci.h @@ -15,7 +15,7 @@ type *name = NULL; \ static void __attribute__((constructor)) __preinit_##name(void) { \ if(!name) \ - name = (type*)malloc(smpi_global_size() * sizeof(type)); \ + name = (type*)calloc(smpi_global_size(), sizeof(type)); \ } \ static void __attribute__((destructor)) __postfini_##name(void) { \ free(name); \ @@ -55,7 +55,7 @@ XBT_PUBLIC(void) smpi_free_static(void); #define SMPI_VARINIT_STATIC(name,type) \ static type *name = NULL; \ if(!name) { \ - name = (type*)malloc(smpi_global_size() * sizeof(type)); \ + name = (type*)calloc(smpi_global_size(), sizeof(type)); \ smpi_register_static(name, xbt_free); \ }