Message ID | 20200213130908.23638-4-kieran.bingham@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
And finally, On 13/02/2020 13:09, Kieran Bingham wrote: > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Replace the custom string splitting implementation with utils::split(). > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > [Kieran: Re-fit to master branch] > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> I've modified this patch, as it's original base was upon a set of patches where I moved all this code around. To simplify things, I've rebased it here. I think the SoB implies Reviewed-by: here anyway, but as I've distinctly modified it - another ~RB tag would be good from anyone. Kieran > --- > 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) >
Hi Kieran, Thank you for the patch. On Thu, Feb 13, 2020 at 01:27:03PM +0000, Kieran Bingham wrote: > And finally, > > On 13/02/2020 13:09, Kieran Bingham wrote: > > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > > Replace the custom string splitting implementation with utils::split(). > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > [Kieran: Re-fit to master branch] > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > I've modified this patch, as it's original base was upon a set of > patches where I moved all this code around. > > To simplify things, I've rebased it here. > > I think the SoB implies Reviewed-by: here anyway, but as I've distinctly > modified it - another ~RB tag would be good from anyone. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > > 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)
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)