Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar and cosmetics
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 16 Feb 2017 00:27:45 +0000 (01:27 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 16 Feb 2017 00:27:51 +0000 (01:27 +0100)
- Uppercase the literal suffix.
- Remove the unused declaration of type "smx_host_priv_t".
- Move this "namespace" out of the 'extern "C"' declaration.

examples/msg/app-bittorrent/peer.c
include/simgrid/forward.h
src/msg/msg_private.h
src/simix/smx_host.cpp

index 7921e8a..deccdd6 100644 (file)
@@ -48,7 +48,7 @@ int peer_is_not_downloading_piece(peer_t peer, unsigned int piece){
 
 void get_status(char **status, unsigned int bitfield){
   for(int i=FILE_PIECES-1; i>=0; i--)
-    (*status)[i] = (bitfield&(1u<<i))? '1': '0';
+    (*status)[i]         = (bitfield & (1U << i)) ? '1' : '0';
   (*status)[FILE_PIECES] = '\0';
 }
 
@@ -452,7 +452,7 @@ void remove_current_piece(peer_t peer, connection_t remote_peer, int current_pie
 void update_pieces_count_from_bitfield(peer_t peer, unsigned int bitfield)
 {
   for (int i = 0; i < FILE_PIECES; i++) {
-    if ((bitfield&(1u<<i))) {
+    if ((bitfield & (1U << i))) {
       peer->pieces_count[i]++;
     }
   }
index 9ebbda1..b412700 100644 (file)
@@ -50,9 +50,6 @@ typedef simgrid::surf::Cpu surf_Cpu;
 typedef simgrid::surf::Resource surf_Resource;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
 
-typedef simgrid::simix::Host *smx_host_priv_t;
-
-
 #else
 
 typedef struct simgrid_NetZone simgrid_NetZone;
@@ -64,7 +61,6 @@ typedef struct surf_Resource surf_Resource;
 typedef struct Link Link;
 typedef struct Trace tmgr_Trace;
 
-typedef struct simix_Host *smx_host_priv_t;
 #endif
 
 typedef simgrid_NetZone* NetZone_t;
index 394ed86..79a7c92 100644 (file)
@@ -14,8 +14,6 @@
 
 #include <xbt/Extendable.hpp>
 
-SG_BEGIN_DECL()
-
 /**************** datatypes **********************************/
 /**************************** Host Extension *********************************/
 namespace simgrid {
@@ -110,10 +108,11 @@ typedef struct MSG_Global {
   void_f_pvoid_t process_data_cleanup;
 } s_MSG_Global_t, *MSG_Global_t;
 
-/*extern MSG_Global_t msg_global;*/
 XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
 
 /*************************************************************/
+SG_BEGIN_DECL()
+
 XBT_PRIVATE msg_host_t __MSG_host_create(sg_host_t host);
 XBT_PRIVATE msg_storage_t __MSG_storage_create(smx_storage_t storage);
 XBT_PRIVATE void __MSG_storage_destroy(msg_storage_priv_t host);
index 1e5791c..557251a 100644 (file)
@@ -75,7 +75,7 @@ namespace simgrid {
 /** @brief Stop the host if it is on */
 void SIMIX_host_off(sg_host_t h, smx_actor_t issuer)
 {
-  smx_host_priv_t host = h->extension<simgrid::simix::Host>();
+  simgrid::simix::Host* host = h->extension<simgrid::simix::Host>();
 
   xbt_assert((host != nullptr), "Invalid parameters");