/* Module names.c. */
-extern size_t name_count;
+enum files_count
+ {
+ FILES_NONE,
+ FILES_ONE,
+ FILES_MANY
+ };
+extern enum files_count filename_args;
+
+/* Return true if there are file names in the list */
+static inline bool
+name_more_files (void)
+{
+ return filename_args != FILES_NONE;
+}
+
extern struct name *gnu_list_name;
void gid_to_gname (gid_t gid, char **gname);
{
struct name const *p;
- trivial_link_count = name_count <= 1 && ! dereference_option;
+ trivial_link_count = filename_args != FILES_MANY && ! dereference_option;
open_archive (ACCESS_WRITE);
buffer_write_global_xheader ();
} v;
};
-static struct name_elt *name_head;/* store a list of names */
-size_t name_count; /* how many of the entries are file names? */
+static struct name_elt *name_head; /* store a list of names */
+
+/* how many of the entries are file names? */
+enum files_count filename_args = FILES_NONE;
static struct name_elt *
name_elt_alloc (void)
}
}
-/* Return true if there are names or options in the list */
-bool
-name_more_files (void)
-{
- return name_count > 0;
-}
-
/* Add to name_array the file NAME with fnmatch options MATFLAGS */
void
name_add_name (const char *name)
ep->type = NELT_NAME;
ep->v.name = name;
- name_count++;
+
+ switch (filename_args)
+ {
+ case FILES_NONE:
+ filename_args = FILES_ONE;
+ break;
+
+ case FILES_ONE:
+ filename_args = FILES_MANY;
+ break;
+
+ default:
+ break;
+ }
}
static void
ep->v.file.name = name;
ep->v.file.line = 0;
ep->v.file.fp = NULL;
- name_count++;
+
+ /* We don't know beforehand how many files are listed.
+ Assume more than one. */
+ filename_args = FILES_MANY;
}
\f
/* Names from external name file. */