Author: julianfoad
Date: Tue Oct 11 14:16:20 2011
New Revision: 1181800

URL: http://svn.apache.org/viewvc?rev=1181800&view=rev
Log:
Introduce the symbolic link as a node type, defining a new 'svn_kind_t'
enumeration to replace 'svn_node_kind_t'.

* subversion/include/svn_types.h
  (svn_boolean_t): Move higher up the file so we can reference it.
  (svn_kind_t): New type.
  (svn__node_kind_from_kind, svn__kind_from_node_kind): New functions.

* subversion/libsvn_subr/kitchensink.c
  (svn__node_kind_from_kind, svn__kind_from_node_kind): New functions.

Modified:
    subversion/trunk/subversion/include/svn_types.h
    subversion/trunk/subversion/libsvn_subr/kitchensink.c

Modified: subversion/trunk/subversion/include/svn_types.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1181800&r1=1181799&r2=1181800&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_types.h (original)
+++ subversion/trunk/subversion/include/svn_types.h Tue Oct 11 14:16:20 2011
@@ -81,6 +81,22 @@ extern "C" {
 # endif
 #endif
 
+
+
+/** YABT:  Yet Another Boolean Type */
+typedef int svn_boolean_t;
+
+#ifndef TRUE
+/** uhh... true */
+#define TRUE 1
+#endif /* TRUE */
+
+#ifndef FALSE
+/** uhh... false */
+#define FALSE 0
+#endif /* FALSE */
+
+
 
 /** Subversion error object.
  *
@@ -188,7 +204,33 @@ svn__apr_hash_index_val(const apr_hash_i
 
 /** @} */
 
-/** The various types of nodes in the Subversion filesystem. */
+/** A node kind.
+ *
+ * @since New in 1.8. Replaces svn_node_kind_t.
+ */
+typedef enum svn_kind_t
+{
+  /** something's here, but we don't know what */
+  svn_kind_unknown,
+
+  /** absent */
+  svn_kind_none,
+
+  /** regular file */
+  svn_kind_file,
+
+  /** directory */
+  svn_kind_dir,
+
+  /** symbolic link */
+  svn_kind_symlink
+
+} svn_kind_t;
+
+/** The various types of nodes in the Subversion filesystem.
+ *
+ * This type is superseded by #svn_kind_t and will be deprecated when
+ * transition to the new type is complete. */
 typedef enum svn_node_kind_t
 {
   /** absent */
@@ -223,6 +265,24 @@ svn_node_kind_to_word(svn_node_kind_t ki
 svn_node_kind_t
 svn_node_kind_from_word(const char *word);
 
+/** Return the #svn_node_kind_t corresponding to the given #svn_kind_t;
+ * #svn_kind_symlink will become #svn_node_file.
+ *
+ * @since New in 1.8.
+ */
+svn_node_kind_t
+svn__node_kind_from_kind(svn_kind_t kind);
+
+/** Return the #svn_kind_t corresponding to the given #svn_node_kind_t,
+ * or #svn_kind_symlink if @a is_symlink is true.
+ *
+ * @since New in 1.8.
+ */
+svn_kind_t
+svn__kind_from_node_kind(svn_node_kind_t kind,
+                         svn_boolean_t is_symlink);
+
+
 /** Generic three-state property to represent an unknown value for values
  * that are just like booleans.  The values have been set deliberately to
  * make tristates disjoint from #svn_boolean_t.
@@ -356,20 +416,6 @@ typedef apr_int64_t svn_filesize_t;
 #endif
 
 
-/** YABT:  Yet Another Boolean Type */
-typedef int svn_boolean_t;
-
-#ifndef TRUE
-/** uhh... true */
-#define TRUE 1
-#endif /* TRUE */
-
-#ifndef FALSE
-/** uhh... false */
-#define FALSE 0
-#endif /* FALSE */
-
-
 /** An enum to indicate whether recursion is needed. */
 enum svn_recurse_kind
 {

Modified: subversion/trunk/subversion/libsvn_subr/kitchensink.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/kitchensink.c?rev=1181800&r1=1181799&r2=1181800&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/kitchensink.c (original)
+++ subversion/trunk/subversion/libsvn_subr/kitchensink.c Tue Oct 11 14:16:20 
2011
@@ -120,6 +120,37 @@ svn_depth_from_word(const char *word)
   return svn_depth_unknown;
 }
 
+svn_node_kind_t
+svn__node_kind_from_kind(svn_kind_t kind)
+{
+  switch (kind)
+    {
+    case svn_kind_unknown:  return svn_node_unknown;
+    case svn_kind_none:     return svn_node_none;
+    case svn_kind_file:     return svn_node_file;
+    case svn_kind_dir:      return svn_node_dir;
+    case svn_kind_symlink:  return svn_node_file;
+    default: SVN_ERR_MALFUNCTION_NO_RETURN();
+    }
+}
+
+svn_kind_t
+svn__kind_from_node_kind(svn_node_kind_t kind,
+                         svn_boolean_t is_symlink)
+{
+  if (is_symlink)
+    return svn_kind_symlink;
+
+  switch (kind)
+    {
+    case svn_node_unknown:  return svn_kind_unknown;
+    case svn_node_none:     return svn_kind_none;
+    case svn_node_file:     return svn_kind_file;
+    case svn_node_dir:      return svn_kind_dir;
+    default: SVN_ERR_MALFUNCTION_NO_RETURN();
+    }
+}
+
 const char *
 svn_node_kind_to_word(svn_node_kind_t kind)
 {


Reply via email to