From patchwork Wed Mar 18 00:10:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3147 Return-Path: Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 701F360422 for ; Wed, 18 Mar 2020 01:10:31 +0100 (CET) Received: by mail-pl1-x644.google.com with SMTP id g6so10359298plt.2 for ; Tue, 17 Mar 2020 17:10:31 -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=0k3SXu/OVTTm4R1dMrdzhoOHXiYgb3hcUSCJiQW9Z7L+fLrNycL8/vCFgViU1EA7wf XEmQPYHdkM4dHV/yKpmIFJ5fN7lnvdTGtX6hed6DUxRxKepTvWLHWIWNrVNgsizec06M SVnISYlllA9o+v+gc67ii6sEaW+eFtDMxmHdn2BPO15o31mbTZRKbQ/E8+OF6y6tYXBB SBrcbzzAdFH3gJSFkV2LMvF5LspItINSWV399ye2lxGAC5kKVnhjTZsxz1riGzo17A7A 9w7jjwxCHfLGDzumfFEyAZmYi1H/0yF2YGhU1NliopDOksNc8jIhRfAv9WduRNk5hFWL lB1Q== 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=G1i7bkw9hJjap3mHgA/IzBEVP7+sZtTbrhksoYxHSr2Xphb8U6aZdyFfDazd37vQ0X uREMKpustnD0YL3p1nOSQglEL4DWToYL7Tu2fFZKHGqqa92NCuwhEgqV6Y6fZc3DzHoL vZh4Oe9Lh7hgkEEbn+ryyOf6cCsOTREoBATg/vU1cOuodYvDzuF74QPvY08/v3TwpQM6 L2Zx4mFFbx9k3J48zHi6PCZMLuJ0OGfg1eqG6ZeTgAdjsOxrFhXP1fYwZboQuG+2D6xG kLRjzUs/CTWP22iCYDZC5sOMY1/MrUwMHboxHnS/5MlcOm9qofP0Axiv8xVavLRoi9Sx /bTw== X-Gm-Message-State: ANhLgQ0CYV6CcoRCNpzDFKTKRdrjXSXT7tbqC9+GUnnpGimdcJlh395p PLaOgUrKBG5fghDgkzr4dOG2YA== X-Google-Smtp-Source: ADFU+vs9GtrhwFTQ0UgvorHmnVGbxk6XZLxL4eTutZmSLSQGUWqf+vFeWmjoL3LxUu1vPUKDQX2RsQ== X-Received: by 2002:a17:902:9b95:: with SMTP id y21mr1201488plp.101.1584490230005; Tue, 17 Mar 2020 17:10:30 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id e9sm4294006pfl.179.2020.03.17.17.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 17:10:29 -0700 (PDT) From: Kaaira Gupta To: kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org, Helen Koike , Vaishali Thakkar Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 05:40:04 +0530 Message-Id: <20200318001009.32512-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318001009.32512-1-kgupta@es.iitr.ac.in> References: <20200318001009.32512-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v2 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 00:10:31 -0000 Replace the manual string splitting with utils::split() Signed-off-by: Kaaira Gupta --- 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();