浏览代码

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.
Paul Eggert 4 年之前
父节点
当前提交
7fb1b6877f
共有 8 个文件被更改,包括 24 次插入35 次删除
  1. 0 1
      configure.ac
  2. 15 15
      lib/attr-xattr.in.h
  3. 5 5
      lib/wordsplit.c
  4. 0 9
      lib/wordsplit.h
  5. 1 2
      src/common.h
  6. 1 1
      src/delete.c
  7. 1 1
      src/extract.c
  8. 1 1
      src/misc.c

+ 0 - 1
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 \

+ 15 - 15
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

+ 5 - 5
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;
 

+ 0 - 9
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);

+ 1 - 2
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);

+ 1 - 1
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;

+ 1 - 1
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

+ 1 - 1
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;