X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fnames.c;h=1146020b2458f5a07fa5c534ea1511e596f3b703;hb=bffe1074aab0bd180b6b522f07f951f73ef59191;hp=6e251e3c159bd7d92b66efa323be8203024c64de;hpb=aeffa4f266dbeb3325300a86ae7a6652589d2021;p=chaz%2Ftar diff --git a/src/names.c b/src/names.c index 6e251e3..1146020 100644 --- a/src/names.c +++ b/src/names.c @@ -205,7 +205,7 @@ free_name (struct name *p) /* Names from the command call. */ static struct name *namelist; /* first name in list, if any */ -static struct name **nametail = &namelist; /* end of name list */ +static struct name *nametail; /* end of name list */ /* File name arguments are processed in two stages: first a name_array (see below) is filled, then the names from it @@ -422,8 +422,7 @@ name_gather (void) buffer->parent = NULL; buffer->cmdline = true; - namelist = buffer; - nametail = &namelist->next; + namelist = nametail = buffer; } else if (change_dir) addname (0, change_dir, false, NULL); @@ -457,7 +456,7 @@ addname (char const *string, int change_dir, bool cmdline, struct name *parent) { struct name *name = make_name (string); - name->prev = *nametail; + name->prev = nametail; name->next = NULL; name->found_count = 0; name->matching_flags = matching_flags; @@ -465,9 +464,12 @@ addname (char const *string, int change_dir, bool cmdline, struct name *parent) name->directory = NULL; name->parent = parent; name->cmdline = cmdline; - - *nametail = name; - nametail = &name->next; + + if (nametail) + nametail->next = name; + else + namelist = name; + nametail = name; return name; } @@ -501,7 +503,7 @@ remname (struct name *name) if ((p = name->next) != NULL) p->prev = name->prev; else - nametail = &name->prev; + nametail = name->prev; } /* Return true if and only if name FILE_NAME (from an archive) matches any @@ -521,8 +523,8 @@ name_match (const char *file_name) if (cursor->name[0] == 0) { chdir_do (cursor->change_dir); - namelist = 0; - nametail = &namelist; + namelist = NULL; + nametail = NULL; return true; } @@ -535,8 +537,8 @@ name_match (const char *file_name) if (starting_file_option) { free (namelist); - namelist = 0; - nametail = &namelist; + namelist = NULL; + nametail = NULL; } chdir_do (cursor->change_dir); @@ -575,8 +577,6 @@ all_names_found (struct tar_stat_info *p) struct name const *cursor; size_t len; - if (test_label_option) - return true; if (!p->file_name || occurrence_option == 0 || p->had_trailing_slash) return false; len = strlen (p->file_name); @@ -598,13 +598,10 @@ regex_usage_warning (const char *name) { warned_once = 1; WARN ((0, 0, - /* TRANSLATORS: The following three msgids form a single sentence. - */ - _("Pattern matching characters used in file names. Please,"))); - WARN ((0, 0, - _("use --wildcards to enable pattern matching, or --no-wildcards to"))); + _("Pattern matching characters used in file names"))); WARN ((0, 0, - _("suppress this warning."))); + _("Use --wildcards to enable pattern matching," + " or --no-wildcards to suppress this warning"))); } } @@ -627,8 +624,8 @@ names_notfound (void) } /* Don't bother freeing the name list; we're about to exit. */ - namelist = 0; - nametail = &namelist; + namelist = NULL; + nametail = NULL; if (same_order_option) { @@ -903,7 +900,7 @@ collect_and_sort_names (void) _("Only one -C option is allowed with " "--listed-incremental"))); } - chdir_do (namelist->change_dir); + read_directory_file (); } @@ -975,7 +972,7 @@ collect_and_sort_names (void) prev_name = name; num_names++; } - nametail = &prev_name; + nametail = prev_name; hash_free (nametab); namelist = merge_sort (namelist, num_names, compare_names_found); @@ -1074,24 +1071,6 @@ excluded_name (char const *name) { return excluded_file_name (excluded, name + FILE_SYSTEM_PREFIX_LEN (name)); } - -/* Names to avoid dumping. */ -static Hash_table *avoided_name_table; - -/* Remember to not archive NAME. */ -void -add_avoided_name (char const *name) -{ - hash_string_insert (&avoided_name_table, name); -} - -/* Should NAME be avoided when archiving? */ -bool -is_avoided_name (char const *name) -{ - return hash_string_lookup (avoided_name_table, name); -} - static Hash_table *individual_file_table;