Author: hwright
Date: Tue Jul 13 12:43:55 2010
New Revision: 963697

URL: http://svn.apache.org/viewvc?rev=963697&view=rev
Log:
Prevent API proliferation!

Deprecate the svn_io_get_dir_filenames() API, whose job can now be done by
svn_io_get_dirents3(), with the only_check_type parameter set to TRUE.
Specifically, the latter now avoids an extra stat() call on most platforms,
which was the purpose of svn_io_get_dir_filenames() to begin with.
(See r857526.)

* subversion/libsvn_subr/io.c
  (svn_io_get_dir_filenames): Make this a wrapper around get_dirents3().

* subversion/include/svn_io.h
  (svn_io_get_dir_filenames): Deprecate.

Modified:
    subversion/trunk/subversion/include/svn_io.h
    subversion/trunk/subversion/libsvn_subr/io.c

Modified: subversion/trunk/subversion/include/svn_io.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_io.h?rev=963697&r1=963696&r2=963697&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_io.h (original)
+++ subversion/trunk/subversion/include/svn_io.h Tue Jul 13 12:43:55 2010
@@ -1371,7 +1371,9 @@ svn_io_remove_dir(const char *path,
  * apr_dir_read() are NOT returned in the hash.
  *
  * @since New in 1.4.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_io_get_dir_filenames(apr_hash_t **dirents,
                          const char *path,

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=963697&r1=963696&r2=963697&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Tue Jul 13 12:43:55 2010
@@ -1976,44 +1976,8 @@ svn_io_get_dir_filenames(apr_hash_t **di
                          const char *path,
                          apr_pool_t *pool)
 {
-  apr_status_t status;
-  apr_dir_t *this_dir;
-  apr_finfo_t this_entry;
-  apr_int32_t flags = APR_FINFO_NAME;
-
-  *dirents = apr_hash_make(pool);
-
-  SVN_ERR(svn_io_dir_open(&this_dir, path, pool));
-
-  for (status = apr_dir_read(&this_entry, flags, this_dir);
-       status == APR_SUCCESS;
-       status = apr_dir_read(&this_entry, flags, this_dir))
-    {
-      if ((this_entry.name[0] == '.')
-          && ((this_entry.name[1] == '\0')
-              || ((this_entry.name[1] == '.')
-                  && (this_entry.name[2] == '\0'))))
-        {
-          continue;
-        }
-      else
-        {
-          const char *name;
-          SVN_ERR(entry_name_to_utf8(&name, this_entry.name, path, pool));
-          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, name);
-        }
-    }
-
-  if (! (APR_STATUS_IS_ENOENT(status)))
-    return svn_error_wrap_apr(status, _("Can't read directory '%s'"),
-                              svn_dirent_local_style(path, pool));
-
-  status = apr_dir_close(this_dir);
-  if (status)
-    return svn_error_wrap_apr(status, _("Error closing directory '%s'"),
-                              svn_dirent_local_style(path, pool));
-
-  return SVN_NO_ERROR;
+  return svn_error_return(svn_io_get_dirents3(dirents, path, TRUE,
+                                              pool, pool));
 }
 
 svn_io_dirent2_t *


Reply via email to