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

[PATCH] Remove redundant svn_error_return() wrapper

From: Noorul Islam K M <noorul_at_collab.net>
Date: Thu, 18 Nov 2010 16:51:50 +0530

Log

[[[

Remove redundant svn_error_return() wrapper

* subversion/svn/patch-cmd.c,
  subversion/svn/revert-cmd.c,
  subversion/svn/log-cmd.c,
  subversion/svn/changelist-cmd.c,
  subversion/svn/resolved-cmd.c,
  subversion/svn/cleanup-cmd.c,
  subversion/svn/upgrade-cmd.c,
  subversion/svn/add-cmd.c,
  subversion/svn/relocate-cmd.c,
  subversion/svn/import-cmd.c,
  subversion/svn/resolve-cmd.c,
  subversion/svn/export-cmd.c,
  subversion/svn/status-cmd.c,
  subversion/libsvn_client/export.c,
  subversion/libsvn_client/status.c,
  subversion/libsvn_client/patch.c,
  subversion/libsvn_client/merge.c,
  subversion/libsvn_client/revert.c,
  subversion/libsvn_client/log.c,
  subversion/libsvn_client/changelist.c,
  subversion/libsvn_client/resolved.c,
  subversion/libsvn_client/cleanup.c,
  subversion/libsvn_client/commit.c,
  subversion/libsvn_client/add.c
  
  (svn_cl__patch, svn_cl__revert, svn_cl__log,
   svn_cl__changelist, svn_cl__resolved, svn_cl__cleanup,
   svn_cl__upgrade, svn_cl__add, svn_cl__relocate,
   svn_cl__import, svn_cl__resolve, svn_cl__export,
   svn_cl__status, svn_client_export5, svn_client_status5,
   svn_client_patch, svn_client_merge4, svn_client_revert2,
   svn_client_log5, svn_client_add_to_changelist,
   svn_client_remove_from_changelists, svn_client_resolve,
   svn_client_cleanup, svn_client_commit5, svn_client_add4):

   Remove redundant svn_error_return() wrapper. Also add blank line
   before/after 'if' block where ever required.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>

]]]

Thanks and Regards
Noorul

Index: subversion/svn/patch-cmd.c
===================================================================
--- subversion/svn/patch-cmd.c (revision 1036324)
+++ subversion/svn/patch-cmd.c (working copy)
@@ -66,11 +66,11 @@
     return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, 0, NULL);
 
   patch_path = APR_ARRAY_IDX(targets, 0, const char *);
+
   if (svn_path_is_url(patch_path))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- patch_path));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), patch_path);
+
   SVN_ERR(svn_dirent_get_absolute(&abs_patch_path, patch_path, pool));
 
   if (targets->nelts == 1)
@@ -78,11 +78,10 @@
   else
     {
       target_path = APR_ARRAY_IDX(targets, 1, const char *);
+
       if (svn_path_is_url(target_path))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target_path));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target_path);
     }
   SVN_ERR(svn_dirent_get_absolute(&abs_target_path, target_path, pool));
 
Index: subversion/svn/revert-cmd.c
===================================================================
--- subversion/svn/revert-cmd.c (revision 1036324)
+++ subversion/svn/revert-cmd.c (working copy)
@@ -72,10 +72,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
 
   err = svn_client_revert2(targets, opt_state->depth,
Index: subversion/svn/log-cmd.c
===================================================================
--- subversion/svn/log-cmd.c (revision 1036324)
+++ subversion/svn/log-cmd.c (working copy)
@@ -647,12 +647,12 @@
           target = APR_ARRAY_IDX(targets, i, const char *);
 
           if (svn_path_is_url(target) || target[0] == '/')
- return svn_error_return(svn_error_createf(
- SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Only relative paths can be specified"
- " after a URL for 'svn log', "
- "but '%s' is not a relative path"),
- target));
+ return svn_error_createf(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Only relative paths can be specified"
+ " after a URL for 'svn log', "
+ "but '%s' is not a relative path"),
+ target);
         }
     }
 
Index: subversion/svn/changelist-cmd.c
===================================================================
--- subversion/svn/changelist-cmd.c (revision 1036324)
+++ subversion/svn/changelist-cmd.c (working copy)
@@ -76,10 +76,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
 
   if (opt_state->quiet)
Index: subversion/svn/resolved-cmd.c
===================================================================
--- subversion/svn/resolved-cmd.c (revision 1036324)
+++ subversion/svn/resolved-cmd.c (working copy)
@@ -71,10 +71,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
   
   iterpool = svn_pool_create(scratch_pool);
Index: subversion/svn/cleanup-cmd.c
===================================================================
--- subversion/svn/cleanup-cmd.c (revision 1036324)
+++ subversion/svn/cleanup-cmd.c (working copy)
@@ -64,10 +64,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
 
   SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
Index: subversion/svn/upgrade-cmd.c
===================================================================
--- subversion/svn/upgrade-cmd.c (revision 1036324)
+++ subversion/svn/upgrade-cmd.c (working copy)
@@ -67,10 +67,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
 
   iterpool = svn_pool_create(scratch_pool);
Index: subversion/svn/add-cmd.c
===================================================================
--- subversion/svn/add-cmd.c (revision 1036324)
+++ subversion/svn/add-cmd.c (working copy)
@@ -71,10 +71,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
 
   iterpool = svn_pool_create(pool);
Index: subversion/svn/relocate-cmd.c
===================================================================
--- subversion/svn/relocate-cmd.c (revision 1036324)
+++ subversion/svn/relocate-cmd.c (working copy)
@@ -97,8 +97,20 @@
           apr_pool_t *subpool = svn_pool_create(scratch_pool);
           int i;
 
+ /* Target working copy root dir must be local. */
           for (i = 2; i < targets->nelts; i++)
             {
+ path = APR_ARRAY_IDX(targets, i, const char *);
+ if (svn_path_is_url(path))
+ return svn_error_return
+ (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
+ NULL,
+ _("'%s' is not a local path"),
+ path));
+ }
+
+ for (i = 2; i < targets->nelts; i++)
+ {
               svn_pool_clear(subpool);
               path = APR_ARRAY_IDX(targets, i, const char *);
               SVN_ERR(svn_client_relocate2(path, from, to, ignore_externals,
Index: subversion/svn/import-cmd.c
===================================================================
--- subversion/svn/import-cmd.c (revision 1036324)
+++ subversion/svn/import-cmd.c (working copy)
@@ -101,10 +101,9 @@
     }
 
   if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), path);
+
   if (! svn_path_is_url(url))
     return svn_error_createf
       (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
Index: subversion/svn/resolve-cmd.c
===================================================================
--- subversion/svn/resolve-cmd.c (revision 1036324)
+++ subversion/svn/resolve-cmd.c (working copy)
@@ -101,10 +101,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
   
   iterpool = svn_pool_create(scratch_pool);
Index: subversion/svn/export-cmd.c
===================================================================
--- subversion/svn/export-cmd.c (revision 1036324)
+++ subversion/svn/export-cmd.c (working copy)
@@ -86,10 +86,9 @@
     }
 
   if (svn_path_is_url(to))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- to));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), to);
+
   if (! opt_state->quiet)
     SVN_ERR(svn_cl__notifier_mark_export(ctx->notify_baton2));
 
Index: subversion/svn/status-cmd.c
===================================================================
--- subversion/svn/status-cmd.c (revision 1036324)
+++ subversion/svn/status-cmd.c (working copy)
@@ -255,10 +255,8 @@
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
 
       if (svn_path_is_url(target))
- return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("'%s' is not a local path"),
- target));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a local path"), target);
     }
 
   /* We want our -u statuses to be against HEAD. */
Index: subversion/libsvn_client/export.c
===================================================================
--- subversion/libsvn_client/export.c (revision 1036324)
+++ subversion/libsvn_client/export.c (working copy)
@@ -948,9 +948,8 @@
   SVN_ERR_ASSERT(revision != NULL);
 
   if (svn_path_is_url(to_path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a local path"),
- to_path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), to_path);
     
   peg_revision = svn_cl__rev_default_to_head_or_working(peg_revision,
                                                         from_path_or_url);
Index: subversion/libsvn_client/status.c
===================================================================
--- subversion/libsvn_client/status.c (revision 1036324)
+++ subversion/libsvn_client/status.c (working copy)
@@ -270,9 +270,8 @@
   struct svn_client__external_func_baton_t externals_store = { NULL };
 
   if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
 
   if (changelists && changelists->nelts)
     SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists, pool));
Index: subversion/libsvn_client/patch.c
===================================================================
--- subversion/libsvn_client/patch.c (revision 1036324)
+++ subversion/libsvn_client/patch.c (working copy)
@@ -2754,10 +2754,8 @@
                             _("strip count must be positive"));
 
   if (svn_path_is_url(local_abspath))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET,
- NULL,
- _("'%s' is not a local path"),
- local_abspath));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), local_abspath);
 
   baton.patch_abspath = patch_abspath;
   baton.abs_wc_path = local_abspath;
Index: subversion/libsvn_client/merge.c
===================================================================
--- subversion/libsvn_client/merge.c (revision 1036324)
+++ subversion/libsvn_client/merge.c (working copy)
@@ -8658,11 +8658,11 @@
 
   SVN_ERR(svn_wc_read_kind(&target_kind, ctx->wc_ctx, target_abspath, FALSE,
                            pool));
+
   if (target_kind != svn_node_dir && target_kind != svn_node_file)
- return svn_error_return(svn_error_createf(
- SVN_ERR_ILLEGAL_TARGET, NULL,
- _("Merge target '%s' does not exist in the "
- "working copy"), target_abspath));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Merge target '%s' does not exist in the "
+ "working copy"), target_abspath);
 
   /* Ensure a known depth. */
   if (depth == svn_depth_unknown)
@@ -9124,10 +9124,11 @@
       || (revision2->kind == svn_opt_revision_unspecified))
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL,
                             _("Not all required revisions are specified"));
+
   if (svn_path_is_url(source1) != svn_path_is_url(source2))
- return svn_error_return(svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("Merge sources must both be "
- "either paths or URLs")));
+ return svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Merge sources must both be "
+ "either paths or URLs"));
 
   /* ### FIXME: This function really ought to do a history check on
      the left and right sides of the merge source, and -- if one is an
@@ -9157,13 +9158,12 @@
 
   SVN_ERR(svn_wc_read_kind(&target_kind, ctx->wc_ctx, target_abspath, FALSE,
                            scratch_pool));
+
   if (target_kind != svn_node_dir && target_kind != svn_node_file)
- return svn_error_return(svn_error_createf(
- SVN_ERR_ILLEGAL_TARGET, NULL,
- _("Merge target '%s' does not exist in the "
- "working copy"), target_abspath));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Merge target '%s' does not exist in the "
+ "working copy"), target_abspath);
 
-
   /* Do not allow merges into mixed-revision working copies. */
   SVN_ERR(ensure_wc_is_suitable_merge_target(target_abspath, ctx,
                                              allow_mixed_rev, TRUE, TRUE,
Index: subversion/libsvn_client/revert.c
===================================================================
--- subversion/libsvn_client/revert.c (revision 1036324)
+++ subversion/libsvn_client/revert.c (working copy)
@@ -130,10 +130,8 @@
       const char *path = APR_ARRAY_IDX(paths, i, const char *);
 
       if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET,
- NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
     }
   
   cfg = ctx->config ? apr_hash_get(ctx->config, SVN_CONFIG_CATEGORY_CONFIG,
Index: subversion/libsvn_client/log.c
===================================================================
--- subversion/libsvn_client/log.c (revision 1036324)
+++ subversion/libsvn_client/log.c (working copy)
@@ -395,11 +395,12 @@
               const char *target;
 
               target = APR_ARRAY_IDX(targets, i, const char *);
+
               if (svn_path_is_url(target) || svn_dirent_is_absolute(target))
- return svn_error_return(svn_error_createf(
- SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a relative path"),
- target));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a relative path"),
+ target);
+
               APR_ARRAY_PUSH(condensed_targets, const char *) = target;
             }
         }
Index: subversion/libsvn_client/changelist.c
===================================================================
--- subversion/libsvn_client/changelist.c (revision 1036324)
+++ subversion/libsvn_client/changelist.c (working copy)
@@ -114,11 +114,10 @@
   for (i = 0; i < paths->nelts; i++)
     {
       const char *path = APR_ARRAY_IDX(paths, i, const char *);
+
       if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET,
- NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
     }
 
   if (changelists && changelists->nelts)
@@ -166,11 +165,10 @@
   for (i = 0; i < paths->nelts; i++)
     {
       const char *path = APR_ARRAY_IDX(paths, i, const char *);
+
       if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET,
- NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
     }
 
   if (changelists && changelists->nelts)
Index: subversion/libsvn_client/resolved.c
===================================================================
--- subversion/libsvn_client/resolved.c (revision 1036324)
+++ subversion/libsvn_client/resolved.c (working copy)
@@ -50,9 +50,8 @@
   const char *local_abspath;
 
   if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
 
Index: subversion/libsvn_client/cleanup.c
===================================================================
--- subversion/libsvn_client/cleanup.c (revision 1036324)
+++ subversion/libsvn_client/cleanup.c (working copy)
@@ -52,9 +52,8 @@
   svn_error_t *err;
 
   if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
 
@@ -130,9 +129,8 @@
   info_baton.last_uuid = NULL;
 
   if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
   SVN_ERR(svn_wc_upgrade(ctx->wc_ctx, local_abspath,
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c (revision 1036324)
+++ subversion/libsvn_client/commit.c (working copy)
@@ -697,9 +697,8 @@
   apr_pool_t *subpool;
 
   if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
   base_dir_abspath = local_abspath;
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 1036324)
+++ subversion/libsvn_client/add.c (working copy)
@@ -576,9 +576,8 @@
   struct add_with_write_lock_baton baton;
 
   if (svn_path_is_url(path))
- return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a local path"),
- path));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"), path);
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
 
Received on 2010-11-18 12:24:30 CET

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