From patchwork Wed Mar 18 15:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3171 Return-Path: Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 44CBE60418 for ; Wed, 18 Mar 2020 16:25:29 +0100 (CET) Received: by mail-pg1-x542.google.com with SMTP id b22so7870300pgb.6 for ; Wed, 18 Mar 2020 08:25:29 -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=xMlGiZUnX5l4eQkEGl7+Y2M2/kQ9YAni9osfJaTdfr0=; b=lQJQOsFBanfboWabMbg9NvhkhcRZdB48WUs3l+q0MY91ScCW1lufcRtfVrWH95OPsP bkBOMP64sURNaV3iy1qDvWyxbjam/gQ8y3dmtt4h9VwD2yTyEmwlMt5lgWvLXgTHpXB/ um/BsD0EfuHx78Del7FniCMvcTY7NLUL6bQ4LKNTwQk5LEqN+/mumk+elnyZXtw/7AlF XUwbr2bVGcpg8EiWcFXD2lTKxKOQM9HAHda+LsOZ4FZz+NbQQn0pBLo/LGS3t64K4dI7 xuyjYpF3VHqwvRZZDd2HM1XkH2gJAIpeXl7Sptate1dSiJeocXJ9vpISVXh5U58U7JN+ WM+A== 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=xMlGiZUnX5l4eQkEGl7+Y2M2/kQ9YAni9osfJaTdfr0=; b=YEuc3GpyJlz3Yo3Ok5Z1UCSi1s0Fr5fwpcrJ7XgWHSlVV6sMCdFPhCKS28tKi1pz/z nCfN0XnWLu9fmOtNYc9UO87TMDKIzU4mGzLpBeu2kSb4LK331brdvFfRlZPPZtn3Sx+F SxgVLr52Ef7qlVVj07fmvIVG3eQvLQfERmhX05d9Btih5Gd3O/TjDb2+P3rcic5oaccX /pRDrPxmqcUxgBxePECFJw+EnqcZYYllWUZ7bwvT+kJYiRS/fufZfOaG6MaUpfPD1+JE tV4ISd1nrbhgkx2O7XTuZAmhi1Wav3au6YJ2mUipR1CtQOTeGB7rc1EkqFVWtrkrm+Qg NWYg== X-Gm-Message-State: ANhLgQ3XT10WIMqvKR/BymT2BbAnLFQFoa3nRIykztxerDbRQdWst4Qj KvDMyae9kKJR+t4IIVctadtXHA== X-Google-Smtp-Source: ADFU+vvq2YaXJaYHA2mDc4mMbm/r3J7i2X3YSoybeDFEdk3nIrUSx77eI8/DOtDAwX3nNOZLB/reww== X-Received: by 2002:a63:be49:: with SMTP id g9mr5213402pgo.30.1584545127884; Wed, 18 Mar 2020 08:25:27 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id i21sm6307560pgn.5.2020.03.18.08.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 08:25:27 -0700 (PDT) From: Kaaira Gupta To: Vaishali Thakkar , Helen Koike , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 20:54:23 +0530 Message-Id: <20200318152427.13126-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318152427.13126-1-kgupta@es.iitr.ac.in> References: <20200318152427.13126-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v4 1/5] 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 15:25:29 -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();