[gegl] bin: Some cleanup in main ()
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] bin: Some cleanup in main ()
- Date: Thu, 20 Jun 2013 02:30:53 +0000 (UTC)
commit 3ecbd7d266b895471c855414d5e2fbced1c50d80
Author: Michael Henning <drawoc darkrefraction com>
Date: Wed Jun 19 22:29:25 2013 -0400
bin: Some cleanup in main ()
bin/gegl.c | 35 ++++++++++-------------------------
1 files changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/bin/gegl.c b/bin/gegl.c
index 7f82016..905658f 100644
--- a/bin/gegl.c
+++ b/bin/gegl.c
@@ -111,13 +111,11 @@ main (gint argc,
}
else
{
- gchar *tmp;
- gchar *temp1 = g_strdup (o->file);
- gchar *temp2 = g_path_get_dirname (temp1);
- path_root = g_strdup (tmp = realpath (temp2, NULL));
+ gchar *tmp = g_path_get_dirname (o->file);
+ gchar *tmp2 = realpath (tmp, NULL);
+ path_root = g_strdup (tmp2);
g_free (tmp);
- g_free (temp1);
- g_free (temp2);
+ free (tmp2); /* don't use g_free - realpath isn't glib */
}
}
@@ -148,27 +146,14 @@ main (gint argc,
}
else
{
- gchar *leaked_string = g_malloc (strlen (o->file) + 5);
- GString *acc = g_string_new ("");
-
- {
- gchar *file_basename;
- gchar *tmp;
- tmp = g_strdup (o->file);
- file_basename = g_path_get_basename (tmp);
-
- g_string_append (acc, "<gegl><gegl:load path='");
- g_string_append (acc, file_basename);
- g_string_append (acc, "'/></gegl>");
+ gchar *file_basename = g_path_get_basename (o->file);
- g_free (tmp);
- }
-
- script = g_string_free (acc, FALSE);
+ script = g_strconcat ("<gegl><gegl:load path='",
+ file_basename,
+ "'/></gegl>",
+ NULL);
- leaked_string[0]='\0';
- strcat (leaked_string, o->file);
- strcat (leaked_string, ".xml");
+ g_free (file_basename);
}
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]