Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Update with reference for optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
forno committed Nov 4, 2016
1 parent 777dcdf commit 25a000d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ics::Core::Core(const std::string& path, speed_t baudrate)
throw std::invalid_argument {"Not tty device"};
if (tcgetattr(fd, &oldTio) < 0)
throw std::runtime_error {"Cannot setup tty"};
auto newTio = getTermios();
auto&& newTio = getTermios(); // forward reference
if (cfsetispeed(&newTio, baudrate) < 0)
throw std::runtime_error {"Cannot set baudrate"};
if (cfsetospeed(&newTio, baudrate) < 0)
Expand Down Expand Up @@ -66,7 +66,7 @@ void ics::Core::communicate(const Container& tx, Container& rx) {
write(fd, tx.data(), tx.size()); // send
for (auto& receive : rx) read(fd, &receive, 1); // receive
// check section
auto receive = rx.cbegin();
auto&& receive = rx.cbegin();
for (const auto& send : tx) {
if (send != *receive) {
std::stringstream ss;
Expand All @@ -82,7 +82,7 @@ void ics::Core::communicateID(const IDContainerTx& tx, IDContainerRx& rx) {
write(fd, tx.data(), tx.size()); // send
for (auto& receive : rx) read(fd, &receive, 1); // receive
// check section
auto receive = rx.cbegin();
auto&& receive = rx.cbegin();
for (const auto& send : tx) {
if (send != *receive) {
std::stringstream ss;
Expand Down

0 comments on commit 25a000d

Please sign in to comment.