mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 05:37:54 -06:00
command: Store the command parsing information directly in array
Instead of defining an array of pointers, just define the array directly. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
a82e949c00
commit
d4bed025ed
4 changed files with 27 additions and 29 deletions
|
@ -213,14 +213,9 @@ DECL_SHUTDOWN(sendf_shutdown);
|
|||
static const struct command_parser *
|
||||
command_get_handler(uint8_t cmdid)
|
||||
{
|
||||
if (cmdid >= READP(command_index_size))
|
||||
goto error;
|
||||
const struct command_parser *cp = READP(command_index[cmdid]);
|
||||
if (!cp)
|
||||
goto error;
|
||||
return cp;
|
||||
error:
|
||||
shutdown("Invalid command");
|
||||
if (!cmdid || cmdid >= READP(command_index_size))
|
||||
shutdown("Invalid command");
|
||||
return &command_index[cmdid];
|
||||
}
|
||||
|
||||
enum { CF_NEED_SYNC=1<<0, CF_NEED_VALID=1<<1 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue