]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Fewer macros in common.h
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 19 Aug 2024 16:12:52 +0000 (09:12 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 19 Aug 2024 16:57:13 +0000 (09:57 -0700)
In common.h, replace macros with constants or functions when that
is easy.  This makes code a bit more reliable (functions evaluate
their args exactly once) and easier to debug (many debugging
environments cannot access macros).
* src/common.h (CHKBLANKS): Remove.  All uses removed.
(NAME_FIELD_SIZE, PREFIX_FIELD_SIZE, UNAME_FIELD_SIZE)
(GNAME_FIELD_SIZE, TAREXIT_SUCCESS, TAREXIT_DIFFERS)
(TAREXIT_FAILURE, LG_8, LG_256, DEFAULT_CHECKPOINT)
(MAX_OLD_FILES, TF_READ, TF_WRITE, TF_DELETED, XFORM_REGFILE)
(XFORM_LINK, XFORM_SYMLINK, XFORM_ALL, WARN_ALONE_ZERO_BLOCK)
(WARN_BAD_DUMPDIR, WARN_CACHEDIR, WARN_CONTIGUOUS_CAST)
(WARN_FILE_CHANGED, WARN_FILE_IGNORED, WARN_FILE_REMOVED)
(WARN_FILE_SHRANK, WARN_FILE_UNCHANGED, WARN_FILENAME_WITH_NULS)
(WARN_IGNORE_ARCHIVE, WARN_IGNORE_NEWER, WARN_NEW_DIRECTORY)
(WARN_RENAME_DIRECTORY, WARN_SYMLINK_CAST, WARN_TIMESTAMP)
(WARN_UNKNOWN_CAST, WARN_UNKNOWN_KEYWORD, WARN_XDEV)
(WARN_DECOMPRESS_PROGRAM, WARN_EXISTING_FILE, WARN_XATTR_WRITE)
(WARN_RECORD_SIZE, WARN_FAILED_READ, WARN_MISSING_ZERO_BLOCKS)
(WARN_VERBOSE_WARNINGS, WARN_ALL, EXCL_DEFAULT, EXCL_RECURSIVE)
(EXCL_NON_RECURSIVE): Now enum constants rather than macros.
(time_option_initialized, isfound, wasfound, warning_enabled):
Now functions rather than macros TIME_OPTION_INITIALIZED, ISFOUND,
WASFOUND, WARNING_ENABLED.  All uses changed.
(OLDER_STAT_TIME, OLDER_TAR_STAT_TIME, EXTRACT_OVER_PIPE)
(TAR_ARGS_INITIALIZER): Remove.  All uses replaced with their
definiens or equivalent.

src/common.h
src/create.c
src/delete.c
src/extract.c
src/incremen.c
src/list.c
src/misc.c
src/names.c
src/tar.c
src/warning.c

index af440a527037df91c173cc516b015ef1c6d0bc02..07ac5fc78fdcdd76e1319b6e615ba7703d887f35 100644 (file)
 /* Declare the GNU tar archive format.  */
 #include "tar.h"
 
-/* The checksum field is filled with this while the checksum is computed.  */
-#define CHKBLANKS      "        "      /* 8 blanks, no null */
-
 /* Some constants from POSIX are given names.  */
-#define NAME_FIELD_SIZE   100
-#define PREFIX_FIELD_SIZE 155
-#define UNAME_FIELD_SIZE   32
-#define GNAME_FIELD_SIZE   32
-
+enum
+  {
+    NAME_FIELD_SIZE = 100,
+    PREFIX_FIELD_SIZE = 155,
+    UNAME_FIELD_SIZE = 32,
+    GNAME_FIELD_SIZE = 32
+  };
 
 \f
 /* Some various global definitions.  */
 
-#define TAREXIT_SUCCESS PAXEXIT_SUCCESS
-#define TAREXIT_DIFFERS PAXEXIT_DIFFERS
-#define TAREXIT_FAILURE PAXEXIT_FAILURE
+enum
+  {
+    TAREXIT_SUCCESS = PAXEXIT_SUCCESS,
+    TAREXIT_DIFFERS = PAXEXIT_DIFFERS,
+    TAREXIT_FAILURE = PAXEXIT_FAILURE
+  };
 
 \f
 #include "arith.h"
@@ -63,8 +65,7 @@
 #include <xvasprintf.h>
 
 /* Log base 2 of common values.  */
-#define LG_8 3
-#define LG_256 8
+enum { LG_8 = 3, LG_256 = 8 };
 
 _GL_INLINE_HEADER_BEGIN
 #ifndef COMMON_INLINE
@@ -130,7 +131,7 @@ extern enum backup_type backup_type;
 extern bool block_number_option;
 
 extern intmax_t checkpoint_option;
-#define DEFAULT_CHECKPOINT 10
+enum { DEFAULT_CHECKPOINT = 10 };
 
 /* Specified name of compression program, or "gzip" as implied by -z.  */
 extern const char *use_compress_program_option;
@@ -183,7 +184,7 @@ enum old_files
   SKIP_OLD_FILES,             /* --skip-old-files */
   KEEP_NEWER_FILES           /* --keep-newer-files */
 };
-#define MAX_OLD_FILES (KEEP_NEWER_FILES+1)
+enum { MAX_OLD_FILES = KEEP_NEWER_FILES + 1 };
 extern enum old_files old_files_option;
 
 extern bool keep_directory_symlink_option;
@@ -228,16 +229,11 @@ extern char *set_mtime_command;
 extern char *set_mtime_format;
 
 /* Return true if mtime_option or newer_mtime_option is initialized.  */
-#define TIME_OPTION_INITIALIZED(opt) (0 <= (opt).tv_nsec)
-
-/* Return true if the struct stat ST's M time is less than
-   newer_mtime_option.  */
-#define OLDER_STAT_TIME(st, m) \
-  (timespec_cmp (get_stat_##m##time (&(st)), newer_mtime_option) < 0)
-
-/* Likewise, for struct tar_stat_info ST.  */
-#define OLDER_TAR_STAT_TIME(st, m) \
-  (timespec_cmp ((st).m##time, newer_mtime_option) < 0)
+COMMON_INLINE bool
+time_option_initialized (struct timespec opt)
+{
+  return 0 <= opt.tv_nsec;
+}
 
 /* Zero if there is no recursion, otherwise FNM_LEADING_DIR.  */
 extern int recursion_option;
@@ -320,9 +316,6 @@ extern bool ignore_command_error_option;
 /* Restrict some potentially harmful tar options */
 extern bool restrict_option;
 
-/* Return true if the extracted files are not being written to disk */
-#define EXTRACT_OVER_PIPE (to_stdout_option || to_command_option)
-
 /* Count how many times the option has been set, multiple setting yields
    more verbose behavior.  Value 0 means no verbosity, 1 means file name
    only, 2 means file name and all attributes.  More than 2 is just like 2.  */
@@ -473,9 +466,7 @@ void archive_read_error (void);
 off_t seek_archive (off_t size);
 void set_start_time (void);
 
-#define TF_READ    0
-#define TF_WRITE   1
-#define TF_DELETED 2
+enum { TF_READ, TF_WRITE, TF_DELETED };
 int format_total_stats (FILE *fp, char const *const *formats, int eor, int eol);
 void print_total_stats (void);
 
@@ -813,12 +804,21 @@ bool is_avoided_name (char const *name);
 
 bool contains_dot_dot (char const *name);
 
-#define ISFOUND(c) (occurrence_option == 0                     \
-                   ? (c)->found_count != 0                     \
-                   : (c)->found_count == occurrence_option)
-#define WASFOUND(c) (occurrence_option == 0                    \
-                    ? (c)->found_count != 0                    \
-                    : (c)->found_count >= occurrence_option)
+COMMON_INLINE bool
+isfound (struct name const *c)
+{
+  return (occurrence_option == 0
+         ? (c)->found_count != 0
+         : (c)->found_count == occurrence_option);
+}
+
+COMMON_INLINE bool
+wasfound (struct name const *c)
+{
+  return (occurrence_option == 0
+         ? (c)->found_count != 0
+         : occurrence_option <= (c)->found_count);
+}
 
 /* Module tar.c.  */
 
@@ -872,9 +872,6 @@ struct tar_args        /* Variables used during option parsing */
   char const *version_control_string; /* --backup option argument */
 };
 
-#define TAR_ARGS_INITIALIZER(loc)              \
-  { loc, NULL, false, false, false, NULL, NULL }
-
 void more_options (int argc, char **argv, struct option_locus *loc);
 
 /* Module update.c.  */
@@ -965,10 +962,13 @@ bool string_ascii_p (const char *str);
 bool utf8_convert (bool to_utf, char const *input, char **output);
 
 /* Module transform.c */
-#define XFORM_REGFILE  0x01
-#define XFORM_LINK     0x02
-#define XFORM_SYMLINK  0x04
-#define XFORM_ALL      (XFORM_REGFILE|XFORM_LINK|XFORM_SYMLINK)
+enum
+  {
+    XFORM_REGFILE      = 1 << 0,
+    XFORM_LINK         = 1 << 1,
+    XFORM_SYMLINK      = 1 << 2,
+    XFORM_ALL = XFORM_REGFILE | XFORM_LINK | XFORM_SYMLINK
+  };
 
 void set_transform_expr (const char *expr);
 bool transform_name (char **pinput, int type);
@@ -989,43 +989,52 @@ void checkpoint_finish (void);
 void checkpoint_flush_actions (void);
 
 /* Module warning.c */
-#define WARN_ALONE_ZERO_BLOCK    0x00000001
-#define WARN_BAD_DUMPDIR         0x00000002
-#define WARN_CACHEDIR            0x00000004
-#define WARN_CONTIGUOUS_CAST     0x00000008
-#define WARN_FILE_CHANGED        0x00000010
-#define WARN_FILE_IGNORED        0x00000020
-#define WARN_FILE_REMOVED        0x00000040
-#define WARN_FILE_SHRANK         0x00000080
-#define WARN_FILE_UNCHANGED      0x00000100
-#define WARN_FILENAME_WITH_NULS  0x00000200
-#define WARN_IGNORE_ARCHIVE      0x00000400
-#define WARN_IGNORE_NEWER        0x00000800
-#define WARN_NEW_DIRECTORY       0x00001000
-#define WARN_RENAME_DIRECTORY    0x00002000
-#define WARN_SYMLINK_CAST        0x00004000
-#define WARN_TIMESTAMP           0x00008000
-#define WARN_UNKNOWN_CAST        0x00010000
-#define WARN_UNKNOWN_KEYWORD     0x00020000
-#define WARN_XDEV                0x00040000
-#define WARN_DECOMPRESS_PROGRAM  0x00080000
-#define WARN_EXISTING_FILE       0x00100000
-#define WARN_XATTR_WRITE         0x00200000
-#define WARN_RECORD_SIZE         0x00400000
-#define WARN_FAILED_READ         0x00800000
-#define WARN_MISSING_ZERO_BLOCKS 0x01000000
-
+enum
+  {
+    WARN_ALONE_ZERO_BLOCK      = 1 <<  0,
+    WARN_BAD_DUMPDIR           = 1 <<  1,
+    WARN_CACHEDIR              = 1 <<  2,
+    WARN_CONTIGUOUS_CAST       = 1 <<  3,
+    WARN_FILE_CHANGED          = 1 <<  4,
+    WARN_FILE_IGNORED          = 1 <<  5,
+    WARN_FILE_REMOVED          = 1 <<  6,
+    WARN_FILE_SHRANK           = 1 <<  7,
+    WARN_FILE_UNCHANGED                = 1 <<  8,
+    WARN_FILENAME_WITH_NULS    = 1 <<  9,
+    WARN_IGNORE_ARCHIVE                = 1 << 10,
+    WARN_IGNORE_NEWER          = 1 << 11,
+    WARN_NEW_DIRECTORY         = 1 << 12,
+    WARN_RENAME_DIRECTORY      = 1 << 13,
+    WARN_SYMLINK_CAST          = 1 << 14,
+    WARN_TIMESTAMP             = 1 << 15,
+    WARN_UNKNOWN_CAST          = 1 << 16,
+    WARN_UNKNOWN_KEYWORD       = 1 << 17,
+    WARN_XDEV                  = 1 << 18,
+    WARN_DECOMPRESS_PROGRAM    = 1 << 19,
+    WARN_EXISTING_FILE         = 1 << 20,
+    WARN_XATTR_WRITE           = 1 << 21,
+    WARN_RECORD_SIZE           = 1 << 22,
+    WARN_FAILED_READ           = 1 << 23,
+    WARN_MISSING_ZERO_BLOCKS   = 1 << 24
+  };
 /* These warnings are enabled by default in verbose mode: */
-#define WARN_VERBOSE_WARNINGS    (WARN_RENAME_DIRECTORY|WARN_NEW_DIRECTORY|\
-                                 WARN_DECOMPRESS_PROGRAM|WARN_EXISTING_FILE|\
-                                 WARN_RECORD_SIZE)
-#define WARN_ALL                 0xffffffff
+enum
+  {
+    WARN_VERBOSE_WARNINGS = (WARN_RENAME_DIRECTORY | WARN_NEW_DIRECTORY
+                            | WARN_DECOMPRESS_PROGRAM | WARN_EXISTING_FILE
+                            | WARN_RECORD_SIZE),
+    WARN_ALL = ~0
+  };
 
 void set_warning_option (const char *arg);
 
 extern int warning_option;
 
-#define WARNING_ENABLED(opt) (warning_option & (opt))
+COMMON_INLINE bool
+warning_enabled (int opt)
+{
+  return warning_option & opt;
+}
 
 extern void warnopt (int, int, char const *, ...)
   ATTRIBUTE_COLD ATTRIBUTE_FORMAT ((printf, 3, 4));
@@ -1039,9 +1048,7 @@ void finish_deferred_unlinks (void);
 extern void (*fatal_exit_hook) (void);
 
 /* Module exclist.c */
-#define EXCL_DEFAULT       0x00
-#define EXCL_RECURSIVE     0x01
-#define EXCL_NON_RECURSIVE 0x02
+enum { EXCL_DEFAULT, EXCL_RECURSIVE, EXCL_NON_RECURSIVE };
 
 void excfile_add (const char *name, int flags);
 void info_attach_exclist (struct tar_stat_info *dir);
index b6e555e35cddd1f78d9d313f5ea7f0c80f537190..33dfabab65c2bbf14366a6973dbdcfd2c240320b 100644 (file)
@@ -960,7 +960,8 @@ simple_finish_header (union block *header)
   int sum;
   char *p;
 
-  memcpy (header->header.chksum, CHKBLANKS, sizeof header->header.chksum);
+  /* Fill checksum field with spaces while the checksum is computed.  */
+  memset (header->header.chksum, ' ', sizeof header->header.chksum);
 
   sum = 0;
   p = header->buffer;
@@ -1687,8 +1688,9 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
 
   if (! (incremental_option && ! top_level)
       && !S_ISDIR (st->stat.st_mode)
-      && OLDER_TAR_STAT_TIME (*st, m)
-      && (!after_date_option || OLDER_TAR_STAT_TIME (*st, c)))
+      && timespec_cmp (st->mtime, newer_mtime_option) < 0
+      && (!after_date_option
+         || timespec_cmp (st->ctime, newer_mtime_option) < 0))
     {
       if (!incremental_option && verbose_option)
        warnopt (WARN_FILE_UNCHANGED, 0, _("%s: file is unchanged; not dumped"),
index ecf8bbae2a680d2509092f107475fc9a92432b70..2896bdef06039442bb8ba93d479bd3835697f4c4 100644 (file)
@@ -179,7 +179,7 @@ delete_archive_members (void)
              break;
            }
          name->found_count++;
-         if (!ISFOUND (name))
+         if (!isfound (name))
            {
              skim_member (acting_as_filter);
              break;
@@ -271,7 +271,7 @@ delete_archive_members (void)
              if ((name = name_scan (current_stat_info.file_name, false)) != NULL)
                {
                  name->found_count++;
-                 if (ISFOUND (name))
+                 if (isfound (name))
                    {
                      flush_file ();
                      break;
index 77dbd5c939257a3d70dc45b1f4945f146e963df6..40443b8b36267cda11b8f7ffbb79098834edb21d 100644 (file)
@@ -1768,7 +1768,7 @@ prepare_to_extract (char const *file_name, int typeflag, tar_extractor_t *fun)
       extractor = extract_file;
     }
 
-  if (EXTRACT_OVER_PIPE)
+  if (to_stdout_option || to_command_option)
     {
       if (extractor != extract_file)
        return false;
index 115bab3dadaefd50175bd290574d5c7fe9538ad7..9ef64ec0c4a5c1ea114f875d00118f41836fca1b 100644 (file)
@@ -553,9 +553,12 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
                   quotearg_colon (name_buffer));
          directory->children =
            (listed_incremental_option
-            || (OLDER_STAT_TIME (*stat_data, m)
-                || (after_date_option
-                    && OLDER_STAT_TIME (*stat_data, c))))
+            || (timespec_cmp (get_stat_mtime (stat_data), newer_mtime_option)
+                < 0)
+            || (after_date_option
+                && (timespec_cmp (get_stat_ctime (stat_data),
+                                  newer_mtime_option)
+                    < 0)))
            ? ALL_CHILDREN
            : CHANGED_CHILDREN;
        }
@@ -820,9 +823,13 @@ scan_directory (struct tar_stat_info *st)
                  else if (*entry == 'Y')
                    /* New entry, skip further checks */;
                  /* FIXME: if (S_ISHIDDEN (stat_data.st_mode))?? */
-                 else if (OLDER_STAT_TIME (stsub.stat, m)
+                 else if ((timespec_cmp (get_stat_mtime (&stsub.stat),
+                                         newer_mtime_option)
+                           < 0)
                           && (!after_date_option
-                              || OLDER_STAT_TIME (stsub.stat, c)))
+                              || (timespec_cmp (get_stat_ctime (&stsub.stat),
+                                                newer_mtime_option)
+                                  < 0)))
                    *entry = 'N';
                  else
                    *entry = 'Y';
index beca8ee8a038ab92ee0ec4d928353013b9c4a78a..64a5fe43b1abea362ac86a977be5bab8d9725bfd 100644 (file)
@@ -195,7 +195,7 @@ read_and (void (*do_something) (void))
          decode_header (current_header, &current_stat_info,
                         &current_format, 1);
          if (! name_match (current_stat_info.file_name)
-             || (TIME_OPTION_INITIALIZED (newer_mtime_option)
+             || (time_option_initialized (newer_mtime_option)
                  /* FIXME: We get mtime now, and again later; this causes
                     duplicate diagnostics if header.mtime is bogus.  */
                  && ((mtime.tv_sec
@@ -204,7 +204,7 @@ read_and (void (*do_something) (void))
                         extended header.  */
                      mtime.tv_nsec = 0,
                      current_stat_info.mtime = mtime,
-                     OLDER_TAR_STAT_TIME (current_stat_info, m)))
+                     timespec_cmp (mtime, newer_mtime_option) < 0))
              || excluded_name (current_stat_info.file_name,
                                current_stat_info.parent))
            {
index 03da6f442422d20ea76cb2d38398fce6337568f1..b23ed35129c3cc9fb24264d9a78980f34dd39e58 100644 (file)
@@ -1116,7 +1116,7 @@ close_diag (char const *name)
 {
   if (ignore_failed_read_option)
     {
-      if (WARNING_ENABLED (WARN_FAILED_READ))
+      if (warning_enabled (WARN_FAILED_READ))
        close_warn (name);
     }
   else
@@ -1128,7 +1128,7 @@ open_diag (char const *name)
 {
   if (ignore_failed_read_option)
     {
-      if (WARNING_ENABLED (WARN_FAILED_READ))
+      if (warning_enabled (WARN_FAILED_READ))
        open_warn (name);
     }
   else
@@ -1140,7 +1140,7 @@ read_diag_details (char const *name, off_t offset, size_t size)
 {
   if (ignore_failed_read_option)
     {
-      if (WARNING_ENABLED (WARN_FAILED_READ))
+      if (warning_enabled (WARN_FAILED_READ))
        read_warn_details (name, offset, size);
     }
   else
@@ -1152,7 +1152,7 @@ readlink_diag (char const *name)
 {
   if (ignore_failed_read_option)
     {
-      if (WARNING_ENABLED (WARN_FAILED_READ))
+      if (warning_enabled (WARN_FAILED_READ))
        readlink_warn (name);
     }
   else
@@ -1164,7 +1164,7 @@ savedir_diag (char const *name)
 {
   if (ignore_failed_read_option)
     {
-      if (WARNING_ENABLED (WARN_FAILED_READ))
+      if (warning_enabled (WARN_FAILED_READ))
        savedir_warn (name);
     }
   else
@@ -1176,7 +1176,7 @@ seek_diag_details (char const *name, off_t offset)
 {
   if (ignore_failed_read_option)
     {
-      if (WARNING_ENABLED (WARN_FAILED_READ))
+      if (warning_enabled (WARN_FAILED_READ))
        seek_warn_details (name, offset);
     }
   else
@@ -1188,7 +1188,7 @@ stat_diag (char const *name)
 {
   if (ignore_failed_read_option)
     {
-      if (WARNING_ENABLED (WARN_FAILED_READ))
+      if (warning_enabled (WARN_FAILED_READ))
        stat_warn (name);
     }
   else
index c161f9092d8b5a3f5d17b052e8cd1ac62c7ae1fc..d4377646f6a1300eb1c5d63eb3123a95ef02ec33 100644 (file)
@@ -1352,7 +1352,7 @@ name_match (const char *file_name)
            cursor->found_count++; /* remember it matched */
          chdir_do (cursor->change_dir);
          /* We got a match.  */
-         return ISFOUND (cursor);
+         return isfound (cursor);
        }
 
       /* Filename from archive not found in namelist.  If we have the whole
@@ -1391,7 +1391,7 @@ all_names_found (struct tar_stat_info *p)
   len = strlen (p->file_name);
   for (cursor = namelist; cursor; cursor = cursor->next)
     {
-      if ((cursor->name[0] && !WASFOUND (cursor))
+      if ((cursor->name[0] && !wasfound (cursor))
          || (len >= cursor->length && ISSLASH (p->file_name[cursor->length])))
        return false;
     }
@@ -1423,7 +1423,7 @@ names_notfound (void)
   struct name const *cursor;
 
   for (cursor = namelist; cursor; cursor = cursor->next)
-    if (!WASFOUND (cursor) && cursor->name[0])
+    if (!wasfound (cursor) && cursor->name[0])
       {
        regex_usage_warning (cursor->name);
        paxerror (0,
@@ -1458,7 +1458,7 @@ label_notfound (void)
     return;
 
   for (cursor = namelist; cursor; cursor = cursor->next)
-    if (WASFOUND (cursor))
+    if (wasfound (cursor))
       return;
 
   if (verbose_option)
@@ -1585,7 +1585,7 @@ merge_sort (struct name *list, int length,
 static int
 compare_names_found (struct name const *n1, struct name const *n2)
 {
-  int found_diff = WASFOUND (n2) - WASFOUND (n1);
+  int found_diff = wasfound (n2) - wasfound (n1);
   return found_diff ? found_diff : strcmp (n1->name, n2->name);
 }
 
index 5a5d4b2d44bf6b1903e0dc8785f022941d21a40c..624aaa9542daac08dee9a9a3956fc6aaa4c2a955 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -1722,7 +1722,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       after_date_option = true;
       FALLTHROUGH;
     case NEWER_MTIME_OPTION:
-      if (TIME_OPTION_INITIALIZED (newer_mtime_option))
+      if (time_option_initialized (newer_mtime_option))
        paxusage (_("More than one threshold date"));
       get_date_or_file (args,
                        key == NEWER_MTIME_OPTION ? "--newer-mtime"
@@ -2309,7 +2309,7 @@ static int subcommand_class[] = {
 void
 more_options (int argc, char **argv, struct option_locus *loc)
 {
-  struct tar_args args = TAR_ARGS_INITIALIZER (loc);
+  struct tar_args args = { .loc = loc };
   argp_parse (&names_argp, argc, argv, ARGP_IN_ORDER|ARGP_NO_EXIT|ARGP_NO_ERRS,
              NULL, &args);
 }
@@ -2360,8 +2360,8 @@ static void
 decode_options (int argc, char **argv)
 {
   int idx;
-  struct option_locus loc = { OPTS_COMMAND_LINE, 0, 0, 0 };
-  struct tar_args args = TAR_ARGS_INITIALIZER (&loc);
+  struct option_locus loc = { .source = OPTS_COMMAND_LINE };
+  struct tar_args args = { .loc = &loc };
 
   argp_version_setup ("tar", tar_authors);
 
@@ -2534,7 +2534,7 @@ decode_options (int argc, char **argv)
     paxusage (_("Multiple archive files require '-M' option"));
 
   if (listed_incremental_option
-      && TIME_OPTION_INITIALIZED (newer_mtime_option))
+      && time_option_initialized (newer_mtime_option))
     {
       struct option_locus *listed_loc = optloc_lookup (OC_LISTED_INCREMENTAL);
       struct option_locus *newer_loc = optloc_lookup (OC_NEWER);
@@ -2605,7 +2605,7 @@ decode_options (int argc, char **argv)
     }
   else if (set_mtime_option == CLAMP_MTIME)
     {
-      if (!TIME_OPTION_INITIALIZED (mtime_option))
+      if (!time_option_initialized (mtime_option))
        paxusage (_("--clamp-mtime needs a date specified using --mtime"));
     }
 
@@ -2791,7 +2791,7 @@ decode_options (int argc, char **argv)
       backup_type = xget_version ("--backup", args.version_control_string);
       /* No backup is needed either if explicitly disabled or if
         the extracted files are not being written to disk. */
-      if (backup_type == no_backups || EXTRACT_OVER_PIPE)
+      if (backup_type == no_backups || to_stdout_option || to_command_option)
        backup_option = false;
     }
 
index a7559f23b862b3b29a90ecaa96fda898eeadaa3b..3423b29333266625fc37e6b37612f2fe441a8ec9 100644 (file)
@@ -115,7 +115,7 @@ set_warning_option (const char *arg)
 void
 warnopt (int opt, int errnum, char const *format, ...)
 {
-  if (WARNING_ENABLED (opt))
+  if (warning_enabled (opt))
     {
       if (error_hook)
        error_hook ();