pigeon: use const reference for std::string parameter (#19886)

old-commit-hash: b1660cf585
commatwo_master
Dean Lee 4 years ago committed by GitHub
parent 37d0943201
commit 6f8e6a8d73
  1. 4
      selfdrive/boardd/pigeon.cc
  2. 6
      selfdrive/boardd/pigeon.h

@ -89,7 +89,7 @@ void PandaPigeon::set_baud(int baud) {
panda->usb_write(0xe4, 1, baud/300);
}
void PandaPigeon::send(std::string s) {
void PandaPigeon::send(const std::string &s) {
int len = s.length();
const char * dat = s.data();
@ -180,7 +180,7 @@ void TTYPigeon::set_baud(int baud){
assert(tcflush(pigeon_tty_fd, TCIOFLUSH) == 0);
}
void TTYPigeon::send(std::string s) {
void TTYPigeon::send(const std::string &s) {
int len = s.length();
const char * dat = s.data();

@ -13,7 +13,7 @@ class Pigeon {
void init();
virtual void set_baud(int baud) = 0;
virtual void send(std::string s) = 0;
virtual void send(const std::string &s) = 0;
virtual std::string receive() = 0;
virtual void set_power(bool power) = 0;
};
@ -24,7 +24,7 @@ public:
~PandaPigeon();
void connect(Panda * p);
void set_baud(int baud);
void send(std::string s);
void send(const std::string &s);
std::string receive();
void set_power(bool power);
};
@ -37,7 +37,7 @@ public:
~TTYPigeon();
void connect(const char* tty);
void set_baud(int baud);
void send(std::string s);
void send(const std::string &s);
std::string receive();
void set_power(bool power);
};

Loading…
Cancel
Save