[xdg-user-dirs-gtk] Remove unused parameter from parsing functions



commit 928088f2597da886f8179a40f02a83d00ed240ab
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Jan 17 15:46:11 2013 -0500

    Remove unused parameter from parsing functions
    
    The filename parameter in parse_gtk_bookmarks() and save_gtk_bookmarks()
    are always NULL - remove them.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=59527

 parse.c  |   37 ++++++++++++-------------------------
 parse.h  |    5 ++---
 update.c |    4 ++--
 3 files changed, 16 insertions(+), 30 deletions(-)
---
diff --git a/parse.c b/parse.c
index 07e94eb..9720c71 100644
--- a/parse.c
+++ b/parse.c
@@ -112,24 +112,18 @@ parse_xdg_dirs (const char *config_file)
 }
 
 GList *
-parse_gtk_bookmarks (const char *filename)
+parse_gtk_bookmarks (void)
 {
-  char *filename_free, *contents;
+  char *filename, *contents;
   GError **error = NULL;
   char **lines;
   int i;
   GtkBookmark *bookmark;
   GList *bookmarks;
 
-  filename_free = NULL;
-  if (filename == NULL)
-    {
-      filename_free = g_build_filename (g_get_home_dir (),
-					".gtk-bookmarks",
-					NULL);
-      filename = (const char *)filename_free;
-    }
-
+  filename = g_build_filename (g_get_home_dir (),
+                               ".gtk-bookmarks",
+                               NULL);
   bookmarks = NULL;
   
   /* Read new list from file */
@@ -161,29 +155,22 @@ parse_gtk_bookmarks (const char *filename)
 	}
       g_strfreev (lines);
     }
-  g_free (filename_free);
+  g_free (filename);
   
   return bookmarks;
 }
 
 void
-save_gtk_bookmarks (const char *filename,
-		    GList *bookmarks)
+save_gtk_bookmarks (GList *bookmarks)
 {
-  char *filename_free;
+  char *filename;
   GString *str;
   GList *l;
   GtkBookmark *bookmark;
 
-  filename_free = NULL;
-  if (filename == NULL)
-    {
-      filename_free = g_build_filename (g_get_home_dir (),
-					".gtk-bookmarks",
-					NULL);
-      filename = (const char *)filename_free;
-    }
-  
+  filename = g_build_filename (g_get_home_dir (),
+                               ".gtk-bookmarks",
+                               NULL); 
   str = g_string_new ("");
 
   for (l = bookmarks; l != NULL; l = l->next)
@@ -199,5 +186,5 @@ save_gtk_bookmarks (const char *filename,
   g_file_set_contents (filename, str->str, str->len, NULL);
   
   g_string_free (str, TRUE);
-  g_free (filename_free);
+  g_free (filename);
 }
diff --git a/parse.h b/parse.h
index fa1aa0b..ce6100e 100644
--- a/parse.h
+++ b/parse.h
@@ -12,7 +12,6 @@ typedef struct {
 
 XdgDirEntry *parse_xdg_dirs        (const char *config_file);
 char        *parse_xdg_dirs_locale (void);
-GList *      parse_gtk_bookmarks   (const char *filename);
-void         save_gtk_bookmarks    (const char *filename,
-				    GList *bookmarks);
+GList *      parse_gtk_bookmarks   (void);
+void         save_gtk_bookmarks    (GList *bookmarks);
 
diff --git a/update.c b/update.c
index 85dcfca..4697913 100644
--- a/update.c
+++ b/update.c
@@ -305,7 +305,7 @@ main (int argc, char *argv[])
   
   new_entries = parse_xdg_dirs (NULL);
 
-  bookmarks = parse_gtk_bookmarks (NULL);
+  bookmarks = parse_gtk_bookmarks ();
 
   modified_bookmarks = FALSE;
   if (bookmarks == NULL)
@@ -372,7 +372,7 @@ main (int argc, char *argv[])
     }
 
   if (modified_bookmarks)
-    save_gtk_bookmarks (NULL, bookmarks);
+    save_gtk_bookmarks (bookmarks);
   
   g_free (new_entries);
   g_free (old_entries);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]