[PATCH] Use offsetof instead of magic number in scandir()
Sebastian Huber
sebastian.huber@embedded-brains.de
Thu Mar 28 11:45:00 GMT 2013
On 03/28/2013 12:17 PM, Corinna Vinschen wrote:
> Shouldn't we better use the upstream version as used in FreeBSD and
> OpenBSD?
>
> #define DIRSIZ(dp) \
> ((sizeof(struct dirent) - sizeof(dp)->d_name) + \
> (((dp)->d_namlen + 1 + 3) &~ 3))
I have problems to understand this expression. What is "sizeof(dp)->d_name"?
I think this looks like a hand-crafted offsetof variant.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the Newlib
mailing list