xfdesktop
Olivier FOURDAN
FOURDAN.Olivier at wanadoo.fr
Fri Mar 14 14:09:45 CET 2003
Hi Benny,
> On Fri, 14, Mar 2003, Jasper Huijsmans wrote:
>
> > On Fri, 14 Mar 2003 10:54:36 +0100
> > Benedikt Meurer <Benedikt.Meurer at unix-ag.uni-siegen.de> wrote:
> >
> > > >
> > > > Why do we need file locking?
> > >
> > > To prevent data file corruption in any case.
> >
> > Hmm, xfdesktop is already ensured to be a unique app, so there is not
> > much chance of another process reading the file, is there?
>
> Thats why I said "in any case". Its better to have it now, since errors
> causing data corruption are very hard to track.
I agree that file locking would be a plus, athough chances that we get into trouble w/out are
almost null due to the design of mcs.
mcs is for storing relatively small amount of data, so there is no problem with reading the file at
once with g_file_get_contents().
> > > > What's wrong with g_file_get_contents()?
> > >
> > > a) a single read(2) is sufficient to read the contents of a regular
> > > file
> > > on UNIX systems
> > > b) g_file_get_contents() does not use file locking.
> > >
> >
> > Well, the reason I ask is that I prefer to use glib functions as much as
> > possible because of portability reasons (oh, and convenience of course).
> >
> > I cannot judge the necessity of these things, so I'm glad you have a
> > look at them. I just want to make sure we take as much advantage of the
> > libraries we depend on as possible :)
>
> Hm. I prefer to get things done with the system as much as possible without
> the requirement of 3rd party functions (which are indeed only wrappers around
> the system libraries). If something can be done with a simple system call,
> I don't see any reason to use a high level wrapper function to do the job.
>
I disagree. Use of glib functions is mandatory where available. You say it yourself, "on UNIX
systems", but xfce should be able to compile and run on other systems. It might not
be the case today, but that doesn't mean that we should not take all possible steps to allow
xfce to run on non UNIX systems.
I've had many problems with compatibility with xfce3, being forced to implement basic functions
like "snprintf" to be able to run on not so strange systems. That's why I consider a "best
practice" to use glib functions.
glib provides wrapper for most finctions that might not be available on all system. You must use them (from an xfce standpoint).
Cheers,
Olivier.
More information about the Xfce4-dev
mailing list