Modified code where possible to use preferably g_build_filename()
instead of g_build_path(), or g_strconcat() and friends.
---
 gattrib/src/gattrib.c      |    5 +----
 gnetlist/src/gnetlist.c    |    7 ++-----
 gschem/src/g_rc.c          |   10 ++--------
 gschem/src/gschem.c        |   10 +++-------
 gschem/src/x_autonumber.c  |    4 ++--
 gsymcheck/src/gsymcheck.c  |    7 ++-----
 libgeda/src/f_basic.c      |    5 +----
 libgeda/src/g_rc.c         |   39 ++++++++-------------------------------
 libgeda/src/o_picture.c    |    4 ++--
 libgeda/src/o_text_basic.c |    2 +-
 libgeda/src/s_page.c       |    5 +----
 utils/gschlas/gschlas.c    |    7 ++-----
 12 files changed, 27 insertions(+), 78 deletions(-)

diff --git a/gattrib/src/gattrib.c b/gattrib/src/gattrib.c
index 60b6401..596db91 100644
--- a/gattrib/src/gattrib.c
+++ b/gattrib/src/gattrib.c
@@ -140,10 +140,7 @@ void gattrib_main(void *closure, int argc, char *argv[])
   /* ----------  create log file right away ---------- */
   /* ----------  even if logging is enabled ---------- */
   cwd = g_get_current_dir();
-  logfile = g_build_path (G_DIR_SEPARATOR_S,
-                          cwd,
-                          "gattrib.log",
-                          NULL);
+  logfile = g_build_filename (cwd, "gattrib.log", NULL);
   s_log_init (logfile);
   g_free (logfile);
   g_free (cwd);
diff --git a/gnetlist/src/gnetlist.c b/gnetlist/src/gnetlist.c
index fa4f628..6a717a1 100644
--- a/gnetlist/src/gnetlist.c
+++ b/gnetlist/src/gnetlist.c
@@ -145,10 +145,7 @@ void main_prog(void *closure, int argc, char *argv[])
 
     /* create log file right away */
     /* even if logging is enabled */
-    logfile = g_build_path (G_DIR_SEPARATOR_S,
-                            cwd,
-                            "gnetlist.log",
-                            NULL);
+    logfile = g_build_filename (cwd, "gnetlist.log", NULL);
     s_log_init (logfile);
     g_free (logfile);
 
@@ -228,7 +225,7 @@ void main_prog(void *closure, int argc, char *argv[])
         /* Path is already absolute so no need to do any concat of cwd */
         filename = g_strdup (argv[i]);
       } else {
-        filename = g_build_path (G_DIR_SEPARATOR_S, cwd, argv[i], NULL);
+        filename = g_build_filename (cwd, argv[i], NULL);
       }
 
       if (!quiet_mode) {
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index 190d950..ccbe19a 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -59,19 +59,13 @@ void g_rc_parse_gtkrc()
   gchar *filename;
   const gchar *home;
 
-  filename = g_strconcat (g_rc_parse_path (),
-                          G_DIR_SEPARATOR_S,
-                          "gschem-gtkrc",
-                          NULL);
+  filename = g_build_filename (g_rc_parse_path (), "gschem-gtkrc", NULL);
   gtk_rc_parse (filename);
   g_free (filename);
   
   home = g_getenv ("HOME");
   if (home != NULL) {
-    filename = g_strconcat (home,
-                            G_DIR_SEPARATOR_S,
-                            ".gschem-gtkrc",
-                            NULL);
+    filename = g_build_filename (home, ".gschem-gtkrc", NULL);
     gtk_rc_parse (filename);
     g_free (filename);
   }
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 4e2e632..f142c75 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -176,10 +176,7 @@ void main_prog(void *closure, int argc, char *argv[])
   
   /*! \todo Probably the file name shuold be defined elsewhere */
   /* create log file right away even if logging is enabled */
-  filename = g_build_path (G_DIR_SEPARATOR_S,
-                           cwd,
-                           "gschem.log",
-                           NULL);
+  filename = g_build_filename (cwd, "gschem.log", NULL);
   s_log_init (filename);
   g_free (filename);
 
@@ -241,8 +238,7 @@ void main_prog(void *closure, int argc, char *argv[])
   g_rc_parse_gtkrc();
   g_rc_parse(w_current->toplevel, "gschemrc", rc_filename);
   
-  input_str = g_strdup_printf("%s%cgschem.scm", default_scheme_directory, 
-                             G_DIR_SEPARATOR);
+  input_str = g_build_filename (default_scheme_directory, "gschem.scm", NULL);
   if (g_read_file(input_str) != -1) {
     s_log_message(_("Read init scm file [%s]\n"), input_str);
   } else {
@@ -282,7 +278,7 @@ void main_prog(void *closure, int argc, char *argv[])
       /* Path is already absolute so no need to do any concat of cwd */
       filename = g_strdup (argv[i]);
     } else {
-      filename = g_strconcat (cwd, G_DIR_SEPARATOR_S, argv[i], NULL);
+      filename = g_build_filename (cwd, argv[i], NULL);
     }
 
     if ( first_page )
diff --git a/gschem/src/x_autonumber.c b/gschem/src/x_autonumber.c
index 017af04..b58b3f5 100644
--- a/gschem/src/x_autonumber.c
+++ b/gschem/src/x_autonumber.c
@@ -881,8 +881,8 @@ void autonumber_sortorder_create(GSCHEM_TOPLEVEL 
*w_current, GtkWidget *sort_ord
   store = gtk_list_store_new(2, G_TYPE_STRING, GDK_TYPE_PIXBUF); 
 
   for (i=0; filenames[i] != NULL; i++) {
-    path=g_strconcat(w_current->toplevel->bitmap_directory,
-                    G_DIR_SEPARATOR_S, filenames[i], NULL);
+    path=g_build_filename(w_current->toplevel->bitmap_directory,
+                    filenames[i], NULL);
     pixbuf = gdk_pixbuf_new_from_file(path, &error);
     g_free(path);
     gtk_list_store_append(store, &iter);
diff --git a/gsymcheck/src/gsymcheck.c b/gsymcheck/src/gsymcheck.c
index 7ddc4e2..6553e3a 100644
--- a/gsymcheck/src/gsymcheck.c
+++ b/gsymcheck/src/gsymcheck.c
@@ -66,10 +66,7 @@ main_prog(void *closure, int argc, char *argv[])
 
   /* create log file right away */
   /* even if logging is enabled */
-  logfile = g_build_path (G_DIR_SEPARATOR_S,
-                          cwd,
-                          "gsymcheck.log",
-                          NULL);
+  logfile = g_build_filename (cwd, "gsymcheck.log", NULL);
   s_log_init (logfile);
   g_free (logfile);
        
@@ -112,7 +109,7 @@ main_prog(void *closure, int argc, char *argv[])
       /* Path is already absolute so no need to do any concat of cwd */
       filename = g_strdup (argv[i]);
     } else {
-      filename = g_build_path (G_DIR_SEPARATOR_S, cwd, argv[i], NULL);
+      filename = g_build_filename (cwd, argv[i], NULL);
     }
 
     s_page_goto (pr_current,
diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index cfb052f..c5222ae 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -227,10 +227,7 @@ int f_open_flags(TOPLEVEL *toplevel, const gchar *filename,
 
   /* Now open RC and process file */
   if (flags & F_OPEN_RC) {
-    full_rcfilename = g_strconcat (file_directory,  
-                                   G_DIR_SEPARATOR_S, 
-                                   "gafrc",
-                                   NULL);
+    full_rcfilename = g_build_filename (file_directory, "gafrc", NULL);
     g_rc_parse_specified_rc(toplevel, full_rcfilename);
   }
 
diff --git a/libgeda/src/g_rc.c b/libgeda/src/g_rc.c
index 952397f..97e2f12 100644
--- a/libgeda/src/g_rc.c
+++ b/libgeda/src/g_rc.c
@@ -242,12 +242,7 @@ gint g_rc_parse_home_rc(TOPLEVEL *toplevel, const gchar 
*rcname)
     return 0;
   }
 
-  tmp = g_strconcat (home,
-                     G_DIR_SEPARATOR_S,
-                     ".gEDA",
-                     G_DIR_SEPARATOR_S,
-                     rcname,
-                     NULL);
+  tmp = g_build_filename (home, ".gEDA", rcname, NULL);
   filename = f_normalize_filename (tmp, NULL);
   if (filename == NULL) {
     return 0;
@@ -278,13 +273,11 @@ gint g_rc_parse_home_rc(TOPLEVEL *toplevel, const gchar 
*rcname)
 gint g_rc_parse_local_rc(TOPLEVEL *toplevel, const gchar *rcname)
 {
   gint found_rc;
-  gchar *tmp;
   char *filename;
   gchar *ok_msg;
   gchar *err_msg;
 
-  tmp = g_strconcat (".", G_DIR_SEPARATOR_S, rcname, NULL);
-  filename = f_normalize_filename (tmp, NULL);
+  filename = f_normalize_filename (rcname, NULL);
   if (filename == NULL) {
     return 0;
   }
@@ -297,7 +290,6 @@ gint g_rc_parse_local_rc(TOPLEVEL *toplevel, const gchar 
*rcname)
 
   g_free(ok_msg);
   g_free(err_msg);
-  g_free(tmp);
   g_free(filename);
 
   return found_rc;
@@ -436,7 +428,7 @@ SCM g_rc_component_library(SCM path, SCM name)
 #ifdef __MINGW32__
     u_basic_strip_trailing(cwd, G_DIR_SEPARATOR);
 #endif
-    temp = g_strconcat (cwd, G_DIR_SEPARATOR_S, string, NULL);
+    temp = g_build_filename (cwd, string, NULL);
     s_clib_add_directory (temp, namestr);
     g_free(temp);
     g_free(cwd);
@@ -571,10 +563,7 @@ SCM g_rc_component_library_search(SCM path)
         (g_strcasecmp (entry, "..")   != 0) &&
         (g_strcasecmp (entry, "font") != 0))
     {
-      gchar *fullpath = g_strconcat (string,
-                                     G_DIR_SEPARATOR_S,
-                                     entry,
-                                     NULL);
+      gchar *fullpath = g_build_filename (string, entry, NULL);
 
       if (g_file_test (fullpath, G_FILE_TEST_IS_DIR)) {
         if (g_path_is_absolute (fullpath)) {
@@ -585,10 +574,7 @@ SCM g_rc_component_library_search(SCM path)
 #ifdef __MINGW32__
           u_basic_strip_trailing(cwd, G_DIR_SEPARATOR);
 #endif
-          temp = g_strconcat (cwd,
-                              G_DIR_SEPARATOR_S,
-                              fullpath,
-                              NULL);
+          temp = g_build_filename (cwd, fullpath, NULL);
           s_clib_add_directory (temp, NULL);
           g_free(temp);
           g_free(cwd);
@@ -637,10 +623,7 @@ SCM g_rc_source_library(SCM path)
 #ifdef __MINGW32__
     u_basic_strip_trailing(cwd, G_DIR_SEPARATOR);
 #endif
-    temp = g_strconcat (cwd,
-                        G_DIR_SEPARATOR_S,
-                        string,
-                        NULL);
+    temp = g_build_filename (cwd, string, NULL);
     s_slib_add_entry (temp);
     g_free(temp);
     g_free(cwd);
@@ -694,10 +677,7 @@ SCM g_rc_source_library_search(SCM path)
         (g_strcasecmp (entry, "..")   != 0) &&
         (g_strcasecmp (entry, "font") != 0))
     {
-      gchar *fullpath = g_strconcat (string,
-                                     G_DIR_SEPARATOR_S,
-                                     entry,
-                                     NULL);
+      gchar *fullpath = g_build_filename (string, entry, NULL);
 
       if (g_file_test (fullpath, G_FILE_TEST_IS_DIR)) {
         if (s_slib_uniq (fullpath)) {
@@ -709,10 +689,7 @@ SCM g_rc_source_library_search(SCM path)
 #ifdef __MINGW32__
             u_basic_strip_trailing(cwd, G_DIR_SEPARATOR);
 #endif
-            temp = g_strconcat (cwd,
-                                G_DIR_SEPARATOR_S,
-                                fullpath,
-                                NULL);
+            temp = g_build_filename (cwd, fullpath, NULL);
             s_slib_add_entry (temp);
             g_free(temp);
             g_free(cwd);
diff --git a/libgeda/src/o_picture.c b/libgeda/src/o_picture.c
index 9ce2595..acc9b0c 100644
--- a/libgeda/src/o_picture.c
+++ b/libgeda/src/o_picture.c
@@ -198,8 +198,8 @@ OBJECT *o_picture_read(TOPLEVEL *toplevel, OBJECT 
*object_list,
 
     s_log_message (_("Loading warning picture.\n"));
     
-    temp_filename = g_strconcat(toplevel->bitmap_directory,
-                                G_DIR_SEPARATOR_S, "gschem-warning.png", NULL);
+    temp_filename = g_build_filename (toplevel->bitmap_directory,
+                                      "gschem-warning.png", NULL);
     pixbuf = gdk_pixbuf_new_from_file (temp_filename, NULL);
     if (pixbuf == NULL) {
       s_log_message( _("Error loading picture from file: %s.\n"),
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index f896400..b4ac53d 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -181,7 +181,7 @@ OBJECT *o_text_load_font(TOPLEVEL *toplevel, gunichar 
needed_char)
     s_log_message(_("Could not find character '%s' definition.\n"), outbuf);
     
     g_free (temp_string);
-    temp_string = g_strdup_printf("%s%cquest.sym", toplevel->font_directory, 
G_DIR_SEPARATOR);
+    temp_string = g_build_filename (toplevel->font_directory, "quest.sym", 
NULL);
     if ( access(temp_string, R_OK) != 0 ) {
       fprintf(stderr, _("Could not load question font char -- check 
font-directory keyword\n"));
       exit(-1);
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index 3543047..cdae0a0 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -67,10 +67,7 @@ PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
     page->page_filename = g_strdup (filename);
   } else {
     gchar *pwd = g_get_current_dir ();
-    page->page_filename = g_strconcat (pwd,
-                                       G_DIR_SEPARATOR_S,
-                                       filename,
-                                       NULL);
+    page->page_filename = g_build_filename (pwd, filename, NULL);
     g_free (pwd);
   }
        
diff --git a/utils/gschlas/gschlas.c b/utils/gschlas/gschlas.c
index 6b553ac..d809cf8 100644
--- a/utils/gschlas/gschlas.c
+++ b/utils/gschlas/gschlas.c
@@ -68,10 +68,7 @@ main_prog(void *closure, int argc, char *argv[])
 
   /* create log file right away */
   /* even if logging is enabled */
-  logfile = g_build_path (G_DIR_SEPARATOR_S,
-                          cwd,
-                          "gschlas.log",
-                          NULL);
+  logfile = g_build_filename (cwd, "gschlas.log", NULL);
   s_log_init (logfile);
   g_free (logfile);
        
@@ -113,7 +110,7 @@ main_prog(void *closure, int argc, char *argv[])
       /* Path is already absolute so no need to do any concat of cwd */
       filename = g_strdup (argv[i]);
     } else {
-      filename = g_build_path (G_DIR_SEPARATOR_S, cwd, argv[i], NULL);
+      filename = g_build_filename (cwd, argv[i], NULL);
     }
 
     if (!f_open (pr_current,
-- 
1.5.6




_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to