Mark shell_commands as const
This enables the compiler to place the array in flash, saving us a bit of RAM. Suggested-by: g-oikonomou
This commit is contained in:
parent
56dd8dcea4
commit
1a95aad7a7
@ -345,7 +345,7 @@ PT_THREAD(cmd_log(struct pt *pt, shell_output_func output, char *args))
|
||||
static
|
||||
PT_THREAD(cmd_help(struct pt *pt, shell_output_func output, char *args))
|
||||
{
|
||||
struct shell_command_t *cmd_ptr;
|
||||
const struct shell_command_t *cmd_ptr;
|
||||
|
||||
PT_BEGIN(pt);
|
||||
|
||||
@ -734,7 +734,7 @@ shell_commands_init(void)
|
||||
echo_reply_handler);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
struct shell_command_t shell_commands[] = {
|
||||
const struct shell_command_t shell_commands[] = {
|
||||
{ "help", cmd_help, "'> help': Shows this help" },
|
||||
{ "reboot", cmd_reboot, "'> reboot': Reboot the board by watchdog_reboot()" },
|
||||
{ "ip-addr", cmd_ipaddr, "'> ip-addr': Shows all IPv6 addresses" },
|
||||
|
@ -54,7 +54,7 @@ struct shell_command_t {
|
||||
};
|
||||
|
||||
/* The set of supported commands */
|
||||
extern struct shell_command_t shell_commands[];
|
||||
extern const struct shell_command_t shell_commands[];
|
||||
|
||||
/**
|
||||
* Initializes Shell-commands module
|
||||
|
@ -89,7 +89,7 @@ output_prompt(shell_output_func output)
|
||||
PT_THREAD(shell_input(struct pt *pt, shell_output_func output, const char *cmd))
|
||||
{
|
||||
static char *args;
|
||||
static struct shell_command_t *cmd_ptr;
|
||||
static const struct shell_command_t *cmd_ptr;
|
||||
|
||||
PT_BEGIN(pt);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user