* libc/posix/scandir.c (DIRSIZ): Use offsetof instead of magic
number.
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2013-04-02  Sebastian Huber  <sebastian.huber@embedded-brains.de> | ||||||
|  |  | ||||||
|  | 	* libc/posix/scandir.c (DIRSIZ): Use offsetof instead of magic | ||||||
|  | 	number. | ||||||
|  |  | ||||||
| 2013-03-27  Bin Cheng  <bin.cheng@arm.com> | 2013-03-27  Bin Cheng  <bin.cheng@arm.com> | ||||||
|  |  | ||||||
| 	* acconfig.h (_FVWRITE_IN_STREAMIO): Undefine. | 	* acconfig.h (_FVWRITE_IN_STREAMIO): Undefine. | ||||||
|   | |||||||
| @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)scandir.c	5.10 (Berkeley) 2/23/91"; | |||||||
|  |  | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||||
|  | #include <stddef.h> | ||||||
| #include <dirent.h> | #include <dirent.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
| @@ -56,10 +57,10 @@ static char sccsid[] = "@(#)scandir.c	5.10 (Berkeley) 2/23/91"; | |||||||
| #undef DIRSIZ | #undef DIRSIZ | ||||||
| #ifdef _DIRENT_HAVE_D_NAMLEN | #ifdef _DIRENT_HAVE_D_NAMLEN | ||||||
| #define DIRSIZ(dp) \ | #define DIRSIZ(dp) \ | ||||||
|     ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) |     (offsetof (struct dirent, d_name) + (((dp)->d_namlen+1 + 3) &~ 3)) | ||||||
| #else | #else | ||||||
| #define DIRSIZ(dp) \ | #define DIRSIZ(dp) \ | ||||||
|     ((sizeof (struct dirent) - (MAXNAMLEN+1)) + ((strlen((dp)->d_name)+1 + 3) &~ 3)) |     (offsetof (struct dirent, d_name) + ((strlen((dp)->d_name)+1 + 3) &~ 3)) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifndef __P | #ifndef __P | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user