diff mbox series

[2/7] Define _DIRENT_MATCHES_DIRENT64 regardless

Message ID 1520017165-15830-2-git-send-email-adhemerval.zanella@linaro.org
State New
Headers show
Series [1/7] Assume O_DIRECTORY for opendir | expand

Commit Message

Adhemerval Zanella Netto March 2, 2018, 6:59 p.m. UTC
This patch defines _DIRENT_MATCHES_DIRENT64 to either 0 or 1 and adjust its
usage from checking its definition to its value.

Checked on a build for major Linux abis.

	* bits/dirent.h (__INO_T_MATCHES_INO64_T): Define regardless whether
	__INO_T_MATCHES_INO64_T is defined.
	* sysdeps/unix/sysv/linux/bits/dirent.h: Likewise.
	* dirent/alphasort.c: Check _DIRENT_MATCHES_DIRENT64 value instead
	of definition.
	* dirent/alphasort64.c: Likewise.
	* dirent/scandir.c: Likewise.
	* dirent/scandir64-tail.c: Likewise.
	* dirent/scandir64.c: Likewise.
	* dirent/scandirat.c: Likewise.
	* dirent/scandirat64.c: Likewise.
	* dirent/versionsort.c: Likewise.
	* dirent/versionsort64.c: Likewise.
	* include/dirent.h: Likewise.
---
 ChangeLog                             | 15 +++++++++++++++
 bits/dirent.h                         |  2 ++
 dirent/alphasort.c                    |  2 +-
 dirent/alphasort64.c                  |  2 +-
 dirent/scandir.c                      |  2 +-
 dirent/scandir64-tail.c               |  2 +-
 dirent/scandir64.c                    |  2 +-
 dirent/scandirat.c                    |  2 +-
 dirent/scandirat64.c                  |  2 +-
 dirent/versionsort.c                  |  2 +-
 dirent/versionsort64.c                |  2 +-
 include/dirent.h                      |  2 +-
 sysdeps/unix/sysv/linux/bits/dirent.h |  2 ++
 13 files changed, 29 insertions(+), 10 deletions(-)

-- 
2.7.4

Comments

Andreas Schwab March 2, 2018, 7:29 p.m. UTC | #1
On Mär 02 2018, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> 	* bits/dirent.h (__INO_T_MATCHES_INO64_T): Define regardless whether

> 	__INO_T_MATCHES_INO64_T is defined.

> 	* sysdeps/unix/sysv/linux/bits/dirent.h: Likewise.

> 	* dirent/alphasort.c: Check _DIRENT_MATCHES_DIRENT64 value instead

> 	of definition.

> 	* dirent/alphasort64.c: Likewise.

> 	* dirent/scandir.c: Likewise.

> 	* dirent/scandir64-tail.c: Likewise.

> 	* dirent/scandir64.c: Likewise.

> 	* dirent/scandirat.c: Likewise.

> 	* dirent/scandirat64.c: Likewise.

> 	* dirent/versionsort.c: Likewise.

> 	* dirent/versionsort64.c: Likewise.

> 	* include/dirent.h: Likewise.


Ok.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
diff mbox series

Patch

diff --git a/bits/dirent.h b/bits/dirent.h
index 8c38b8c..d775540 100644
--- a/bits/dirent.h
+++ b/bits/dirent.h
@@ -56,4 +56,6 @@  struct dirent64
 #ifdef __INO_T_MATCHES_INO64_T
 /* Inform libc code that these two types are effectively identical.  */
 # define _DIRENT_MATCHES_DIRENT64	1
+#else
+# define _DIRENT_MATCHES_DIRENT64	0
 #endif
diff --git a/dirent/alphasort.c b/dirent/alphasort.c
index 8d3b939..a6cd151 100644
--- a/dirent/alphasort.c
+++ b/dirent/alphasort.c
@@ -32,6 +32,6 @@  alphasort (const struct dirent **a, const struct dirent **b)
   return strcoll ((*a)->d_name, (*b)->d_name);
 }
 
-#ifdef _DIRENT_MATCHES_DIRENT64
+#if _DIRENT_MATCHES_DIRENT64
 weak_alias (alphasort, alphasort64)
 #endif
diff --git a/dirent/alphasort64.c b/dirent/alphasort64.c
index deb1921..3a47a97 100644
--- a/dirent/alphasort64.c
+++ b/dirent/alphasort64.c
@@ -19,7 +19,7 @@ 
 #include <string.h>
 
 /* alphasort.c defines alphasort64 as an alias if _DIRENT_MATCHES_DIRENT64.  */
-#ifndef _DIRENT_MATCHES_DIRENT64
+#if !_DIRENT_MATCHES_DIRENT64
 
 int
 alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
diff --git a/dirent/scandir.c b/dirent/scandir.c
index 977d645..b24e157 100644
--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -40,6 +40,6 @@  SCANDIR (const char *dir,
   return SCANDIR_TAIL (__opendir (dir), namelist, select, cmp);
 }
 
-#ifdef _DIRENT_MATCHES_DIRENT64
+#if _DIRENT_MATCHES_DIRENT64
 weak_alias (scandir, scandir64)
 #endif
diff --git a/dirent/scandir64-tail.c b/dirent/scandir64-tail.c
index 684088c..8d5cc07 100644
--- a/dirent/scandir64-tail.c
+++ b/dirent/scandir64-tail.c
@@ -18,7 +18,7 @@ 
 
 #include <dirent.h>
 
-#ifndef _DIRENT_MATCHES_DIRENT64
+#if !_DIRENT_MATCHES_DIRENT64
 # define SCANDIR_TAIL   __scandir64_tail
 # define READDIR        __readdir64
 # define DIRENT_TYPE    struct dirent64
diff --git a/dirent/scandir64.c b/dirent/scandir64.c
index 7e666b0..0c63fa9 100644
--- a/dirent/scandir64.c
+++ b/dirent/scandir64.c
@@ -18,7 +18,7 @@ 
 #include <dirent.h>
 
 /* scandir.c defines scandir64 as an alias if _DIRENT_MATCHES_DIRENT64.  */
-#ifndef _DIRENT_MATCHES_DIRENT64
+#if !_DIRENT_MATCHES_DIRENT64
 
 # define SCANDIR        scandir64
 # define SCANDIR_TAIL   __scandir64_tail
diff --git a/dirent/scandirat.c b/dirent/scandirat.c
index 3f63f4d..96a1b0e 100644
--- a/dirent/scandirat.c
+++ b/dirent/scandirat.c
@@ -44,6 +44,6 @@  libc_hidden_def (SCANDIRAT)
 weak_alias (__scandirat, scandirat)
 #endif
 
-#ifdef _DIRENT_MATCHES_DIRENT64
+#if _DIRENT_MATCHES_DIRENT64
 weak_alias (scandirat, scandirat64)
 #endif
diff --git a/dirent/scandirat64.c b/dirent/scandirat64.c
index 6d682ff..520ae7c 100644
--- a/dirent/scandirat64.c
+++ b/dirent/scandirat64.c
@@ -18,7 +18,7 @@ 
 #include <dirent.h>
 
 /* scandirat.c defines scandirat64 as an alias if _DIRENT_MATCHES_DIRENT64.  */
-#ifndef _DIRENT_MATCHES_DIRENT64
+#if !_DIRENT_MATCHES_DIRENT64
 
 # define SCANDIRAT      scandirat64
 # define SCANDIR_TAIL   __scandir64_tail
diff --git a/dirent/versionsort.c b/dirent/versionsort.c
index 0130138..5ec15e8 100644
--- a/dirent/versionsort.c
+++ b/dirent/versionsort.c
@@ -32,6 +32,6 @@  versionsort (const struct dirent **a, const struct dirent **b)
   return __strverscmp ((*a)->d_name, (*b)->d_name);
 }
 
-#ifdef _DIRENT_MATCHES_DIRENT64
+#if _DIRENT_MATCHES_DIRENT64
 weak_alias (versionsort, versionsort64)
 #endif
diff --git a/dirent/versionsort64.c b/dirent/versionsort64.c
index bfb0cbb..7689c26 100644
--- a/dirent/versionsort64.c
+++ b/dirent/versionsort64.c
@@ -19,7 +19,7 @@ 
 #include <string.h>
 
 /* versionsort.c defines a versionsort64 alias if _DIRENT_MATCHES_DIRENT64.  */
-#ifndef _DIRENT_MATCHES_DIRENT64
+#if !_DIRENT_MATCHES_DIRENT64
 
 int
 versionsort64 (const struct dirent64 **a, const struct dirent64 **b)
diff --git a/include/dirent.h b/include/dirent.h
index caaeb0b..cc8f189 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -57,7 +57,7 @@  extern int __scandir_tail (DIR *dp,
 			   int (*cmp) (const struct dirent **,
 				       const struct dirent **))
   attribute_hidden;
-#  ifdef _DIRENT_MATCHES_DIRENT64
+#  if _DIRENT_MATCHES_DIRENT64
 #   define __scandir64_tail (dp, namelist, select, cmp)         \
   __scandir_tail (dp, (struct dirent ***) (namelist),           \
 		  (int (*) (const struct dirent *)) (select),   \
diff --git a/sysdeps/unix/sysv/linux/bits/dirent.h b/sysdeps/unix/sysv/linux/bits/dirent.h
index 2ed7919..f312720 100644
--- a/sysdeps/unix/sysv/linux/bits/dirent.h
+++ b/sysdeps/unix/sysv/linux/bits/dirent.h
@@ -54,4 +54,6 @@  struct dirent64
 #if defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T
 /* Inform libc code that these two types are effectively identical.  */
 # define _DIRENT_MATCHES_DIRENT64	1
+#else
+# define _DIRENT_MATCHES_DIRENT64	0
 #endif