From patchwork Tue Oct 13 15:12:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10047 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C7814BEEDF for ; Tue, 13 Oct 2020 15:12:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 86C8860CE6; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ggHC22kB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D54AE60D4B for ; Tue, 13 Oct 2020 17:12:46 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 66B0CBA9; Tue, 13 Oct 2020 17:12:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601966; bh=5cAqMH7H4oMMDzC8cVZvQ4YbqlGcPES8aYPfVwzJYYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ggHC22kBL/3DO1Rh+NaI4+LrjdC+6LlFdHIa0cqIjsxRD42vWr8l39Uzjpt6Gjpur F+EKZevKPmDgTF7L9ApUDFo5uQKUPsJ1wD4lZhb1vo60yywLgvZ4Sc92A6Hgfu7c5c y/kQ6LeJzVbtuj633WMjawBhjhgNj6qAGGtcPhSU= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:32 +0100 Message-Id: <20201013151241.3557005-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/10] cam: options: Rename optional arg to prevent aliasing X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The parseValue function is given the optarg directly from the getopt library, but the function retains the same name. This causes an alias of the global optarg variable to be present in the parseValue function. While this is not harmful, rename it to work towards disabling aliases variables. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 358507eabf89..417c3ab49bc9 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -77,7 +77,7 @@ void OptionsBase::invalidate() template bool OptionsBase::parseValue(const T &opt, const Option &option, - const char *optarg) + const char *arg) { OptionValue value; @@ -88,9 +88,9 @@ bool OptionsBase::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::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;