summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-02-28 13:34:55 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-03-01 00:18:44 -0800
commit7fb1b6877f42f21432aea9a29977046f6289bc50 (patch)
treeb2e59cbc0ccc6d1608b0fedd6799b0569c231386
parentf4e2411bf53027c53f440b836143e64eb171a3ad (diff)
downloadtar-7fb1b6877f42f21432aea9a29977046f6289bc50.tar.gz
Omit most uses of ‘inline’
With today’s compilers ‘inline’ is typically not needed for performance (at least the way GNU Tar uses it) and it gets in the way of portability. * configure.ac: Omit AC_C_INLINE; no longer needed here. * lib/attr-xattr.in.h (setxattr, lsetxattr, fsetxattr, getxattr) (lgetxattr, fgetxattr, listxattr, llistxattr, flistxattr): * lib/wordsplit.c (skip_delim_internal, skip_delim) (skip_delim_real, exptab_matches): * src/delete.c (flush_file): * src/extract.c (safe_dir_mode): * src/misc.c (ptr_align): Now just static, not static inline. * lib/wordsplit.h (wordsplit_getwords): Remove; no longer used. * src/common.h (name_more_files): Now COMMON_INLINE, not extern inline - which is not portable according to C99, the way we were using it.
-rw-r--r--configure.ac1
-rw-r--r--lib/attr-xattr.in.h30
-rw-r--r--lib/wordsplit.c10
-rw-r--r--lib/wordsplit.h9
-rw-r--r--src/common.h3
-rw-r--r--src/delete.c2
-rw-r--r--src/extract.c2
-rw-r--r--src/misc.c2
8 files changed, 24 insertions, 35 deletions
diff --git a/configure.ac b/configure.ac
index 75594ecf..87f69087 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,7 +35,6 @@ gl_EARLY
AC_CHECK_TOOLS([AR], [ar])
AC_SYS_LARGEFILE
-AC_C_INLINE
AC_CHECK_HEADERS_ONCE(fcntl.h linux/fd.h memory.h net/errno.h \
sgtty.h string.h \
diff --git a/lib/attr-xattr.in.h b/lib/attr-xattr.in.h
index d1f48b6e..4fc27f8f 100644
--- a/lib/attr-xattr.in.h
+++ b/lib/attr-xattr.in.h
@@ -22,39 +22,39 @@
#endif
/* setting */
-static inline int setxattr (const char *path, const char *name, const void
- *value, size_t size, int flags)
+static int setxattr (const char *path, const char *name, const void
+ *value, size_t size, int flags)
{ errno = ENOTSUP; return -1; }
-static inline int lsetxattr (const char *path, const char *name, const void
- *value, size_t size, int flags)
+static int lsetxattr (const char *path, const char *name, const void
+ *value, size_t size, int flags)
{ errno = ENOTSUP; return -1; }
-static inline int fsetxattr (int filedes, const char *name, const void *value,
- size_t size, int flags)
+static int fsetxattr (int filedes, const char *name, const void *value,
+ size_t size, int flags)
{ errno = ENOTSUP; return -1; }
/* getting */
-static inline ssize_t getxattr (const char *path, const char *name, void *value,
- size_t size)
+static ssize_t getxattr (const char *path, const char *name, void *value,
+ size_t size)
{ errno = ENOTSUP; return -1; }
-static inline ssize_t lgetxattr (const char *path, const char *name, void
- *value, size_t size)
+static ssize_t lgetxattr (const char *path, const char *name, void
+ *value, size_t size)
{ errno = ENOTSUP; return -1; }
-static inline ssize_t fgetxattr (int filedes, const char *name, void *value,
- size_t size)
+static ssize_t fgetxattr (int filedes, const char *name, void *value,
+ size_t size)
{ errno = ENOTSUP; return -1; }
/* listing */
-static inline ssize_t listxattr (const char *path, char *list, size_t size)
+static ssize_t listxattr (const char *path, char *list, size_t size)
{ errno = ENOTSUP; return -1; }
-static inline ssize_t llistxattr (const char *path, char *list, size_t size)
+static ssize_t llistxattr (const char *path, char *list, size_t size)
{ errno = ENOTSUP; return -1; }
-static inline ssize_t flistxattr (int filedes, char *list, size_t size)
+static ssize_t flistxattr (int filedes, char *list, size_t size)
{ errno = ENOTSUP; return -1; }
#endif
diff --git a/lib/wordsplit.c b/lib/wordsplit.c
index d8ce1247..cf8a4990 100644
--- a/lib/wordsplit.c
+++ b/lib/wordsplit.c
@@ -1911,19 +1911,19 @@ skip_sed_expr (const char *command, size_t i, size_t len)
/* wsp->ws_endp points to a delimiter character. If RETURN_DELIMS
is true, return its value, otherwise return the index past it. */
-static inline size_t
+static size_t
skip_delim_internal (struct wordsplit *wsp, int return_delims)
{
return return_delims ? wsp->ws_endp : wsp->ws_endp + 1;
}
-static inline size_t
+static size_t
skip_delim (struct wordsplit *wsp)
{
return skip_delim_internal (wsp, WSP_RETURN_DELIMS (wsp));
}
-static inline size_t
+static size_t
skip_delim_real (struct wordsplit *wsp)
{
return skip_delim_internal (wsp, wsp->ws_flags & WRDSF_RETURN_DELIMS);
@@ -2316,8 +2316,8 @@ static struct exptab exptab[] = {
{ NULL }
};
-static inline int
-exptab_matches(struct exptab *p, struct wordsplit *wsp)
+static int
+exptab_matches (struct exptab *p, struct wordsplit *wsp)
{
int result;
diff --git a/lib/wordsplit.h b/lib/wordsplit.h
index bca3b6dc..ac95c9b7 100644
--- a/lib/wordsplit.h
+++ b/lib/wordsplit.h
@@ -248,15 +248,6 @@ void wordsplit_free_words (wordsplit_t *ws);
void wordsplit_free_envbuf (wordsplit_t *ws);
int wordsplit_get_words (wordsplit_t *ws, size_t *wordc, char ***wordv);
-static inline void wordsplit_getwords (wordsplit_t *ws, size_t *wordc, char ***wordv)
- DEPRECATED;
-
-static inline void
-wordsplit_getwords (wordsplit_t *ws, size_t *wordc, char ***wordv)
-{
- wordsplit_get_words (ws, wordc, wordv);
-}
-
int wordsplit_append (wordsplit_t *wsp, int argc, char **argv);
int wordsplit_c_unquote_char (int c);
diff --git a/src/common.h b/src/common.h
index 4b0ba2b2..40ccdd12 100644
--- a/src/common.h
+++ b/src/common.h
@@ -748,7 +748,7 @@ enum files_count
extern enum files_count filename_args;
/* Return true if there are file names in the list */
-static inline bool
+COMMON_INLINE bool
name_more_files (void)
{
return filename_args != FILES_NONE;
@@ -762,7 +762,6 @@ void uid_to_uname (uid_t uid, char **uname);
int uname_to_uid (char const *uname, uid_t *puid);
void name_init (void);
-bool name_more_files (void);
void name_add_name (const char *name);
void name_term (void);
const char *name_next (int change_dirs);
diff --git a/src/delete.c b/src/delete.c
index f52970ae..c4a8da16 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -147,7 +147,7 @@ write_recent_bytes (char *data, size_t bytes)
write_record (1);
}
-static inline void
+static void
flush_file (void)
{
off_t blocks_to_skip;
diff --git a/src/extract.c b/src/extract.c
index 85a6f1b2..060692b3 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -994,7 +994,7 @@ is_directory_link (const char *file_name)
If not root, though, make the directory writeable and searchable at first,
so that files can be created under it.
*/
-static inline int
+static int
safe_dir_mode (struct stat const *st)
{
return ((st->st_mode
diff --git a/src/misc.c b/src/misc.c
index 3e6ce78f..f14d938c 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1214,7 +1214,7 @@ xpipe (int fd[2])
PTR) through ((char *) PTR + ALIGNMENT - 1) to be addressable
locations. */
-static inline void *
+static void *
ptr_align (void *ptr, size_t alignment)
{
char *p0 = ptr;