summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/getdents.c
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-04-16 01:20:21 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:38 +0200
commitc28cabb17933d98c9046d4b2492e39757bbacf5a (patch)
tree0357aec448b18e219338dd25db9933c40f3cf5c4 /libc/sysdeps/linux/common/getdents.c
parente21479da34bbe39fb9d99e2f6e323fd1a942d9cb (diff)
Reorder includes and include only what is necessary
Use param.h instead of MIN. Use stddef.h instead of offsetof. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/getdents.c')
-rw-r--r--libc/sysdeps/linux/common/getdents.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index f321aeae6..f4fb7476e 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -4,22 +4,17 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <assert.h>
-#include <errno.h>
+#include <sys/syscall.h>
+#include <bits/wordsize.h>
+
+#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64)
+
#include <dirent.h>
-#include <stddef.h>
-#include <stdint.h>
#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/param.h>
#include <sys/types.h>
-#include <sys/syscall.h>
#include <bits/kernel_types.h>
#include <bits/kernel-features.h>
-#include <bits/uClibc_alloc.h>
-#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64)
/* If the condition above is met, __getdents is defined as an alias
* for __getdents64 (see getdents64.c). Otherwise...
*/
@@ -31,10 +26,6 @@
* version / arch details.
*/
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
struct kernel_dirent
{
long int d_ino;
@@ -77,6 +68,13 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64
+# include <assert.h>
+# include <stddef.h>
+# include <errno.h>
+# include <unistd.h>
+# include <sys/param.h>
+# include <bits/uClibc_alloc.h>
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
@@ -138,6 +136,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif __WORDSIZE == 32
+# include <stddef.h>
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;