net: wifi: shell: apply `struct option` as `static const`
This change marks the remaining instance of the `struct option` as
`static const`.
The rationale is that `struct option` is a read-only variable.
By using `static const`, we ensure immutability, leading to usage of only
the `.rodata` section and a reduction in the `.data` area.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c
index cea8e13..adf5b77 100644
--- a/subsys/net/l2/wifi/wifi_shell.c
+++ b/subsys/net/l2/wifi/wifi_shell.c
@@ -458,7 +458,7 @@
struct getopt_state *state;
int opt;
bool secure_connection = false;
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"ssid", required_argument, 0, 's'},
{"passphrase", required_argument, 0, 'p'},
{"key-mgmt", required_argument, 0, 'k'},
@@ -1400,7 +1400,7 @@
{
struct getopt_state *state;
int opt;
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"max_inactivity", required_argument, 0, 'i'},
{"max_num_sta", required_argument, 0, 's'},
{"help", no_argument, 0, 'h'},
@@ -1970,7 +1970,7 @@
int opt;
int opt_index = 0;
struct getopt_state *state;
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"peer", required_argument, 0, 'p'},
{"role", required_argument, 0, 'r'},
{"configurator", required_argument, 0, 'c'},
@@ -2018,7 +2018,7 @@
int opt;
int opt_index = 0;
struct getopt_state *state;
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"own", required_argument, 0, 'i'},
{"freq", required_argument, 0, 'f'},
{0, 0, 0, 0}};
@@ -2054,7 +2054,7 @@
int opt;
int opt_index = 0;
struct getopt_state *state;
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"role", required_argument, 0, 'r'},
{"freq", required_argument, 0, 'f'},
{0, 0, 0, 0}};
@@ -2090,7 +2090,7 @@
int opt;
int opt_index = 0;
struct getopt_state *state;
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"type", required_argument, 0, 't'},
{"opclass", required_argument, 0, 'o'},
{"channel", required_argument, 0, 'h'},
@@ -2152,7 +2152,7 @@
int opt;
int opt_index = 0;
struct getopt_state *state;
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"configurator", required_argument, 0, 'c'},
{"mode", required_argument, 0, 'm'},
{"ssid", required_argument, 0, 's'},