From patchwork Wed Mar 18 11:58:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3163 Return-Path: Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0C20D60419 for ; Wed, 18 Mar 2020 12:59:12 +0100 (CET) Received: by mail-pl1-x643.google.com with SMTP id h11so1580649plr.11 for ; Wed, 18 Mar 2020 04:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=agsiwyHzfZJIIoAsTPb14yEuXD72N4ZhO6DvJhFu2dY=; b=t7iWuFgJ/CdAQPrS7GtGEY1Qaow9FN18Jt8LwE1rKWep30XNX11ess7aQxTvdc7ndM IlWHocS6GKYbTBIxxoInMdfaDtZeEQw7LxpQVDi6mmZ6K8l0q+398Gqa3c7FUVIXFekc jniLxRfZha/m5K8EsBB4b3yXWUtsZy3gAkVutZgXw6F4SAkFvVDxEPmecbCIAvxJYnBi IMYHoXcobjyMKn0+7pHMpyyq4DirBwCgFccTS8rP5iwCrkTx9pgy9nk8DPL8WmhEDwWm ACc83CCTkpi/R0CJihoS0NH/nEPJLdFnNSqzbs5b0u/Lhw4WU4FXKonfuOMuBquAK1oM AQRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=agsiwyHzfZJIIoAsTPb14yEuXD72N4ZhO6DvJhFu2dY=; b=hOo2SyE2FKSip6kuRRchqvmSIA3pnFymR7q23w4W3BgLJSFojZ/kJvNoBjR3x+dLUc bNlwJh2lFm7A57efIQcuZrvdXTOlmepE8fDBH529SDoodfGeyq967Qr7UrRQerbwN9WI UJGhOfS2bR/Lptdh7XgVddvrYDxBq0ujSu3XmMwcTHrf0RVBKtbBH7bR0f6lqTU5hh7m mMeadvh4R321ai+45gY8nyD/yfFha2VbnK2uj6cskQmyWI9d0pgxTbFqwEmCQj5/kzeq ZXbtB+kXUTiewpvgXaK0wDt2F7WamdmjQRHFL4FqWIbi0dIUYIbHtF97rp14w5uEaBRh 5Z6A== X-Gm-Message-State: ANhLgQ19AYeWKTS+l9SxCxJgEWsY+1F/tB+bO8cq5AsbwDStmrv7FrQM vzpvvjbG9g1FxligudDP8zuvVQ== X-Google-Smtp-Source: ADFU+vuwTWVey58q002cNJpgZljei5oaZDirhMs8nG30CdG12S8OUD+HwoCRPa9PeoMEz/oW+crlJQ== X-Received: by 2002:a17:902:528:: with SMTP id 37mr3641534plf.322.1584532750286; Wed, 18 Mar 2020 04:59:10 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id k3sm6542539pfp.142.2020.03.18.04.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 04:59:09 -0700 (PDT) From: Kaaira Gupta To: Helen Koike , Vaishali Thakkar , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 17:28:41 +0530 Message-Id: <20200318115846.7975-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318115846.7975-1-kgupta@es.iitr.ac.in> References: <20200318115846.7975-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v3 1/6] libcamera: ipa_proxy: use utils::split() 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: , X-List-Received-Date: Wed, 18 Mar 2020 11:59:12 -0000 Replace the manual string splitting with utils::split() Signed-off-by: Kaaira Gupta Reviewed-by: Kieran Bingham --- src/libcamera/ipa_proxy.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index 5a3d2f1..c7347c8 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -83,21 +83,16 @@ std::string IPAProxy::resolvePath(const std::string &file) const /* No exec target in install directory; check env variable. */ const char *execPaths = utils::secure_getenv("LIBCAMERA_IPA_PROXY_PATH"); - while (execPaths) { - const char *delim = strchrnul(execPaths, ':'); - size_t count = delim - execPaths; + if (execPaths) { + for (const auto &dir : utils::split(execPaths, ":")) { + if (dir.empty()) + continue; - if (count) { - std::string proxyPath(execPaths, count); + std::string proxyPath = dir; proxyPath += proxyFile; if (!access(proxyPath.c_str(), X_OK)) return proxyPath; } - - if (*delim == '\0') - break; - - execPaths += count + 1; } return std::string();