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

old-commit-hash: b1660cf585278a65ec439ad8152cc8969797001a
This commit is contained in:
Dean Lee
2021-01-26 12:48:24 +08:00
committed by GitHub
parent 37d0943201
commit 6f8e6a8d73
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -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();
+3 -3
View File
@@ -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);
};