Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
couple of minor smells
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 19 May 2017 12:02:29 +0000 (14:02 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 19 May 2017 12:02:29 +0000 (14:02 +0200)
include/xbt/matrix.h
src/kernel/routing/DijkstraZone.hpp
src/simix/ActorImpl.hpp
src/smpi/private.h
src/surf/xml/platf_private.hpp
src/xbt/memory_map.hpp
teshsuite/simix/stack_overflow/stack_overflow.c
teshsuite/smpi/coll-alltoallv/coll-alltoallv.c
teshsuite/xbt/parmap_bench/parmap_bench.c

index f6ae73f..6d0d3cb 100644 (file)
@@ -15,7 +15,8 @@
 SG_BEGIN_DECL()
 
 typedef struct {
-  unsigned int lines, rows;
+  unsigned int lines;
+  unsigned int rows;
   unsigned long elmsize;
 
   char *data;
index b19cd34..2e089ed 100644 (file)
 typedef struct graph_node_data {
   int id;
   int graph_id; /* used for caching internal graph id's */
-} s_graph_node_data_t, *graph_node_data_t;
+} s_graph_node_data_t;
+typedef s_graph_node_data_t* graph_node_data_t;
 
 typedef struct graph_node_map_element {
   xbt_node_t node;
-} s_graph_node_map_element_t, *graph_node_map_element_t;
+} s_graph_node_map_element_t;
+typedef s_graph_node_map_element_t* graph_node_map_element_t;
 
 typedef struct route_cache_element {
   int* pred_arr;
   int size;
-} s_route_cache_element_t, *route_cache_element_t;
+} s_route_cache_element_t;
+typedef s_route_cache_element_t* route_cache_element_t;
 
 namespace simgrid {
 namespace kernel {
index e1ffbda..9b7e47b 100644 (file)
@@ -14,7 +14,8 @@
 typedef struct s_smx_process_exit_fun {
   int_f_pvoid_pvoid_t fun;
   void *arg;
-} s_smx_process_exit_fun_t, *smx_process_exit_fun_t;
+} s_smx_process_exit_fun_t;
+typedef s_smx_process_exit_fun_t* smx_process_exit_fun_t;
 
 namespace simgrid {
 namespace simix {
index 94e4c74..fd8553a 100644 (file)
@@ -371,7 +371,8 @@ void mpi_file_write_ ( int* fh, void* buf, int* count, int* datatype, MPI_Status
 typedef struct s_smpi_privatisation_region {
   void* address;
   int file_descriptor;
-} s_smpi_privatisation_region_t, *smpi_privatisation_region_t;
+} s_smpi_privatisation_region_t;
+typedef s_smpi_privatisation_region_t* smpi_privatisation_region_t;
 
 extern XBT_PRIVATE smpi_privatisation_region_t smpi_privatisation_regions;
 extern XBT_PRIVATE int smpi_loaded_page;
index 9768c00..ec62ccc 100644 (file)
@@ -50,13 +50,15 @@ typedef struct {
   tmgr_trace_t state_trace;
   const char* coord;
   xbt_dict_t properties;
-} s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
+} s_sg_platf_host_cbarg_t;
+typedef s_sg_platf_host_cbarg_t* sg_platf_host_cbarg_t;
 
 typedef struct {
   const char* id;
   const char* link_up;
   const char* link_down;
-} s_sg_platf_host_link_cbarg_t, *sg_platf_host_link_cbarg_t;
+} s_sg_platf_host_link_cbarg_t;
+typedef s_sg_platf_host_link_cbarg_t* sg_platf_host_link_cbarg_t;
 
 class LinkCreationArgs {
 public:
@@ -114,7 +116,7 @@ typedef struct s_sg_platf_cluster_cbarg {
   e_surf_link_sharing_policy_t bb_sharing_policy;
 } s_sg_platf_cluster_cbarg_t;
 
-typedef struct s_sg_platf_cabinet_cbarg *sg_platf_cabinet_cbarg_t;
+typedef struct s_sg_platf_cabinet_cbargsg_platf_cabinet_cbarg_t;
 typedef struct s_sg_platf_cabinet_cbarg {
   const char* id;
   const char* prefix;
@@ -125,16 +127,18 @@ typedef struct s_sg_platf_cabinet_cbarg {
   double lat;
 } s_sg_platf_cabinet_cbarg_t;
 
-typedef struct {
+typedef struct s_sg_platf_storage_cbarg* sg_platf_storage_cbarg_t;
+typedef struct s_sg_platf_storage_cbarg {
   const char* id;
   const char* type_id;
   const char* content;
   const char* content_type;
   xbt_dict_t properties;
   const char* attach;
-} s_sg_platf_storage_cbarg_t, *sg_platf_storage_cbarg_t;
+} s_sg_platf_storage_cbarg_t;
 
-typedef struct {
+typedef struct s_sg_platf_storage_type_cbarg* sg_platf_storage_type_cbarg_t;
+typedef struct s_sg_platf_storage_type_cbarg {
   const char* id;
   const char* model;
   const char* content;
@@ -142,12 +146,13 @@ typedef struct {
   xbt_dict_t properties;
   std::map<std::string, std::string>* model_properties;
   sg_size_t size;
-} s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
+} s_sg_platf_storage_type_cbarg_t;
 
-typedef struct {
+typedef struct s_sg_platf_mount_cbarg* sg_platf_mount_cbarg_t;
+typedef struct s_sg_platf_mount_cbarg {
   const char* storageId;
   const char* name;
-} s_sg_platf_mount_cbarg_t, *sg_platf_mount_cbarg_t;
+} s_sg_platf_mount_cbarg_t;
 
 typedef struct s_sg_platf_prop_cbarg *sg_platf_prop_cbarg_t;
 typedef struct s_sg_platf_prop_cbarg {
index e4e138d..3bf3d68 100644 (file)
@@ -19,7 +19,8 @@ namespace xbt {
 
 /** An virtual memory map entry from /proc/$pid/maps */
 struct VmMap {
-  std::uint64_t start_addr, end_addr;
+  std::uint64_t start_addr;
+  std::uint64_t end_addr;
   int prot;                     /* Memory protection */
   int flags;                    /* Additional memory flags */
   std::uint64_t offset;         /* Offset in the file/whatever */
index bb8b899..5c7f74c 100644 (file)
@@ -30,7 +30,7 @@ static int master(int argc, char *argv[])
 {
   XBT_INFO("Launching our nice bugged recursive function...");
   unsigned i = 1;
-  while (i <= 0x80000000u) {
+  while (i <= 0x80000000U) {
     i *= 2;
     unsigned res = collatz(i, i);
     XBT_VERB("collatz(%u, %u) returned %u", i, i, res);
index 0c83cb7..d6bf366 100644 (file)
@@ -62,7 +62,6 @@ int main(int argc, char **argv)
   int i;
   int rank;
   int size;
-  int *sendcounts, *recvcounts, *rdispls, *sdispls;
 
   MPI_Init(&argc, &argv);
 
@@ -81,10 +80,10 @@ int main(int argc, char **argv)
   }
 
   /* Create and load the arguments to alltoallv */
-  sendcounts = (int *) xbt_malloc(size * sizeof(int));
-  recvcounts = (int *) xbt_malloc(size * sizeof(int));
-  rdispls = (int *) xbt_malloc(size * sizeof(int));
-  sdispls = (int *) xbt_malloc(size * sizeof(int));
+  int* sendcounts = (int*)xbt_malloc(size * sizeof(int));
+  int* recvcounts = (int*)xbt_malloc(size * sizeof(int));
+  int* rdispls    = (int*)xbt_malloc(size * sizeof(int));
+  int* sdispls    = (int*)xbt_malloc(size * sizeof(int));
   for (i = 0; i < size; i++) {
     sendcounts[i] = i;
     recvcounts[i] = rank;
index a3f1b0f..16505df 100644 (file)
@@ -45,15 +45,13 @@ static const char *parmap_mode_name(e_xbt_parmap_mode_t mode)
 
 static int parmap_skip_mode(e_xbt_parmap_mode_t mode)
 {
-  switch (mode) {
 #if !HAVE_FUTEX_H
-  case XBT_PARMAP_FUTEX:
+  if (mode == XBT_PARMAP_FUTEX) {
     printf("not available\n");
     return 1;
+  } else
 #endif
-  default:
     return 0;
-  }
 }
 
 static unsigned fibonacci(unsigned n)