[libcamera-devel] [PATCH 3/3] libcamera: ipa_manager: Use utils::split()

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Feb 13 14:27:03 CET 2020


And finally,

On 13/02/2020 13:09, Kieran Bingham wrote:
> From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
> Replace the custom string splitting implementation with utils::split().
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> [Kieran: Re-fit to master branch]
> Signed-off-by: Kieran Bingham <kieran.bingham at 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)
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list