Mail Archives: djgpp-workers/2001/10/11/14:52:17
> > In this case I would say pass back a known "already closed" handle so
> > the _findclose() is a no operation. If the handle is "finished" it would
> > be useless anyway.
>
> Is that solution really safe ? I don't know if this would really be useful
> but one could imagine something like:
>
> handle = _findfirst("*.dat", &fileinfo);
>
> while (number_of_dat_file < 100) {
> if (_findnext(handle, &fileinfo) == 0)
> number_of_dat_file++;
> else
> create_new_dat_file();
> }
>
> _findclose(handle);
Let me clarify - if the handle is still open and valid, it should be
returned so _findclose could clean it up. You had asked about the
question of when our internal findfirst closes the handle for you
because there were no wild cards. In that case _findclose would be
able to recognize it as already being closed and do nothing.
> > If you have to put special handling code in the library you end up having
> > to patch multiple places instead of a single location (we have a nightmare
> > in our seek implementations today).
>
> I agree that's not the funniest thing to deal with (may I let you remark
> though that the same situation already exists for libc/dos/dir/findfir.c and
> libc/dos/compat/d_findf.c, same thing for src/libc/dos/dir/findnext.c and
> src/libc/dos/compat/d_findf.c ?)
I'm not happy about a lot of these. Given time I'd like to clean them up,
but until then not making it any worse is a good thing :-)
> Then I think a better solution than a high-level wrapper could be a
> low-level wrapper on top of which both findfirst() and _findfirst() woud
> live: it would be as close as possible to the DOS functions (DOS time
> format, handle exposed, no automatic release of the handle). But it would
> mean three more files because of the 'one function per file' rule.
This may be the best fix. I believe Eli also said this might be the way
to go. However, it depends on how much time and effort you are willing to
spend. I personally would not object to putting your current versions
into the the library. Consider the discussion as suggestions for
improvement.
- Raw text -