From: Frederic Suter Date: Fri, 19 May 2017 12:02:29 +0000 (+0200) Subject: couple of minor smells X-Git-Tag: v3.16~281^2~9 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f340dc5ebc3806e82509cbf87a775372fb6d14d0 couple of minor smells --- diff --git a/include/xbt/matrix.h b/include/xbt/matrix.h index f6ae73fa0b..6d0d3cbc8b 100644 --- a/include/xbt/matrix.h +++ b/include/xbt/matrix.h @@ -15,7 +15,8 @@ SG_BEGIN_DECL() typedef struct { - unsigned int lines, rows; + unsigned int lines; + unsigned int rows; unsigned long elmsize; char *data; diff --git a/src/kernel/routing/DijkstraZone.hpp b/src/kernel/routing/DijkstraZone.hpp index b19cd34155..2e089ede3c 100644 --- a/src/kernel/routing/DijkstraZone.hpp +++ b/src/kernel/routing/DijkstraZone.hpp @@ -11,16 +11,19 @@ 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 { diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index e1ffbdac9f..9b7e47bad6 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -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 { diff --git a/src/smpi/private.h b/src/smpi/private.h index 94e4c7423a..fd8553ab2d 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -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; diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 9768c00699..ec62ccc01b 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -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_cbarg* sg_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* 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 { diff --git a/src/xbt/memory_map.hpp b/src/xbt/memory_map.hpp index e4e138d6d1..3bf3d68869 100644 --- a/src/xbt/memory_map.hpp +++ b/src/xbt/memory_map.hpp @@ -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 */ diff --git a/teshsuite/simix/stack_overflow/stack_overflow.c b/teshsuite/simix/stack_overflow/stack_overflow.c index bb8b899d87..5c7f74cf6d 100644 --- a/teshsuite/simix/stack_overflow/stack_overflow.c +++ b/teshsuite/simix/stack_overflow/stack_overflow.c @@ -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); diff --git a/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c b/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c index 0c83cb7256..d6bf366320 100644 --- a/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c +++ b/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c @@ -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; diff --git a/teshsuite/xbt/parmap_bench/parmap_bench.c b/teshsuite/xbt/parmap_bench/parmap_bench.c index a3f1b0fd42..16505df21e 100644 --- a/teshsuite/xbt/parmap_bench/parmap_bench.c +++ b/teshsuite/xbt/parmap_bench/parmap_bench.c @@ -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)