-
Notifications
You must be signed in to change notification settings - Fork 8.2k
net: wifi: shell: streamline codebase #76528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: wifi: shell: streamline codebase #76528
Conversation
|
@ndrs-pst can you check the CI issue so we get this merged |
Various manual code formatting adjustments, including:
- Wrapping lines in the `long_options` declaration to prevent them
from extending too far to the right.
- Adding missing `{` and `}` in the `if` statement in
`cmd_wifi_set_rts_threshold`.
- Aligning `SHELL_CMD_ARG` in `wifi_commands` with previous declarations.
Signed-off-by: Pisit Sawangvonganan <[email protected]>
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]>
7b558d0 to
9fb5b2f
Compare
Using `getopt_state` to access `optarg` and also `optopt` offers a better alternative to direct global access. See e145eb9 for the previous change related to this. Signed-off-by: Pisit Sawangvonganan <[email protected]>
9fb5b2f to
63a6013
Compare
Rebase and resolve merge conflicts, incorporating two additional commits. |
subsys/net/l2/wifi/wifi_shell.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the rule was opposite i.e., to have spaces there, at least it was like that in the past, but perhaps this has changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW after dumping with following command since Zephyr use BasedOnStyle: LLVM
clang-format -style=llvm -dump-config > .clang-format-llvm
Seems this configuration was enabled Cpp11BracedListStyle: true
https://clang.llvm.org/docs/ClangFormatStyleOptions.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many styles possible, not sure this one is the best for us.
Could you take this commit away from this PR, lets figure out the used style later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's follow existing style in Zephyr, if needed a separate PR that fixes style in enitre repo can be raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jukkar Rather than take this commit away, how about to remove just the following?
- Reformatted
{ 0 }to{0}as per .clang-formatsettingsfor uniformity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that is fine
Enhancing code consistency provides cognitive leverage with the following changes: - Unified the order of declaration for `opt`, `opt_index`, `state`, and `long_options`. - Unified the wrapping of `getopt_long` calls, regardless of the length of the `options` string. - Renamed `option_index` to `opt_index` for consistency. Signed-off-by: Pisit Sawangvonganan <[email protected]>
63a6013 to
d6f2f43
Compare
Streamline
wifi_shell.cwith following commits:struct optionasstatic constto reduce.dataarea usageSince the rebase was applied after PR #73707 which led to two more commits in this PR 😅
getopt_statefor saferoptargaccess