mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2026-05-25 21:58:21 +02:00
Sort --print-variables output
Makes the output consistent regardless of how glib puts together the variables hash table. https://bugs.freedesktop.org/show_bug.cgi?id=66939
This commit is contained in:
parent
a6e8749ada
commit
818aeace3b
2 changed files with 13 additions and 10 deletions
|
|
@ -16,10 +16,10 @@ RESULT="pcfiledir"
|
|||
run_test --print-variables no-variables
|
||||
|
||||
RESULT="exec_prefix
|
||||
prefix
|
||||
libdir
|
||||
includedir
|
||||
pcfiledir"
|
||||
libdir
|
||||
pcfiledir
|
||||
prefix"
|
||||
run_test --print-variables simple
|
||||
|
||||
# --print-provides
|
||||
|
|
|
|||
17
main.c
17
main.c
|
|
@ -281,11 +281,10 @@ pkg_uninstalled (Package *pkg)
|
|||
}
|
||||
|
||||
void
|
||||
print_hashtable_key (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
print_list_data (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
printf("%s\n", (gchar*)key);
|
||||
g_print ("%s\n", (gchar *)data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -700,9 +699,13 @@ main (int argc, char **argv)
|
|||
{
|
||||
Package *pkg = tmp->data;
|
||||
if (pkg->vars != NULL)
|
||||
g_hash_table_foreach(pkg->vars,
|
||||
&print_hashtable_key,
|
||||
NULL);
|
||||
{
|
||||
/* Sort variables for consistent output */
|
||||
GList *keys = g_hash_table_get_keys (pkg->vars);
|
||||
keys = g_list_sort (keys, (GCompareFunc)g_strcmp0);
|
||||
g_list_foreach (keys, print_list_data, NULL);
|
||||
g_list_free (keys);
|
||||
}
|
||||
tmp = g_list_next (tmp);
|
||||
if (tmp) printf ("\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue