mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2026-05-05 02:58:02 +02:00
Remove unused package_list_strip_duplicates
After 908cdd0, there are no more duplicates in the package list and this
function is unused.
This commit is contained in:
parent
908cdd062a
commit
983052ddf8
1 changed files with 0 additions and 37 deletions
37
pkg.c
37
pkg.c
|
|
@ -599,43 +599,6 @@ merge_flag_lists (GList *packages, FlagType type)
|
|||
return merged;
|
||||
}
|
||||
|
||||
/* Work backwards from the end of the package list to remove duplicate
|
||||
* packages. This could happen because the package was specified multiple
|
||||
* times on the command line, or because multiple packages require the same
|
||||
* package. When we have duplicate dependencies, starting from the end of the
|
||||
* list ensures that the dependency shows up later in the package list and
|
||||
* Libs will come out correctly. */
|
||||
static GList *
|
||||
package_list_strip_duplicates (GList *packages)
|
||||
{
|
||||
GList *cur;
|
||||
GHashTable *requires;
|
||||
|
||||
requires = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
for (cur = g_list_last (packages); cur != NULL; cur = g_list_previous (cur))
|
||||
{
|
||||
Package *pkg = cur->data;
|
||||
|
||||
if (g_hash_table_lookup_extended (requires, pkg->key, NULL, NULL))
|
||||
{
|
||||
GList *dup = cur;
|
||||
|
||||
/* Remove the duplicate package from the list */
|
||||
debug_spew ("Removing duplicate package %s\n", pkg->key);
|
||||
cur = cur->next;
|
||||
packages = g_list_delete_link (packages, dup);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unique package. Track it and move to the next. */
|
||||
g_hash_table_replace (requires, pkg->key, pkg->key);
|
||||
}
|
||||
}
|
||||
g_hash_table_destroy (requires);
|
||||
|
||||
return packages;
|
||||
}
|
||||
|
||||
static GList *
|
||||
fill_list (GList *packages, FlagType type,
|
||||
gboolean in_path_order, gboolean include_private)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue