serial_cli: use the reentrant version of strtok().
Newlib's strtok() allocates memory and causes malloc() to be linked in. Use the reentrant version instead. Saves 336 bytes. Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
parent
48024e512e
commit
3740779912
|
@ -1363,13 +1363,14 @@ static void cliMotor(char *cmdline)
|
|||
int motor_value = 0;
|
||||
int index = 0;
|
||||
char *pch = NULL;
|
||||
char *saveptr;
|
||||
|
||||
if (isEmpty(cmdline)) {
|
||||
cliPrint("Usage:\r\nmotor index [value] - show [or set] motor value\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pch = strtok(cmdline, " ");
|
||||
pch = strtok_r(cmdline, " ", &saveptr);
|
||||
while (pch != NULL) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
@ -1380,7 +1381,7 @@ static void cliMotor(char *cmdline)
|
|||
break;
|
||||
}
|
||||
index++;
|
||||
pch = strtok(NULL, " ");
|
||||
pch = strtok_r(NULL, " ", &saveptr);
|
||||
}
|
||||
|
||||
if (motor_index < 0 || motor_index >= MAX_SUPPORTED_MOTORS) {
|
||||
|
|
Loading…
Reference in New Issue