Skip to content

Commit 5af4e9d

Browse files
ndrs-pstcfriedt
authored andcommitted
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 <[email protected]>
1 parent e87d508 commit 5af4e9d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv
458458
struct getopt_state *state;
459459
int opt;
460460
bool secure_connection = false;
461-
static struct option long_options[] = {
461+
static const struct option long_options[] = {
462462
{"ssid", required_argument, 0, 's'},
463463
{"passphrase", required_argument, 0, 'p'},
464464
{"key-mgmt", required_argument, 0, 'k'},
@@ -1400,7 +1400,7 @@ static int wifi_ap_config_args_to_params(const struct shell *sh, size_t argc, ch
14001400
{
14011401
struct getopt_state *state;
14021402
int opt;
1403-
static struct option long_options[] = {
1403+
static const struct option long_options[] = {
14041404
{"max_inactivity", required_argument, 0, 'i'},
14051405
{"max_num_sta", required_argument, 0, 's'},
14061406
{"help", no_argument, 0, 'h'},
@@ -1970,7 +1970,7 @@ static int parse_dpp_args_auth_init(const struct shell *sh, size_t argc, char *a
19701970
int opt;
19711971
int opt_index = 0;
19721972
struct getopt_state *state;
1973-
static struct option long_options[] = {
1973+
static const struct option long_options[] = {
19741974
{"peer", required_argument, 0, 'p'},
19751975
{"role", required_argument, 0, 'r'},
19761976
{"configurator", required_argument, 0, 'c'},
@@ -2018,7 +2018,7 @@ static int parse_dpp_args_chirp(const struct shell *sh, size_t argc, char *argv[
20182018
int opt;
20192019
int opt_index = 0;
20202020
struct getopt_state *state;
2021-
static struct option long_options[] = {
2021+
static const struct option long_options[] = {
20222022
{"own", required_argument, 0, 'i'},
20232023
{"freq", required_argument, 0, 'f'},
20242024
{0, 0, 0, 0}};
@@ -2054,7 +2054,7 @@ static int parse_dpp_args_listen(const struct shell *sh, size_t argc, char *argv
20542054
int opt;
20552055
int opt_index = 0;
20562056
struct getopt_state *state;
2057-
static struct option long_options[] = {
2057+
static const struct option long_options[] = {
20582058
{"role", required_argument, 0, 'r'},
20592059
{"freq", required_argument, 0, 'f'},
20602060
{0, 0, 0, 0}};
@@ -2090,7 +2090,7 @@ static int parse_dpp_args_btstrap_gen(const struct shell *sh, size_t argc, char
20902090
int opt;
20912091
int opt_index = 0;
20922092
struct getopt_state *state;
2093-
static struct option long_options[] = {
2093+
static const struct option long_options[] = {
20942094
{"type", required_argument, 0, 't'},
20952095
{"opclass", required_argument, 0, 'o'},
20962096
{"channel", required_argument, 0, 'h'},
@@ -2152,7 +2152,7 @@ static int parse_dpp_args_set_config_param(const struct shell *sh, size_t argc,
21522152
int opt;
21532153
int opt_index = 0;
21542154
struct getopt_state *state;
2155-
static struct option long_options[] = {
2155+
static const struct option long_options[] = {
21562156
{"configurator", required_argument, 0, 'c'},
21572157
{"mode", required_argument, 0, 'm'},
21582158
{"ssid", required_argument, 0, 's'},

0 commit comments

Comments
 (0)