[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: proposal to add apr_check_dir_empty() to APR

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2002-07-02 22:36:04 CEST

"Ryan Bloom" <rbb@covalent.net> writes:
> The docs may say that, but the code doesn't do anything about "." and
> "..". I just double-checked unix/dir.c. :-( I actually remember
> looking at this years ago when I wrote the original code, and thinking
> through the "." and ".." problem, which is why I said that APR will
> return those two values first, but I don't think I ever actually coded
> it, and I'm not sure how it would be done.

Heh! Pardon me while I feel smug :-)...

I also felt a bit suspicious about that promise, and therefore wrote
this code in Subversion a while back:

  for (err = svn_io_dir_read (&finfo, flags, dir, pool);
       err == SVN_NO_ERROR;
       svn_pool_clear (subpool),
         err = svn_io_dir_read (&finfo, flags, dir, pool))
      const char *this_path, *this_edit_path;

      if (finfo.filetype == APR_DIR)
          /* Skip entries for this dir and its parent.
             (APR promises that they'll come first, so technically
             this guard could be moved outside the loop. But somehow
             that feels iffy. */
          if (finfo.name[0] == '.'
              && (finfo.name[1] == '\0'
                  || (finfo.name[1] == '.' && finfo.name[2] == '\0')))




Anyway, will do something similar in apr_dir_check_empty().


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 2 22:45:35 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.