chdir-long, cycle-check, savewd: better 'inline'
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 Nov 2012 06:25:08 +0000 (22:25 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 Nov 2012 07:38:53 +0000 (23:38 -0800)
* lib/chdir-long.c (cdb_init, cdb_fchdir, cdb_free)
(find_non_slash):
* lib/cycle-check.c (is_zero_or_power_of_two):
* lib/savewd.c (savewd_delegating):
Change 'static inline' to 'inline'.
* lib/savewd.c, lib/savewd.h (SAVEWD_INLINE): New macro.
Replace all remaining uses of 'static inline' with it.
* lib/savewd.h:
Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
* m4/chdir-long.m4 (gl_PREREQ_CHDIR_LONG):
* m4/cycle-check.m4 (gl_CYCLE_CHECK):
* m4/savewd.m4 (gl_SAVEWD):
Do not require AC_C_INLINE.
* modules/savewd (Depends-on): Add extern-inline.

ChangeLog
lib/chdir-long.c
lib/cycle-check.c
lib/savewd.c
lib/savewd.h
m4/chdir-long.m4
m4/cycle-check.m4
m4/savewd.m4
modules/savewd

index 564fe95..d83bf00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2012-11-29  Paul Eggert  <eggert@cs.ucla.edu>
 
+       chdir-long, cycle-check, savewd: better 'inline'
+       * lib/chdir-long.c (cdb_init, cdb_fchdir, cdb_free)
+       (find_non_slash):
+       * lib/cycle-check.c (is_zero_or_power_of_two):
+       * lib/savewd.c (savewd_delegating):
+       Change 'static inline' to 'inline'.
+       * lib/savewd.c, lib/savewd.h (SAVEWD_INLINE): New macro.
+       Replace all remaining uses of 'static inline' with it.
+       * lib/savewd.h:
+       Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+       * m4/chdir-long.m4 (gl_PREREQ_CHDIR_LONG):
+       * m4/cycle-check.m4 (gl_CYCLE_CHECK):
+       * m4/savewd.m4 (gl_SAVEWD):
+       Do not require AC_C_INLINE.
+       * modules/savewd (Depends-on): Add extern-inline.
+
        base32, base64: no need for 'inline'
        * lib/base32.c (to_uchar, get_8, decode_8):
        * lib/base64.c (to_uchar, get_4, decode_4):
index 599d141..a597530 100644 (file)
@@ -42,19 +42,19 @@ struct cd_buf
   int fd;
 };
 
-static inline void
+static void
 cdb_init (struct cd_buf *cdb)
 {
   cdb->fd = AT_FDCWD;
 }
 
-static inline int
+static int
 cdb_fchdir (struct cd_buf const *cdb)
 {
   return fchdir (cdb->fd);
 }
 
-static inline void
+static void
 cdb_free (struct cd_buf const *cdb)
 {
   if (0 <= cdb->fd)
@@ -83,7 +83,7 @@ cdb_advance_fd (struct cd_buf *cdb, char const *dir)
 }
 
 /* Return a pointer to the first non-slash in S.  */
-static inline char * _GL_ATTRIBUTE_PURE
+static char * _GL_ATTRIBUTE_PURE
 find_non_slash (char const *s)
 {
   size_t n_slash = strspn (s, "/");
index 011cae9..2f0869d 100644 (file)
@@ -33,7 +33,7 @@
 
 /* Return true if I is a power of 2, or is zero.  */
 
-static inline bool
+static bool
 is_zero_or_power_of_two (uintmax_t i)
 {
   return (i & (i - 1)) == 0;
index c5aec36..1412765 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <config.h>
 
+#define SAVEWD_INLINE _GL_EXTERN_INLINE
+
 #include "savewd.h"
 
 #include <assert.h>
@@ -254,7 +256,7 @@ savewd_finish (struct savewd *wd)
    This is why savewd_chdir is broken out into another function;
    savewd_chdir's callers _can_ inspect the file system to decide
    whether to call savewd_chdir.  */
-static inline bool
+static bool
 savewd_delegating (struct savewd const *wd)
 {
   return wd->state == FORKING_STATE && 0 < wd->val.child;
index 06cc6c1..9291e2c 100644 (file)
 #include <stdbool.h>
 #include <sys/types.h>
 
+_GL_INLINE_HEADER_BEGIN
+#ifndef SAVEWD_INLINE
+# define SAVEWD_INLINE _GL_INLINE
+#endif
+
 /* A saved working directory.  The member names and constants defined
    by this structure are private to the savewd module.  */
 struct savewd
@@ -67,7 +72,7 @@ struct savewd
 };
 
 /* Initialize a saved working directory object.  */
-static inline void
+SAVEWD_INLINE void
 savewd_init (struct savewd *wd)
 {
   wd->state = INITIAL_STATE;
@@ -117,7 +122,7 @@ int savewd_chdir (struct savewd *wd, char const *dir, int options,
 int savewd_restore (struct savewd *wd, int status);
 
 /* Return WD's error number, or 0 if WD is not in an error state.  */
-static inline int
+SAVEWD_INLINE int
 savewd_errno (struct savewd const *wd)
 {
   return (wd->state == ERROR_STATE ? wd->val.errnum : 0);
@@ -145,4 +150,6 @@ int savewd_process_files (int n_files, char **file,
                           int (*act) (char *, struct savewd *, void *),
                           void *options);
 
+_GL_INLINE_HEADER_END
+
 #endif
index 6180891..fb6ace9 100644 (file)
@@ -1,4 +1,4 @@
-#serial 14
+#serial 15
 
 # Use Gnulib's robust chdir function.
 # It can handle arbitrarily long directory names, which means
@@ -27,8 +27,4 @@ have_arbitrary_file_name_length_limit
     gl_cv_have_arbitrary_file_name_length_limit=no)])
 ])
 
-AC_DEFUN([gl_PREREQ_CHDIR_LONG],
-[
-  AC_REQUIRE([AC_C_INLINE])
-  :
-])
+AC_DEFUN([gl_PREREQ_CHDIR_LONG], [:])
index 34c5bcb..daa6a25 100644 (file)
@@ -1,10 +1,7 @@
-#serial 6
+#serial 7
 dnl Copyright (C) 2005-2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-AC_DEFUN([gl_CYCLE_CHECK],
-[
-  AC_REQUIRE([AC_C_INLINE])
-])
+AC_DEFUN([gl_CYCLE_CHECK], [:])
index 5a38eaf..571e3d2 100644 (file)
@@ -5,5 +5,4 @@ dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-AC_DEFUN([gl_SAVEWD],
-  [AC_REQUIRE([AC_C_INLINE])])
+AC_DEFUN([gl_SAVEWD], [:])
index bb48c06..b7a9fee 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 chdir
 dosname
 errno
+extern-inline
 fchdir
 fcntl-safer
 fcntl-h