mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 22:16:16 +01:00
Use hash iterators
svn path=/trunk/; revision=6132
This commit is contained in:
parent
1f7e7f84f4
commit
2f3aef1617
@ -1,3 +1,8 @@
|
||||
2007-12-14 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gcontenttype.c:
|
||||
* gdesktopappinfo.c: Use hash table iterators.
|
||||
|
||||
2007-12-14 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* Makefile.am:
|
||||
|
@ -781,17 +781,6 @@ g_content_type_guess (const char *filename,
|
||||
return mimetype;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
foreach_mimetype (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GList **l = user_data;
|
||||
|
||||
*l = g_list_prepend (*l, (char *)key);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
enumerate_mimetypes_subdir (const char *dir,
|
||||
const char *prefix,
|
||||
@ -859,6 +848,8 @@ g_content_types_get_registered (void)
|
||||
{
|
||||
const char * const* dirs;
|
||||
GHashTable *mimetypes;
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
int i;
|
||||
GList *l;
|
||||
|
||||
@ -871,7 +862,10 @@ g_content_types_get_registered (void)
|
||||
enumerate_mimetypes_dir (dirs[i], mimetypes);
|
||||
|
||||
l = NULL;
|
||||
g_hash_table_foreach_steal (mimetypes, foreach_mimetype, &l);
|
||||
g_hash_table_iter_init (&iter, mimetypes);
|
||||
while (g_hash_table_iter_next (&iter, &key, NULL))
|
||||
l = g_list_prepend (l, key);
|
||||
|
||||
g_hash_table_destroy (mimetypes);
|
||||
|
||||
return l;
|
||||
|
@ -1651,17 +1651,6 @@ get_apps_from_dir (GHashTable *apps,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
collect_apps (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GList **infos = user_data;
|
||||
|
||||
if (value)
|
||||
*infos = g_list_prepend (*infos, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* g_app_info_get_all:
|
||||
@ -1675,6 +1664,8 @@ g_app_info_get_all (void)
|
||||
{
|
||||
const char * const *dirs;
|
||||
GHashTable *apps;
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
int i;
|
||||
GList *infos;
|
||||
|
||||
@ -1689,9 +1680,9 @@ g_app_info_get_all (void)
|
||||
|
||||
|
||||
infos = NULL;
|
||||
g_hash_table_foreach (apps,
|
||||
collect_apps,
|
||||
&infos);
|
||||
g_hash_table_iter_init (&iter, apps);
|
||||
while (g_hash_table_iter_next (&iter, &key, NULL))
|
||||
infos = g_list_prepend (infos, key);
|
||||
|
||||
g_hash_table_destroy (apps);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user