From: Sergey Poznyakoff Date: Tue, 31 Aug 2004 11:47:02 +0000 (+0000) Subject: (removed_prefixes_p): New function X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=3f4f5a4bf4f42bb69810646507ee5f914c9d6e53;p=chaz%2Ftar (removed_prefixes_p): New function --- diff --git a/src/names.c b/src/names.c index 7a50acc..57f8946 100644 --- a/src/names.c +++ b/src/names.c @@ -1001,7 +1001,22 @@ is_avoided_name (char const *name) { return hash_string_lookup (avoided_name_table, name); } + + +static Hash_table *prefix_table[2]; + +/* Return true if file names of some members in the archive were stripped off + their leading components. We could have used + return prefix_table[0] || prefix_table[1] + but the following seems to be safer: */ +bool +removed_prefixes_p (void) +{ + return (prefix_table[0] && hash_get_n_entries (prefix_table[0]) != 0) + || (prefix_table[1] && hash_get_n_entries (prefix_table[1]) != 0); +} + /* Return a safer suffix of FILE_NAME, or "." if it has no safer suffix. Check for fully specified file names and other atrocities. Warn the user if we do not return NAME. If LINK_TARGET is 1, @@ -1041,7 +1056,6 @@ safer_name_suffix (char const *file_name, bool link_target) if (prefix_len) { - static Hash_table *prefix_table[2]; char *prefix = alloca (prefix_len + 1); memcpy (prefix, file_name, prefix_len); prefix[prefix_len] = '\0';