Re: [PATCH] drm/xe: replace basename() with portable strrchr()

From: Carlos Llamas
Date: Thu Aug 21 2025 - 17:34:41 EST


On Thu, Aug 21, 2025 at 04:00:33PM -0500, Lucas De Marchi wrote:
>
> IMO the POSIX version is horrible. Let's add a xbasename() in this
> xe_gen_wa_oob.c and use it:
>
> /*
> * Avoid the libgen.h vs string.h differences or lack thereof, just use
> * our own.
> */
> static const char *xbasename(const char *s)
> {
> const char *p = strrchr(s, '/');
> return p ? p + 1 : s;
> }
>
> static int fn_to_prefix(const char *fn, char *prefix, size_t size)
> {
> ...
> fn = xbasename(fn);
> ...
> }
>

Sounds good. Would you mind if I use __basename()? I'll send the v2 in a
bit.