Mercurial > hg > octave-nkf > gnulib-hg
changeset 17099:66fafd5c6640
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Wed, 29 Aug 2012 21:09:50 -0700 |
parents | 16d02df1b46e |
children | 1783fdc5730c |
files | ChangeLog lib/fchmodat.c lib/fchownat.c lib/fstatat.c lib/openat.h modules/fchmodat modules/fchownat modules/fstatat modules/openat-h |
diffstat | 9 files changed, 48 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2012-09-22 Paul Eggert <eggert@cs.ucla.edu> + 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):
--- 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>
--- 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>
--- 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 @@ 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);
--- 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 @@ #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 @@ #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 @@ #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 @@ 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 */
--- a/modules/fchmodat +++ b/modules/fchmodat @@ -13,6 +13,7 @@ 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 @@ 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])
--- a/modules/fchownat +++ b/modules/fchownat @@ -13,6 +13,7 @@ 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 @@ 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])
--- a/modules/fstatat +++ b/modules/fstatat @@ -14,6 +14,7 @@ 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 @@ 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])