cpupower: remove extern declarations in cmd_set()
PATCH 1/1 cpupower: remove extern declarations in cmd_set()
extern char *optarg and extern int optind, opterr, optopt are already declared by <getopt.h>, which is included at the top of the file. Repeating extern declarations inside a function body is misleading and unnecessary.
--- tools/power/cpupower/utils/cpupower-set.c | 2 -- 1 file changed, 2 deletions(-)
tools/power/cpupower/utils/cpupower-set.c +0 -2
@@ -51,8 +51,6 @@ static int parse_int_range(const char *arg, int min, int max, int *out)int cmd_set (int argc,char **argv) { -extern char *optarg; -extern int optind, opterr, optopt;unsigned int cpu;struct utsname uts;
Signature · 1 line
2.34.1
Shuah Khan
maintainerQuoted 4 lines · Kaushlendra Kumar
extern char *optarg and extern int optind, opterr, optopt are already declared by <
getopt.h>, which is included at the top of the file. Repeating extern declarations inside a function body is misleading and unnecessary.
Okay - are there errors from compilers or static checkers? How did you find the problem?
Quoted 11 lines
Signed-off-by Kaushlendra Kumar <[email protected]>--- tools/power/cpupower/utils/cpupower-set.c | 2 -- 1 file changed, 2 deletions(-)tools/power/cpupower/utils/cpupower-set.c +0
-0
tools/power/cpupower/utils/cpupower-set.c static int parse_int_range(const char *arg, int min, int max, int *out) · line 56
Quoted 8 lines
tools/power/cpupower/utils/cpupower-set.c +0
-2@@ -51,8 +51,6 @@ static int parse_int_range(const char *arg, int min, int max, int *out)int cmd_set (int argc,char **argv) { -extern char *optarg; -extern int optind, opterr, optopt;unsigned int cpu;struct utsname uts;
thanks,
-- Shuah
Quoted 1 line · Shuah Khan
Okay - are there errors from compilers or static checkers? How did you find the problem?
No errors from compilers or static checkers. We found this while doing local code modifications to the file. During the review of the changes, we noticed the redundant extern declarations and cleaned them up as part of good housekeeping.
Thanks,
Kaushlendra Kumar
Shuah Khan
maintainerQuoted 7 lines · Kaushlendra
Quoted 1 line · Shuah Khan
Okay - are there errors from compilers or static checkers? How did you find the problem?
No errors from compilers or static checkers. We found this while doing local code modifications to the file. During the review of the changes, we noticed the redundant extern declarations and cleaned them up as part of good housekeeping.
There are a few other places in cpupower that can be fixed. Send me a patch that removes just the extern declarations without the parse_int_range() stuff
extern char *optarg;
extern int optind, opterr, optopt;
thanks,
-- Shuah
Quoted 6 lines
There are a few other places in cpupower that can be fixed. Send me a patch that removes just the extern declarations without the
parse_int_range()stuffextern char *optarg;
extern int optind, opterr, optopt;
Sure, will do.
Thanks,
Kaushlendra