bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 6/9] fchmodat, fchownat, fstatat: use extern-inline


From: Paul Eggert
Subject: [PATCH 6/9] fchmodat, fchownat, fstatat: use extern-inline
Date: Wed, 29 Aug 2012 23:25:01 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

* lib/fchmodat.c, lib/openat.h (FCHMODAT_INLINE):
* lib/fchownat.c, lib/openat.h (FCHOWNAT_INLINE):
* lib/fstatat.c, lib/openat.h (FSTATAT_INLINE):
New macros.
* lib/openat.h:
Replace all uses of 'static inline' with them.
Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
* modules/fchmodat, modules/fchownat, modules/fstatat:
* modules/openat-h:
(Depends-on):
Add extern-inline.
(configure.ac): Remove AC_C_INLINE.
---
 ChangeLog        | 14 ++++++++++++++
 lib/fchmodat.c   |  2 ++
 lib/fchownat.c   |  2 ++
 lib/fstatat.c    |  6 ++++--
 lib/openat.h     | 28 ++++++++++++++++++++++------
 modules/fchmodat |  2 +-
 modules/fchownat |  2 +-
 modules/fstatat  |  2 +-
 modules/openat-h |  1 +
 9 files changed, 48 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 779ab5c..5bddd57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2012-08-29  Paul Eggert  <address@hidden>
 
+       fchmodat, fchownat, fstatat: use extern-inline
+       * lib/fchmodat.c, lib/openat.h (FCHMODAT_INLINE):
+       * lib/fchownat.c, lib/openat.h (FCHOWNAT_INLINE):
+       * lib/fstatat.c, lib/openat.h (FSTATAT_INLINE):
+       New macros.
+       * lib/openat.h:
+       Replace all uses of 'static inline' with them.
+       Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+       * modules/fchmodat, modules/fchownat, modules/fstatat:
+       * modules/openat-h:
+       (Depends-on):
+       Add extern-inline.
+       (configure.ac): Remove AC_C_INLINE.
+
        acl, mbchar, priv-set: use extern-inline
        * lib/set-mode-acl.c, lib/acl-internal.h (ACL_INTERNAL_INLINE):
        * lib/mbchar.c, lib/mbchar.h (MBCHAR_INLINE):
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
index ce848fd..b1940d5 100644
--- a/lib/fchmodat.c
+++ b/lib/fchmodat.c
@@ -18,6 +18,8 @@
 
 #include <config.h>
 
+#include FCHMODAT_INLINE _GL_EXTERN_INLINE
+
 #include <sys/stat.h>
 
 #include <errno.h>
diff --git a/lib/fchownat.c b/lib/fchownat.c
index 4f6a44d..c6e2d56 100644
--- a/lib/fchownat.c
+++ b/lib/fchownat.c
@@ -23,6 +23,8 @@
 
 #include <config.h>
 
+#include FCHOWNAT_INLINE _GL_EXTERN_INLINE
+
 #include <unistd.h>
 
 #include <errno.h>
diff --git a/lib/fstatat.c b/lib/fstatat.c
index 9b701c4..ed42fa8 100644
--- a/lib/fstatat.c
+++ b/lib/fstatat.c
@@ -23,13 +23,15 @@
 #define __need_system_sys_stat_h
 #include <config.h>
 
+#include FSTATAT_INLINE _GL_EXTERN_INLINE
+
 /* Get the original definition of fstatat.  It might be defined as a macro.  */
 #include <sys/types.h>
 #include <sys/stat.h>
 #undef __need_system_sys_stat_h
 
 #if HAVE_FSTATAT
-static inline int
+static int
 orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
 {
   return fstatat (fd, filename, buf, flags);
@@ -97,7 +99,7 @@ rpl_fstatat (int fd, char const *file, struct stat *st, int 
flag)
    because the preprocessor sees a use of a macro that requires two
    arguments but is only given one.  Hence, we need an inline
    forwarder to get past the preprocessor.  */
-static inline int
+static int
 stat_func (char const *name, struct stat *st)
 {
   return stat (name, st);
diff --git a/lib/openat.h b/lib/openat.h
index d646250..0f542c6 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -26,6 +26,8 @@
 #include <unistd.h>
 #include <stdbool.h>
 
+_GL_INLINE_HEADER_BEGIN
+
 #if !HAVE_OPENAT
 
 int openat_permissive (int fd, char const *file, int flags, mode_t mode,
@@ -49,13 +51,17 @@ _Noreturn void openat_save_fail (int);
 
 #if GNULIB_FCHOWNAT
 
-static inline int
+# ifndef FCHOWNAT_INLINE
+#  define FCHOWNAT_INLINE _GL_INLINE
+# endif
+
+FCHOWNAT_INLINE int
 chownat (int fd, char const *file, uid_t owner, gid_t group)
 {
   return fchownat (fd, file, owner, group, 0);
 }
 
-static inline int
+FCHOWNAT_INLINE int
 lchownat (int fd, char const *file, uid_t owner, gid_t group)
 {
   return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
@@ -65,13 +71,17 @@ lchownat (int fd, char const *file, uid_t owner, gid_t 
group)
 
 #if GNULIB_FCHMODAT
 
-static inline int
+# ifndef FCHMODAT_INLINE
+#  define FCHMODAT_INLINE _GL_INLINE
+# endif
+
+FCHMODAT_INLINE int
 chmodat (int fd, char const *file, mode_t mode)
 {
   return fchmodat (fd, file, mode, 0);
 }
 
-static inline int
+FCHMODAT_INLINE int
 lchmodat (int fd, char const *file, mode_t mode)
 {
   return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
@@ -81,13 +91,17 @@ lchmodat (int fd, char const *file, mode_t mode)
 
 #if GNULIB_FSTATAT
 
-static inline int
+# ifndef FSTATAT_INLINE
+#  define FSTATAT_INLINE _GL_INLINE
+# endif
+
+FSTATAT_INLINE int
 statat (int fd, char const *name, struct stat *st)
 {
   return fstatat (fd, name, st, 0);
 }
 
-static inline int
+FSTATAT_INLINE int
 lstatat (int fd, char const *name, struct stat *st)
 {
   return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
@@ -101,4 +115,6 @@ lstatat (int fd, char const *name, struct stat *st)
    wrappers are not provided for accessat or euidaccessat, so as to
    avoid dragging in -lgen on some platforms.  */
 
+_GL_INLINE_HEADER_END
+
 #endif /* _GL_HEADER_OPENAT */
diff --git a/modules/fchmodat b/modules/fchmodat
index f81dd81..94fad77 100644
--- a/modules/fchmodat
+++ b/modules/fchmodat
@@ -13,6 +13,7 @@ extensions
 at-internal     [test $HAVE_FCHMODAT = 0]
 dosname         [test $HAVE_FCHMODAT = 0]
 errno           [test $HAVE_FCHMODAT = 0]
+extern-inline   [test $HAVE_FCHMODAT = 0]
 fchdir          [test $HAVE_FCHMODAT = 0]
 fcntl-h         [test $HAVE_FCHMODAT = 0]
 openat-die      [test $HAVE_FCHMODAT = 0]
@@ -24,7 +25,6 @@ gl_FUNC_FCHMODAT
 if test $HAVE_FCHMODAT = 0; then
   AC_LIBOBJ([fchmodat])
 fi
-AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
 gl_MODULE_INDICATOR([fchmodat]) dnl for lib/openat.h
 gl_SYS_STAT_MODULE_INDICATOR([fchmodat])
 
diff --git a/modules/fchownat b/modules/fchownat
index 886b6b3..7fba3ed 100644
--- a/modules/fchownat
+++ b/modules/fchownat
@@ -13,6 +13,7 @@ extensions
 at-internal     [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
 dosname         [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
 errno           [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
+extern-inline   [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
 fchdir          [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
 fcntl-h         [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
 lchown          [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
@@ -26,7 +27,6 @@ gl_FUNC_FCHOWNAT
 if test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1; then
   AC_LIBOBJ([fchownat])
 fi
-AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
 gl_MODULE_INDICATOR([fchownat]) dnl for lib/openat.h
 gl_UNISTD_MODULE_INDICATOR([fchownat])
 
diff --git a/modules/fstatat b/modules/fstatat
index fa78faf..69e9a7b 100644
--- a/modules/fstatat
+++ b/modules/fstatat
@@ -14,6 +14,7 @@ extensions
 at-internal     [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
 dosname         [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
 errno           [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
+extern-inline   [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
 fchdir          [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
 fcntl-h         [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
 lstat           [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]
@@ -26,7 +27,6 @@ gl_FUNC_FSTATAT
 if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
   AC_LIBOBJ([fstatat])
 fi
-AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
 gl_MODULE_INDICATOR([fstatat]) dnl for lib/openat.h
 gl_SYS_STAT_MODULE_INDICATOR([fstatat])
 
diff --git a/modules/openat-h b/modules/openat-h
index 2af3b88..6165dff 100644
--- a/modules/openat-h
+++ b/modules/openat-h
@@ -5,6 +5,7 @@ Files:
 lib/openat.h
 
 Depends-on:
+extern-inline
 fcntl-h
 stdbool
 sys_stat
-- 
1.7.11.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]