diff options
author | James Feist <james.feist@linux.intel.com> | 2019-09-06 13:41:59 -0700 |
---|---|---|
committer | James Feist <james.feist@linux.intel.com> | 2019-09-13 16:26:33 +0000 |
commit | cb09aa00e8f25fda20780f0a26a7c35b24c4b59b (patch) | |
tree | be62c78b8e20d2ecaa5f0d285c8f030e9647a9c2 | |
parent | cfae948b82765c8dbaec809e0f13744e8dedb934 (diff) | |
download | phosphor-host-ipmid-cb09aa00e8f25fda20780f0a26a7c35b24c4b59b.tar.gz phosphor-host-ipmid-cb09aa00e8f25fda20780f0a26a7c35b24c4b59b.zip |
Change yield from ptr to object
The ptr makes for ugly code:
i.e. *(ctx->yield) all over the place.
Change it to copy as it is just 4 pointers.
Tested: ipmitool mc info still works
Change-Id: I30c5bc395849875cd58925fac99bb23c1804cd5b
Signed-off-by: James Feist <james.feist@linux.intel.com>
-rw-r--r-- | include/ipmid/handler.hpp | 2 | ||||
-rw-r--r-- | include/ipmid/message.hpp | 4 | ||||
-rw-r--r-- | ipmid-new.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/include/ipmid/handler.hpp b/include/ipmid/handler.hpp index 10b7119..b6c6c0f 100644 --- a/include/ipmid/handler.hpp +++ b/include/ipmid/handler.hpp @@ -190,7 +190,7 @@ class IpmiHandler final : public HandlerBase boost::asio::yield_context>::value) { inputArgs.emplace(std::tuple_cat( - std::forward_as_tuple(*(request->ctx->yield)), + std::forward_as_tuple(request->ctx->yield), std::move(unpackArgs))); } else if constexpr (std::is_same< diff --git a/include/ipmid/message.hpp b/include/ipmid/message.hpp index 4864f4e..0dc7ca8 100644 --- a/include/ipmid/message.hpp +++ b/include/ipmid/message.hpp @@ -43,7 +43,7 @@ struct Context Context(std::shared_ptr<sdbusplus::asio::connection> bus, NetFn netFn, Cmd cmd, int channel, int userId, Privilege priv, int rqSA, - boost::asio::yield_context* yield) : + boost::asio::yield_context& yield) : bus(bus), netFn(netFn), cmd(cmd), channel(channel), userId(userId), priv(priv), rqSA(rqSA), yield(yield) @@ -60,7 +60,7 @@ struct Context // srcAddr is only set on IPMB requests because // Platform Event Message needs it to determine the incoming format int rqSA; - boost::asio::yield_context* yield; + boost::asio::yield_context yield; }; namespace message diff --git a/ipmid-new.cpp b/ipmid-new.cpp index c32ba3f..f210c5d 100644 --- a/ipmid-new.cpp +++ b/ipmid-new.cpp @@ -537,7 +537,7 @@ auto executionEntry(boost::asio::yield_context yield, entry("RQSA=%x", rqSA)); auto ctx = std::make_shared<ipmi::Context>(getSdBus(), netFn, cmd, channel, - userId, privilege, rqSA, &yield); + userId, privilege, rqSA, yield); auto request = std::make_shared<ipmi::message::Request>( ctx, std::forward<std::vector<uint8_t>>(data)); message::Response::ptr response = executeIpmiCommand(request); @@ -750,7 +750,7 @@ void handleLegacyIpmiCommand(sdbusplus::message::message& m) m.read(seq, netFn, lun, cmd, data); std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus(); auto ctx = std::make_shared<ipmi::Context>( - bus, netFn, cmd, 0, 0, ipmi::Privilege::Admin, 0, &yield); + bus, netFn, cmd, 0, 0, ipmi::Privilege::Admin, 0, yield); auto request = std::make_shared<ipmi::message::Request>( ctx, std::forward<std::vector<uint8_t>>(data)); ipmi::message::Response::ptr response = |