[libcamera-devel] [PATCH 3/4] libcamera: log: Use internal basename implementation.
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sat Mar 23 00:05:45 CET 2019
Hi Kieran,
Thank you for the patch.
On Fri, Mar 22, 2019 at 10:43:49AM +0000, Kieran Bingham wrote:
> Differing implementations of basename() exist, some of which may modify
s/Differing/Different/ ?
> the content of the string passed as an argument.
>
> The implementation of basename() is trivial, thus to support different
> toolchains, provide our own version which accepts and returns a const
> char*.
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
> src/libcamera/log.cpp | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
> index 26ebf410a7a9..7d930cd6b99e 100644
> --- a/src/libcamera/log.cpp
> +++ b/src/libcamera/log.cpp
> @@ -358,6 +358,12 @@ static const char *log_severity_name(LogSeverity severity)
> return "UNKWN";
> }
>
> +static const char *basename(const char *path)
> +{
> + const char *base = strrchr(path, '/');
> + return base ? ++base : path;
I'd write
return base ? base + 1 : path;
> +}
> +
Should this go to utils.h ?
> /**
> * \class LogMessage
> * \brief Internal log message representation.
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list