While working on changing some of the working copy library in Subversion, I'm trying to eliminate stat() calls (apr_stat()) in order to speed up overall operation.
Very often, Subversion libsvn_wc uses this pattern: svn_io_check_path() -> retrieves a path kind using apr_stat() if (kind == directory) do_dir_thing(); else do_file_thing(); Where dir and file thing could be just removal. The common case in the routines I'm looking at happens to be file removal. So, to reduce the number of stats, I want to replace the stat()+unlink() with a single unlink(), checking the result for certain types of failure. Reading the man 2 unlink page, EPERM is returned for POSIXy unices when deleting a directory, whereas EISDIR is returned on Linux. (MSDN isn't quite clear about Win32 behaviour...) Neither EPERM nor EISDIR have been categorised in any of the APR_STATUS_IS_* macros. I searched the mailing list archives at MARC, but found only an old mail by Branko which suggests this part of the error codes is unfinished business. Now, before I start working up any patches: Is that true, or is this missing with intent? Thanks! bye, Erik.