summaryrefslogtreecommitdiff
path: root/src/cam/options.cpp
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2020-07-28 12:45:47 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-10-21 17:18:48 +0100
commit732ea045f506919a313bec5d7623b547967784fc (patch)
treef20a814d816afc1974eb709c5e9b855b1bbe501d /src/cam/options.cpp
parent32d78a7bba3dbbf14ac17b11e4bb34bebc067217 (diff)
cam: options: Rename optional arg to prevent shadowing
The parseValue function is given the optarg directly from the getopt library, but the function retains the same name. This causes an shadowed variable of the global optarg variable to be present in the parseValue function. While this is not harmful, rename it to work towards disabling shadowed variables. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/cam/options.cpp')
-rw-r--r--src/cam/options.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cam/options.cpp b/src/cam/options.cpp
index 358507ea..417c3ab4 100644
--- a/src/cam/options.cpp
+++ b/src/cam/options.cpp
@@ -77,7 +77,7 @@ void OptionsBase<T>::invalidate()
template<typename T>
bool OptionsBase<T>::parseValue(const T &opt, const Option &option,
- const char *optarg)
+ const char *arg)
{
OptionValue value;
@@ -88,9 +88,9 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,
case OptionInteger:
unsigned int integer;
- if (optarg) {
+ if (arg) {
char *endptr;
- integer = strtoul(optarg, &endptr, 0);
+ integer = strtoul(arg, &endptr, 0);
if (*endptr != '\0')
return false;
} else {
@@ -101,12 +101,12 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,
break;
case OptionString:
- value = OptionValue(optarg ? optarg : "");
+ value = OptionValue(arg ? arg : "");
break;
case OptionKeyValue:
KeyValueParser *kvParser = option.keyValueParser;
- KeyValueParser::Options keyValues = kvParser->parse(optarg);
+ KeyValueParser::Options keyValues = kvParser->parse(arg);
if (!keyValues.valid())
return false;