From 52774fff56f8315c3f6a55940fa7099a8982eab8 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 6 Feb 2020 22:42:30 +0200 Subject: libcamera: ipa_manager: Use utils::split() 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(-) (limited to 'src/libcamera/ipa_manager.cpp') diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 92adc6c4..4ffbdd71 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) -- cgit v1.2.1