mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Switches internal joystick errors to take StringRef (#378)
Previously this would have allocated the std::string every time, even if the message wasn't printed. Now takes a StringRef, and only converts to std::string when the message actually gets printed.
This commit is contained in:
committed by
Peter Johnson
parent
31fecc28a4
commit
a6fb1efcbe
@@ -595,7 +595,7 @@ DriverStation::DriverStation() {
|
||||
* Reports errors related to unplugged joysticks
|
||||
* Throttles the errors so that they don't overwhelm the DS
|
||||
*/
|
||||
void DriverStation::ReportJoystickUnpluggedError(std::string message) {
|
||||
void DriverStation::ReportJoystickUnpluggedError(llvm::StringRef message) {
|
||||
double currentTime = Timer::GetFPGATimestamp();
|
||||
if (currentTime > m_nextMessageTime) {
|
||||
ReportError(message);
|
||||
@@ -608,7 +608,7 @@ void DriverStation::ReportJoystickUnpluggedError(std::string message) {
|
||||
*
|
||||
* Throttles the errors so that they don't overwhelm the DS.
|
||||
*/
|
||||
void DriverStation::ReportJoystickUnpluggedWarning(std::string message) {
|
||||
void DriverStation::ReportJoystickUnpluggedWarning(llvm::StringRef message) {
|
||||
double currentTime = Timer::GetFPGATimestamp();
|
||||
if (currentTime > m_nextMessageTime) {
|
||||
ReportWarning(message);
|
||||
|
||||
Reference in New Issue
Block a user