summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaaira Gupta <kgupta@es.iitr.ac.in>2020-03-18 20:54:23 +0530
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-03-18 20:54:23 +0530
commit6afe116dcc3252a8b1a357de8d9d47dbc3895329 (patch)
tree4bc384a50f4570d8d3195dfbe24e5edb1ef9ec8c
parent00eb88f893010c4e6efeb2e15f5181d4dfc7d199 (diff)
libcamera: ipa_proxy: use utils::split()
Replace the manual string splitting with utils::split() Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/ipa_proxy.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp
index 5a3d2f1c..c7347c88 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();