Re: [PATCH 1/1] xfsdump: Mimic GNU basename() API for non-glibc library e.g. musl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 03, 2024 at 06:39:18AM +0000, Brahmajit Das wrote:
> +#if !defined(__GLIBC__)
> +#define basename(src) (strrchr(src, '/') ? strrchr(src, '/') + 1 : src)
> +#endif

A hacky macro without any explanation is really not a good idea.
Now this basically open codes the glibc implementation of basename,
so maybe just turn it into a proper function always used and write
a comment explaining why it exists.





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux