Mercurial > hg > octave-lyh > gnulib-hg
changeset 17181:a80e4b259d9b
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 20 Nov 2012 22:25:08 -0800 |
parents | e0def4d44688 |
children | 10268a7a6854 |
files | 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 |
diffstat | 9 files changed, 39 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- a/lib/chdir-long.c +++ b/lib/chdir-long.c @@ -42,19 +42,19 @@ 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 @@ } /* 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, "/");
--- a/lib/cycle-check.c +++ b/lib/cycle-check.c @@ -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;
--- a/lib/savewd.c +++ b/lib/savewd.c @@ -19,6 +19,8 @@ #include <config.h> +#define SAVEWD_INLINE _GL_EXTERN_INLINE + #include "savewd.h" #include <assert.h> @@ -254,7 +256,7 @@ 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;
--- a/lib/savewd.h +++ b/lib/savewd.h @@ -23,6 +23,11 @@ #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 @@ }; /* 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_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 (*act) (char *, struct savewd *, void *), void *options); +_GL_INLINE_HEADER_END + #endif
--- a/m4/chdir-long.m4 +++ b/m4/chdir-long.m4 @@ -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 @@ 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], [:])
--- a/m4/cycle-check.m4 +++ b/m4/cycle-check.m4 @@ -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], [:])