aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorAgney Lopes Roth Ferraz <agney@debian.org>2007-12-09 05:03:40 -0400
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:45 -0500
commit18e8f4ab62003cb2e251f1540d083114ad489123 (patch)
tree1685ab16402d10233f81c67aa4ad7cf857246d86 /util.c
parent401ee3a8ee846998cf0fa3ebadcc81cffe1da3ed (diff)
parentee6c3f9b4cf08a276c971dee66e1acdb32b3dff9 (diff)
Import Debian changes 0.4.2.3-1
hardinfo (0.4.2.3-1) unstable; urgency=low * New upstream release.(Closes: #454947)
Diffstat (limited to 'util.c')
-rw-r--r--util.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/util.c b/util.c
index bf8c3f57..79f4aef3 100644
--- a/util.c
+++ b/util.c
@@ -662,16 +662,11 @@ static GSList *modules_check_deps(GSList * modules)
ShellModule *m;
gboolean found = FALSE;
- for (l = modules; l; l = l->next) {
+ for (l = modules; l && !found; l = l->next) {
m = (ShellModule *) l->data;
- gchar *name =
- g_path_get_basename(g_module_name(m->dll));
-
- if (g_str_equal(name, deps[i])) {
- found = TRUE;
- break;
- }
+ gchar *name = g_path_get_basename(g_module_name(m->dll));
+ found = g_str_equal(name, deps[i]);
g_free(name);
}
@@ -707,7 +702,7 @@ static GSList *modules_check_deps(GSList * modules)
ShellModule *mod = module_load(deps[i]);
if (mod)
- modules = g_slist_append(modules, mod);
+ modules = g_slist_prepend(modules, mod);
modules = modules_check_deps(modules); /* re-check dependencies */
} else {
modules = g_slist_remove(modules, module);
@@ -743,7 +738,7 @@ static GSList *modules_load(gchar ** module_list)
if (g_strrstr(filename, "." G_MODULE_SUFFIX) &&
module_in_module_list(filename, module_list) &&
((module = module_load(filename)))) {
- modules = g_slist_append(modules, module);
+ modules = g_slist_prepend(modules, module);
}
}
@@ -1001,7 +996,6 @@ gchar *h_strdup_cprintf(const gchar * format, gchar * source, ...)
retn = buffer;
}
-
return retn;
}
@@ -1041,3 +1035,16 @@ gchar *h_strconcat(gchar * string1, ...)
return concat;
}
+
+static gboolean h_hash_table_remove_all_true(gpointer key, gpointer data, gpointer user_data)
+{
+ return TRUE;
+}
+
+void
+h_hash_table_remove_all(GHashTable *hash_table)
+{
+ g_hash_table_foreach_remove(hash_table,
+ h_hash_table_remove_all_true,
+ NULL);
+}