diff -Nurd -x'*~' pkg-config-0.28.orig/pkg.c pkg-config-0.28/pkg.c --- pkg-config-0.28.orig/pkg.c 2013-01-22 08:11:59.000000000 -0500 +++ pkg-config-0.28/pkg.c 2014-06-05 11:56:53.000000000 -0400 @@ -1261,17 +1261,17 @@ } static void -max_len_foreach (gpointer key, gpointer value, gpointer data) +max_len_foreach (gpointer value, gpointer data) { int *mlen = data; - *mlen = MAX (*mlen, strlen (key)); + *mlen = MAX (*mlen, strlen (value)); } static void -packages_foreach (gpointer key, gpointer value, gpointer data) +packages_foreach (gpointer value, gpointer data) { - Package *pkg = get_package (key); + Package *pkg = get_package (value); if (pkg != NULL) { @@ -1290,12 +1290,18 @@ print_package_list (void) { int mlen = 0; + GList *packages = NULL; ignore_requires = TRUE; ignore_requires_private = TRUE; - g_hash_table_foreach (locations, max_len_foreach, &mlen); - g_hash_table_foreach (locations, packages_foreach, GINT_TO_POINTER (mlen + 1)); + packages = g_hash_table_get_keys(locations); + packages = g_list_sort(packages, (GCompareFunc)g_ascii_strcasecmp); + + g_list_foreach (packages, max_len_foreach, &mlen); + g_list_foreach (packages, packages_foreach, GINT_TO_POINTER (mlen + 1)); + + g_list_free(packages); } void