From patchwork Thu Feb 13 13:09:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2811 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B1B7B61958 for ; Thu, 13 Feb 2020 14:09:13 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4AD449D3; Thu, 13 Feb 2020 14:09:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1581599353; bh=LELX5un+q4zi/OHCFaQBuUGHJuUBLMW5GcBiSKuVIRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mVzA+ljyTgAJ6Io25zYZuAWqlv+dTYXGdOBn6sZUCeEGANcDoUCCqFTQ0OF4bWpqt PzjeSvLKAsqnjsH/LkjjZC1xdP8tEC71fIXoSzf9xtWIDnbbCjWOltTpsqtJEIRq6O A+1lbahjDmB2ckqrJ5l1Cb4W9JQrKCBnHPq3YUFA= From: Kieran Bingham To: libcamera devel Date: Thu, 13 Feb 2020 13:09:08 +0000 Message-Id: <20200213130908.23638-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200213130908.23638-1-kieran.bingham@ideasonboard.com> References: <20200213130908.23638-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] libcamera: ipa_manager: 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: Thu, 13 Feb 2020 13:09:13 -0000 From: Laurent Pinchart Replace the custom string splitting implementation with utils::split(). Signed-off-by: Laurent Pinchart [Kieran: Re-fit to master branch] Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/ipa_manager.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 92adc6c45015..4ffbdd712ac2 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -110,22 +110,13 @@ IPAManager::IPAManager() return; } - const char *paths = modulePaths; - while (1) { - const char *delim = strchrnul(paths, ':'); - size_t count = delim - paths; - - if (count) { - std::string path(paths, count); - ret = addDir(path.c_str()); - if (ret > 0) - ipaCount += ret; - } - - if (*delim == '\0') - break; + for (const auto &dir : utils::split(modulePaths, ":")) { + if (dir.empty()) + continue; - paths += count + 1; + int ret = addDir(dir.c_str()); + if (ret > 0) + ipaCount += ret; } if (!ipaCount)