[Libosinfo] [PATCH] install-script tool: Take GFile creation out of the loop
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Thu Jan 31 14:56:24 UTC 2013
From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
Also, unref the GFile when done.
---
tools/osinfo-install-script.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c
index 0f5656b..9eabea6 100644
--- a/tools/osinfo-install-script.c
+++ b/tools/osinfo-install-script.c
@@ -190,6 +190,7 @@ static gboolean generate_script(OsinfoOs *os)
OsinfoInstallScriptList *scripts = osinfo_os_get_install_script_list(os);
OsinfoInstallScriptList *profile_scripts;
OsinfoFilter *filter;
+ GFile *dir;
GList *l, *tmp;
gboolean ret = FALSE;
GError *error = NULL;
@@ -209,10 +210,10 @@ static gboolean generate_script(OsinfoOs *os)
goto cleanup;
}
+ dir = g_file_new_for_commandline_arg(output_dir ? output_dir : ".");
+
for (tmp = l; tmp != NULL; tmp = tmp->next) {
OsinfoInstallScript *script = tmp->data;
- GFile *dir = g_file_new_for_commandline_arg(output_dir ?
- output_dir : ".");
if (prefix)
osinfo_install_script_set_output_prefix(script, prefix);
@@ -237,6 +238,7 @@ static gboolean generate_script(OsinfoOs *os)
g_object_unref(scripts);
g_object_unref(filter);
g_object_unref(profile_scripts);
+ g_object_unref(dir);
return ret;
}
--
1.8.1
More information about the Libosinfo
mailing list