Optimized comment stripper code
This commit is contained in:
parent
1df9097e32
commit
0ee67a521b
|
@ -1712,11 +1712,13 @@ void cliProcess(void)
|
||||||
|
|
||||||
// Strip comment starting with # from line
|
// Strip comment starting with # from line
|
||||||
char *p = cliBuffer;
|
char *p = cliBuffer;
|
||||||
p = strchr(++p, '#');
|
p = strchr(p, '#');
|
||||||
if (NULL != p) {
|
if (NULL != p) {
|
||||||
bufferIndex = (uint32_t)(p - cliBuffer);
|
bufferIndex = (uint32_t)(p - cliBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process non-empty lines
|
||||||
|
if (bufferIndex > 0) {
|
||||||
// Strip trailing whitespace
|
// Strip trailing whitespace
|
||||||
while (bufferIndex > 0 && cliBuffer[bufferIndex - 1] == ' ') {
|
while (bufferIndex > 0 && cliBuffer[bufferIndex - 1] == ' ') {
|
||||||
bufferIndex--;
|
bufferIndex--;
|
||||||
|
@ -1724,7 +1726,6 @@ void cliProcess(void)
|
||||||
|
|
||||||
cliBuffer[bufferIndex] = 0; // null terminate
|
cliBuffer[bufferIndex] = 0; // null terminate
|
||||||
|
|
||||||
if (cliBuffer[0] != '#') {
|
|
||||||
target.name = cliBuffer;
|
target.name = cliBuffer;
|
||||||
target.param = NULL;
|
target.param = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue