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

gEDA-cvs: CVS update: x_menus.c



  User: peterb  
  Date: 07/05/10 08:45:12

  Modified:    .        x_menus.c
  Log:
  Provide g_file_set_contents() if GLib < 2.8.
  
  
  
  Patch from Ivan Stankovic, fixing problem with recent files
  
  support where gschem didn't work on systems with older versions
  
  of GLib, due to g_file_set_contents() not being available.
  
  
  
  
  Revision  Changes    Path
  1.44      +28 -0     eda/geda/gaf/gschem/src/x_menus.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_menus.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_menus.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -b -r1.43 -r1.44
  --- x_menus.c	8 May 2007 21:49:47 -0000	1.43
  +++ x_menus.c	10 May 2007 12:45:12 -0000	1.44
  @@ -369,6 +369,34 @@
     }
   }
   
  +#if !GLIB_CHECK_VERSION(2,8,0)
  +/* g_file_set_contents() exists only in glib >= 2.8 */
  +gboolean g_file_set_contents(const gchar *filename, const gchar *contents,
  +      gssize length, GError **error)
  +{
  +   FILE *fp;
  +   gboolean ret = FALSE;
  +
  +   fp = fopen(filename, "w");
  +   if(fp == NULL)
  +      return FALSE;
  +
  +   if(length == -1) {
  +      /* It's a null-terminated string. */
  +      if(fputs(contents, fp) == EOF)
  +         goto out;
  +   } else {
  +      if(fwrite(contents, length, 1, fp) != 1)
  +         goto out;
  +   }
  +
  +   ret = TRUE;
  +out:
  +   fclose(fp);
  +   return ret;
  +}
  +#endif  /* !GLIB_CHECK_VERSION(2,8,0) */
  +
   #if !GLIB_CHECK_VERSION(2,6,0)
   
   /* disable recent files support */
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs