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):
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)
}
/* 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, "/");
/* 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;
#include <config.h>
+#define SAVEWD_INLINE _GL_EXTERN_INLINE
+
#include "savewd.h"
#include <assert.h>
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;
#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
};
/* Initialize a saved working directory object. */
-static inline void
+SAVEWD_INLINE void
savewd_init (struct savewd *wd)
{
wd->state = INITIAL_STATE;
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);
int (*act) (char *, struct savewd *, void *),
void *options);
+_GL_INLINE_HEADER_END
+
#endif
-#serial 14
+#serial 15
# Use Gnulib's robust chdir function.
# It can handle arbitrarily long directory names, which means
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], [:])
-#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], [:])
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], [:])
chdir
dosname
errno
+extern-inline
fchdir
fcntl-safer
fcntl-h