diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2021-03-14 04:48:25 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2021-03-25 13:34:37 +0900 |
commit | ed562c53104fbe097f012bec5a30196334e52d78 (patch) | |
tree | b6be38930e3f0dea9dcddaa55bc62f5657bf70a1 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | 89145649b0d0d51e90a85de23ca881c97d3a71a4 (diff) |
kconfig: refactor option parse code
The current option parse code is clumsy.
The 's' option is separately handled in an if-conditional due to the
following code:
input_mode = (enum input_mode)opt;
If 's' is moved to the switch statement, the invalid value 's' would
be assigned to the input_mode.
Another potential problem is that we are mixing 'enum input_mode' and
ASCII characters. They could overwrap if we add more input modes.
To separate them out, set the flag field of long options to a pointer
of input_mode_opt. For mode select options, getopt_long() returns 0,
which never causes overwrap with ASCII characters that represent short
options.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions