On 04/09/2014 06:21 PM, Eric Blake wrote:
> On 04/09/2014 10:11 AM, Paul Eggert wrote:
>> Pádraig Brady wrote:
>>> But you're correct, so please push an adjustment,
>>> or I can handle it later.
>>
>> I installed it.
>
> Almost - you forgot to revert the deletion of the fallback macro, so I
> fixed that.
Thanks you for fixing it.
For my own reference, this solution is exactly what is proposed
in <dirent.h> (on my Linux box):
/* These macros extract size information from a `struct dirent *'.
They may evaluate their argument multiple times, so it must not
have side effects. Each of these may involve a relatively costly
call to `strlen' on some systems, so these values should be cached.
_D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including
its terminating null character.
[...]
*/
#ifdef _DIRENT_HAVE_D_NAMLEN
# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
[...]
#else
# define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name))
[...]
# endif
#endif
Thanks again & have a nice day,
Berny