Re: GDir as DIR replacement - patch



At 19:11 04.11.01 -0500, Owen Taylor wrote:
>> [...]
>
>OK, I think it makes sense to go ahead and squeeze this in. Will
>you be able to do another version of the patch in the next day
>or so? 
Even in the next hour or so, maybe I need to sleep at work in
some hours :-)

IMO it is the simpliest solution if I deliver the files
through cvs, probably done before this mail arrives.

>I'm going to do 1.3.11 on Tuesday, and we'd really like
>to have *all* API stuff done in that release.
>
It would be nice if someone else could take care for changes 
required beside the source addition:

- configure check for <dirent.h>
- add to glib.h and Makefile.am ?

>> > - NSPR's readdir() has flags "SKIP_DOT, SKIP_DOT_DOT,
>> >   SKIP_BOTH, SKIP_HIDDEN". I think most uses of readdir
>> >   do want SKIP_BOTH, so it could be considered convenient
>> >   to not have to put the strcmp()'s in each usage.
>> >   OTOH, it could be considered bloat since you _can_
>> >   do the strcmp. (Actually, I'd almost say that 
>> >   you should just always skip . and .. since if you
>> >   want them, you know they are there, and otherwise
>> >   they are just an invitation to infinite loops.)
>> >
>> Even some combination with glob or fcntl may be nice and
>> returning stuff in glib data structures; which obviously
>> is all 2.2 stuff if desired.
>
>Thinking about this, why don't we do:
>
> g_dir_open (const gchar *path, guint flags, GError **error);
>
Done.

>With @flags being reserved for the future. And make g_dir_read_name()
>_not_ return "." and "..", since it is never useful to include
>them while listing a directory. If we are going to tell people
>to use g_dir_open() not opendir() on Unix, there at least should be _some_
>advantage of DIR *.
>
Done.
Isn't being porting-friendly not enough :-)

>We can later add G_DIR_INCLUDE_DOTDOT, G_DIR_SKIP_HIDDEN or whatever
>if that proves necessary.
> 
> [...]
>
>With that in mind, I think it would be better not to include the
>GError * here. Also, I think we should omit the GError * from
>g_dir_close(), because again there are no likely errors that would
>occur when using closedir through GDir. The two ones I saw in a survey
>of manual pages were:
>
> EBADF:  Bad file descriptor
> EINVAL: Mixed 32 and 64 operations on the same descriptor
>     
>Both are not going to happen with GDir.
>
Done.

Thanks a lot,

	Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to 
get along without it.                -- Dilbert



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