From 783573d576fa9ac43c007c6031bce185d882f92b Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 31 May 2017 08:52:20 +0200 Subject: [PATCH] sonar treats --- examples/java/dht/chord/Node.java | 6 +++--- examples/java/dht/kademlia/Answer.java | 2 +- examples/msg/app-bittorrent/peer.c | 2 +- include/simgrid/s4u/Mutex.hpp | 2 +- include/simgrid/simix.h | 2 -- include/xbt/config.h | 4 ++-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/examples/java/dht/chord/Node.java b/examples/java/dht/chord/Node.java index 1817ab36cf..87c4e50e34 100644 --- a/examples/java/dht/chord/Node.java +++ b/examples/java/dht/chord/Node.java @@ -330,9 +330,9 @@ public class Node extends Process { // Performs a find successor request to a random id. private void randomLookup() { - int id = 1337; - //Msg.info("Making a lookup request for id " + id); - findSuccessor(id); + int dest = 1337; + //Msg.info("Making a lookup request for id " + dest); + findSuccessor(dest); } /** diff --git a/examples/java/dht/kademlia/Answer.java b/examples/java/dht/kademlia/Answer.java index c339c3b21c..7a348311e8 100644 --- a/examples/java/dht/kademlia/Answer.java +++ b/examples/java/dht/kademlia/Answer.java @@ -59,7 +59,7 @@ public class Answer { /* Returns if the destination has been found */ public boolean destinationFound() { - if (nodes.size() < 1) { + if (nodes.isEmpty()) { return false; } Contact tail = nodes.get(0); diff --git a/examples/msg/app-bittorrent/peer.c b/examples/msg/app-bittorrent/peer.c index 40a8256a13..959e5230d3 100644 --- a/examples/msg/app-bittorrent/peer.c +++ b/examples/msg/app-bittorrent/peer.c @@ -454,7 +454,7 @@ void remove_current_piece(peer_t peer, connection_t remote_peer, unsigned int cu 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]++; } } diff --git a/include/simgrid/s4u/Mutex.hpp b/include/simgrid/s4u/Mutex.hpp index 05199bd889..0d1f2277a0 100644 --- a/include/simgrid/s4u/Mutex.hpp +++ b/include/simgrid/s4u/Mutex.hpp @@ -37,7 +37,7 @@ XBT_PUBLIC_CLASS Mutex { friend ConditionVariable; friend simgrid::simix::MutexImpl; simgrid::simix::MutexImpl* mutex_; - Mutex(simgrid::simix::MutexImpl * mutex) : mutex_(mutex) {} + explicit Mutex(simgrid::simix::MutexImpl * mutex) : mutex_(mutex) {} /* refcounting of the intrusive_ptr is delegated to the implementation object */ friend void intrusive_ptr_add_ref(Mutex* mutex) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 7f2d4e7408..64f9aac67b 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -110,8 +110,6 @@ typedef enum { /* Process creation/destruction callbacks */ typedef void (*void_pfn_smxprocess_t) (smx_actor_t); -/* for auto-restart function */ -typedef void (*void_pfn_sghost_t) (sg_host_t); extern int smx_context_stack_size; extern int smx_context_stack_size_was_set; diff --git a/include/xbt/config.h b/include/xbt/config.h index fa0b5d4ecc..1131871c98 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -12,8 +12,6 @@ #include #include -SG_BEGIN_DECL() - /** @addtogroup XBT_config * @brief Changing the configuration of SimGrid components (grounding feature) * @@ -67,6 +65,8 @@ typedef simgrid::config::Config* xbt_cfg_t; typedef void* xbt_cfg_t; #endif +SG_BEGIN_DECL() + XBT_PUBLIC(void) xbt_cfg_set_parse(const char *options); /* Set the value of the cell \a name in \a cfg with the provided value.*/ -- 2.20.1