[Libosinfo] [PATCH] install-script tool: Take GFile creation out of the loop

Daniel P. Berrange berrange at redhat.com
Thu Jan 31 15:04:14 UTC 2013


On Thu, Jan 31, 2013 at 03:56:24PM +0100, Zeeshan Ali (Khattak) wrote:
> 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;
>  }

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Libosinfo mailing list