From patchwork Tue Mar 17 17:31:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3141 Return-Path: Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 96B1462923 for ; Tue, 17 Mar 2020 18:32:23 +0100 (CET) Received: by mail-pf1-x441.google.com with SMTP id f206so1318271pfa.10 for ; Tue, 17 Mar 2020 10:32:23 -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=937pg80/2jSGNdf30pGtilFr29to8/0csaOJIrbvAUg=; b=tTbKdGef7s99K0RHj5xZ53cVVOCyQ5UTsmTfqgkU0Fw0Kfax/EIUi5c25Xu7cFAiEt 6PAmG4zwv1qG9WWjE85cEAvIf0L64p5ozsRH4IbUM7/EdhyGzF8mnf+bjk8jQZQHIKHm mnMYGIiD07j40jlS1QHawPSEkelXbHYhnQ7p46RYDLIRIcHIOBjpFoljPnYc9EBeYYSA +A552lQfNpdgGdYY2sW5c6AUfUL8ctEovnIE35EUysCiCgK3XBoy5m/8KlRIKxozhKyj 2jAH34wLez9Nfk4r4MphHYPuPDHk2UAqqwJZpmjaCJKOw7b6iJL/s2LNGanLAnhYNdGJ SQWA== 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=937pg80/2jSGNdf30pGtilFr29to8/0csaOJIrbvAUg=; b=EB7JTJHiTBi2dYI4SEv9nBgk8isdQnyuOCGjYVhzIrCr3Um/38+t3bpTG/sAypaaZN f45UNdbUVWWRjCCxlmUB7F9KRplp3WlBlgHq2LrQh8BbrqXIzCgxUxl9BwEMxCio1+Ed onNe3CeVX8y/riYJLMk13DrkOQbfwFYfsCK/7ymP15SVQIPGj0BKSltQh0g7qZ78FM+P ofzXdHdeT4rLjs3aq6iL6jS+7mRzWrsf7EmpuhWWnka+X/O3CjoGwt0mdYNuVeFLsG9f zFNDAUcM3UeV1YkvvxX53Fea7jE1QxaGY6KZV14eugnkjh1uLTg65kddU50tA9msLDug LzWQ== X-Gm-Message-State: ANhLgQ3pGgwT6Q4sLydPcmwYxF7VNFazcuJKxPSEbuLWO/BhJmckTToo W5GSykrJnClG9XFnlC6h34gMtg== X-Google-Smtp-Source: ADFU+vuFeCZh4DEW5DbFML3gFikvH+0M9nCUq1lxbSaMbPizda0XR88KDIa0g82asP6fqSQE/HPvJw== X-Received: by 2002:a62:1dd0:: with SMTP id d199mr6663352pfd.9.1584466341826; Tue, 17 Mar 2020 10:32:21 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id 66sm3873965pfb.150.2020.03.17.10.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 10:32:21 -0700 (PDT) From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, kieran.bingham@ideasonboard.com, Helen Koike , Vaishali Thakkar Cc: Kaaira Gupta Date: Tue, 17 Mar 2020 23:01:42 +0530 Message-Id: <20200317173145.18226-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200317173145.18226-1-kgupta@es.iitr.ac.in> References: <20200317173145.18226-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA 1/4] 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: Tue, 17 Mar 2020 17:32:23 -0000 Replace the manual string splitting with utils::split() Signed-off-by: Kaaira Gupta Reviewed-by: Kieran Bingham --- src/libcamera/ipa_proxy.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index 5a3d2f1..e04117c 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -83,23 +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 (count) { - std::string proxyPath(execPaths, count); + if (execPaths) { + for (const auto &dir : utils::split(execPaths, ":")){ + if (dir.empty()) + continue; + 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(); }