1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-01 18:32:37 +02:00

Fixed parser name match bug

"direction_delay_ms" matched "direction"
This commit is contained in:
Mitch Bradley
2021-05-22 14:56:46 -10:00
parent de6a6d5de0
commit 632344bd9b

View File

@@ -38,8 +38,15 @@ namespace Configuration {
void enter();
void leave();
inline bool is(const char* expected) const {
return current_.keyStart_ != nullptr && !strncmp(expected, current_.keyStart_, size_t(current_.keyEnd_ - current_.keyStart_));
bool is(const char* expected) const {
if (current_.keyStart_ == nullptr) {
return false;
}
auto len = strlen(expected);
if (len != (current_.keyEnd_ - current_.keyStart_)) {
return false;
}
return !strncmp(expected, current_.keyStart_, len);
}
inline StringRange key() const { return StringRange(current_.keyStart_, current_.keyEnd_); }