summaryrefslogtreecommitdiffstats
path: root/sd_event_loop.cpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-10-26 17:55:08 -0700
committerPatrick Venture <venture@google.com>2018-11-08 17:19:15 +0000
commita65e30df5d348337ae0b6afe3f800473117853dd (patch)
treeb9618fbae91c629f56145c6e49bdaa9b2ac10dfb /sd_event_loop.cpp
parenta34c2ab27d7ee8dfe661e02e7dadc56ff707db80 (diff)
downloadphosphor-net-ipmid-a65e30df5d348337ae0b6afe3f800473117853dd.tar.gz
phosphor-net-ipmid-a65e30df5d348337ae0b6afe3f800473117853dd.zip
style: cppcheck cleanup
[command/guid.cpp:37]: (style) The scope of the variable 'rc' can be reduced. [socket_channel.hpp:44]: (performance) Variable 'timeout' is assigned in constructor body. Consider performing initialization in initialization list. [sd_event_loop.cpp:107]: (style) The scope of the variable 'instance' can be reduced. [sd_event_loop.cpp:108]: (style) The scope of the variable 'rc' can be reduced. [sd_event_loop.cpp:142]: (style) The scope of the variable 'instance' can be reduced. [sd_event_loop.cpp:304]: (style) The scope of the variable 'rc' can be reduced. Change-Id: Id090cb217ea7ed9019f1b8d39ebebd6bb73113b1 Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'sd_event_loop.cpp')
-rw-r--r--sd_event_loop.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/sd_event_loop.cpp b/sd_event_loop.cpp
index 7ec4db9..a5fd41d 100644
--- a/sd_event_loop.cpp
+++ b/sd_event_loop.cpp
@@ -104,20 +104,20 @@ static int consoleInputHandler(sd_event_source* es, int fd, uint32_t revents,
static int charAccTimerHandler(sd_event_source* s, uint64_t usec,
void* userdata)
{
- // The instance is hardcoded to 1, in the case of supporting multiple
- // payload instances we would need to populate it from userdata
- uint8_t instance = 1;
- int rc = 0;
auto bufferSize = std::get<sol::Manager&>(singletonPool).dataBuffer.size();
try
{
+ // The instance is hardcoded to 1, in the case of supporting multiple
+ // payload instances we would need to populate it from userdata
+ uint8_t instance = 1;
+
if (bufferSize > 0)
{
auto& context =
std::get<sol::Manager&>(singletonPool).getContext(instance);
- rc = context.sendOutboundPayload();
+ int rc = context.sendOutboundPayload();
if (rc == 0)
{
@@ -138,12 +138,12 @@ static int charAccTimerHandler(sd_event_source* s, uint64_t usec,
static int retryTimerHandler(sd_event_source* s, uint64_t usec, void* userdata)
{
- // The instance is hardcoded to 1, in the case of supporting multiple
- // payload instances we would need to populate it from userdata
- uint8_t instance = 1;
-
try
{
+ // The instance is hardcoded to 1, in the case of supporting multiple
+ // payload instances we would need to populate it from userdata
+ uint8_t instance = 1;
+
auto& context =
std::get<sol::Manager&>(singletonPool).getContext(instance);
@@ -302,12 +302,10 @@ void EventLoop::startHostConsole(const sol::CustomFD& fd)
void EventLoop::stopHostConsole()
{
- int rc = 0;
-
if (hostConsole.get())
{
// Disable the host console payload
- rc = sd_event_source_set_enabled(hostConsole.get(), SD_EVENT_OFF);
+ int rc = sd_event_source_set_enabled(hostConsole.get(), SD_EVENT_OFF);
if (rc < 0)
{
log<level::ERR>("Failed to disable the host console socket",
OpenPOWER on IntegriCloud