You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/10/18 11:12:46 UTC

svn commit: r1185542 - in /subversion/trunk/subversion: bindings/swig/svn_wc.i include/svn_wc.h libsvn_wc/deprecated.c libsvn_wc/externals.c libsvn_wc/util.c

Author: julianfoad
Date: Tue Oct 18 09:12:42 2011
New Revision: 1185542

URL: http://svn.apache.org/viewvc?rev=1185542&view=rev
Log:
Rev the svn_wc_external_item_create() API to not return a 'const' pointer,
since the caller needs to initialize the newly created item.

* subversion/include/svn_wc.h
  (svn_wc_external_item2_create): New.
  (svn_wc_external_item_create): Deprecate.

* subversion/libsvn_wc/externals.c
  (svn_wc_parse_externals_description3): Use the new function and remove
    'const' casts.

* subversion/libsvn_wc/util.c
  (svn_wc_external_item2_create): New.
  (svn_wc_external_item_create): Move from here ...

* subversion/libsvn_wc/deprecated.c
  (svn_wc_external_item_create): ... to here.

* subversion/bindings/swig/svn_wc.i
  (svn_wc_external_item2_create): Ignore it, like we ignore its predecessor.
  (svn_wc_external_item2_t): Use the new function and remove 'const' casts.

Modified:
    subversion/trunk/subversion/bindings/swig/svn_wc.i
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/externals.c
    subversion/trunk/subversion/libsvn_wc/util.c

Modified: subversion/trunk/subversion/bindings/swig/svn_wc.i
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/svn_wc.i?rev=1185542&r1=1185541&r2=1185542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/svn_wc.i (original)
+++ subversion/trunk/subversion/bindings/swig/svn_wc.i Tue Oct 18 09:12:42 2011
@@ -45,6 +45,7 @@
 
 #ifdef SWIGRUBY
 %ignore svn_wc_external_item_create;
+%ignore svn_wc_external_item2_create;
 %ignore svn_wc_external_item_dup;
 %ignore svn_wc_external_item2_dup;
 %ignore svn_wc_revision_status;
@@ -268,11 +269,11 @@ svn_wc_swig_init_asp_dot_net_hack (apr_p
 {
   svn_wc_external_item2_t(apr_pool_t *pool) {
     svn_error_t *err;
-    const svn_wc_external_item2_t *self;
-    err = svn_wc_external_item_create(&self, pool);
+    svn_wc_external_item2_t *self;
+    err = svn_wc_external_item2_create(&self, pool);
     if (err)
       svn_swig_rb_handle_svn_error(err);
-    return (svn_wc_external_item2_t *)self;
+    return self;
   };
 
   ~svn_wc_external_item2_t() {

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1185542&r1=1185541&r2=1185542&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Oct 18 09:12:42 2011
@@ -781,7 +781,7 @@ svn_wc_traversed_depths(apr_hash_t **dep
  * canonicalized.
  *
  * In order to avoid backwards compatibility problems clients should use
- * svn_wc_external_item_create() to allocate and initialize this structure
+ * svn_wc_external_item2_create() to allocate and initialize this structure
  * instead of doing so themselves.
  *
  * @since New in 1.5.
@@ -822,8 +822,20 @@ typedef struct svn_wc_external_item2_t
  * The current implementation never returns error, but callers should
  * still check for error, for compatibility with future versions.
  *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_wc_external_item2_create(svn_wc_external_item2_t **item,
+                             apr_pool_t *pool);
+
+/* Same as svn_wc_external_item2_create() except the pointer to the new
+ * empty item is 'const' which is stupid since the next thing you need to do
+ * is fill in its fields.
+ *
+ * @deprecated Provided for backward compatibility with the 1.7 API.
  * @since New in 1.5.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_wc_external_item_create(const svn_wc_external_item2_t **item,
                             apr_pool_t *pool);

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1185542&r1=1185541&r2=1185542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Tue Oct 18 09:12:42 2011
@@ -3426,6 +3426,14 @@ svn_wc_get_switch_editor(svn_revnum_t *t
 }
 
 
+svn_error_t *
+svn_wc_external_item_create(const svn_wc_external_item2_t **item,
+                            apr_pool_t *pool)
+{
+  *item = apr_pcalloc(pool, sizeof(svn_wc_external_item2_t));
+  return SVN_NO_ERROR;
+}
+
 svn_wc_external_item_t *
 svn_wc_external_item_dup(const svn_wc_external_item_t *item,
                          apr_pool_t *pool)

Modified: subversion/trunk/subversion/libsvn_wc/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/externals.c?rev=1185542&r1=1185541&r2=1185542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/externals.c (original)
+++ subversion/trunk/subversion/libsvn_wc/externals.c Tue Oct 18 09:12:42 2011
@@ -201,8 +201,7 @@ svn_wc_parse_externals_description3(apr_
       for (num_line_parts = 0; line_parts[num_line_parts]; num_line_parts++)
         ;
 
-      SVN_ERR(svn_wc_external_item_create
-              ((const svn_wc_external_item2_t **) &item, pool));
+      SVN_ERR(svn_wc_external_item2_create(&item, pool));
       item->revision.kind = svn_opt_revision_unspecified;
       item->peg_revision.kind = svn_opt_revision_unspecified;
 

Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=1185542&r1=1185541&r2=1185542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Tue Oct 18 09:12:42 2011
@@ -150,8 +150,8 @@ svn_wc_dup_notify(const svn_wc_notify_t 
 }
 
 svn_error_t *
-svn_wc_external_item_create(const svn_wc_external_item2_t **item,
-                            apr_pool_t *pool)
+svn_wc_external_item2_create(svn_wc_external_item2_t **item,
+                             apr_pool_t *pool)
 {
   *item = apr_pcalloc(pool, sizeof(svn_wc_external_item2_t));
   return SVN_NO_ERROR;