Re: gdk-pixbuf portability patch again
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: Re: gdk-pixbuf portability patch again
- Date: 12 Nov 2000 10:09:54 -0500
Tor Lillqvist <tml iki fi> writes:
> Owen Taylor writes:
> > #include <unistd.h> /* for unlink */
>
> BTW, wouldn't it be slightly better to use remove() (from stdio.h)
> instead of unlink(). (IMHO it fits better if you are already using
> stdio-level functions, and not open/read/write/etc.)
Hmmm, I'd say only if unlink is a portability problem. remove
is just a wee bit slower - the glibc implementation is:
int
remove (file)
const char *file;
{
int save;
save = errno;
if (__rmdir (file) == 0)
return 0;
else if (errno == ENOTDIR && __unlink (file) == 0)
{
__set_errno (save);
return 0;
}
return -1;
}
So ends up doing two syscalls, not just one. (I don't see any
particular reason why the two calls aren't reversed, since removing
files seems like it will happen a lot more than removing directories,
but there may be some subtle reason.)
But there is no real connection between remove() and stdio other
than the header file - the difference is merely the handling
of directories.
Anyways, the extent to which this matters either way seems to
be pretty small..
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]