[PATCH] Check for existence of asprintf and vasprintf
Fri Feb 24 09:42:00 GMT 2017
>> and the GNU variant is a whopping two lines of code:
>> char *base = strrchr(path, '/');
>> return base ? base + 1 : (char *)path;
> and we get straight to an example of why your solutions don't scale.
> your replacement is wrong. and ironically, it's wrong on Windows,
> which is the whole point of your work. '/' is not the path sep used
> on every system out there. it also does not properly handle systems
> (such as Windows) that have filesystem prefixes like C:\.
Both basename variants' documentations only talk about '/'. This is not
the place where we should handle windows directory separators. We should
either already expect forward slashes as input (with drive names as
first path component, as e.g. msys does it), or convert them early on.
And the implementation I've given above is the same code as in glibc.
However, I will actually prepare some patches to replace missing
functions using gnulib rather than my own implementations.
More information about the Elfutils-devel