### This patch is not intended to be committed. This patch gives examples of converting uses of "assert" and "abort" to the new SVN_ERR_ASSERT and SVN_ERR_MALFUNCTION macros respectively. * subversion/libsvn_client/commit.c (svn_client_commit4): * subversion/libsvn_client/merge.c (calculate_left_hand_side): * subversion/libsvn_diff/diff_file.c (output_conflict): * subversion/libsvn_diff/diff_memory.c (output_conflict): * subversion/libsvn_diff/token.c (svn_diff__tree_insert_token): * subversion/libsvn_fs_base/trail.c (begin_trail): * subversion/libsvn_fs_base/tree.c (dag_node_cache_set): (make_path_mutable): (txn_body_copy): * subversion/libsvn_fs_fs/dag.c (svn_fs_fs__dag_clone_root): * subversion/libsvn_fs/fs-loader.c (default_warning_func): * subversion/libsvn_fs_fs/tree.c (make_path_mutable): (merge_changes): (copy_helper): * subversion/libsvn_ra_neon/fetch.c (end_element): * subversion/libsvn_ra_neon/replay.c (start_element): * subversion/libsvn_ra_serf/commit.c (absent_directory): (absent_file): (close_edit): Index: subversion/libsvn_client/commit.c =================================================================== --- subversion/libsvn_client/commit.c (revision 31761) +++ subversion/libsvn_client/commit.c (working copy) @@ -1550,10 +1550,8 @@ svn_client_commit4(svn_commit_info_t **c while (strcmp(target, base_dir) != 0) { - if ((target[0] == '\0') || - svn_dirent_is_root(target, strlen(target)) - ) - abort(); + SVN_ERR_ASSERT((target[0] != '\0') && + !svn_dirent_is_root(target, strlen(target))); APR_ARRAY_PUSH(dirs_to_lock, const char *) = apr_pstrdup(pool, target); Index: subversion/libsvn_client/merge.c =================================================================== --- subversion/libsvn_client/merge.c (revision 31761) +++ subversion/libsvn_client/merge.c (working copy) @@ -5769,7 +5769,7 @@ calculate_left_hand_side(const char **ur } /* We only got here because we had mergeinfo for the source; if there were no segments, then our logic was wrong. */ - abort(); + SVN_ERR_MALFUNCTION(); } else { Index: subversion/libsvn_diff/diff_file.c =================================================================== --- subversion/libsvn_diff/diff_file.c (revision 31761) +++ subversion/libsvn_diff/diff_file.c (working copy) @@ -1671,7 +1671,7 @@ output_conflict(void *baton, else if (style == svn_diff_conflict_display_latest) SVN_ERR(output_hunk(baton, 2, latest_start, latest_length)); else /* unknown style */ - abort(); + SVN_ERR_MALFUNCTION(); return SVN_NO_ERROR; } Index: subversion/libsvn_diff/diff_memory.c =================================================================== --- subversion/libsvn_diff/diff_memory.c (revision 31761) +++ subversion/libsvn_diff/diff_memory.c (working copy) @@ -841,7 +841,7 @@ output_conflict(void *baton, SVN_ERR(output_merge_token_range(NULL, btn, 2/*latest*/, latest_start, latest_length)); else /* unknown style */ - abort(); + SVN_ERR_MALFUNCTION(); return SVN_NO_ERROR; } Index: subversion/libsvn_diff/token.c =================================================================== --- subversion/libsvn_diff/token.c (revision 31761) +++ subversion/libsvn_diff/token.c (working copy) @@ -74,8 +74,7 @@ svn_diff__tree_insert_token(svn_diff__no svn_diff__node_t *parent; int rv; - if (!token) - abort(); + SVN_ERR_ASSERT(token); parent = NULL; node_ref = &tree->root[hash % SVN_DIFF__HASH_SIZE]; Index: subversion/libsvn_fs_base/trail.c =================================================================== --- subversion/libsvn_fs_base/trail.c (revision 31761) +++ subversion/libsvn_fs_base/trail.c (working copy) @@ -89,8 +89,7 @@ begin_trail(trail_t **trail_p, /* [*] If we're already inside a trail operation, abort() -- this is a coding problem (and will likely hang the repository anyway). */ - if (bfd->in_txn_trail) - abort(); + SVN_ERR_ASSERT(bfd->in_txn_trail); SVN_ERR(BDB_WRAP(fs, "beginning Berkeley DB transaction", bfd->bdb->env->txn_begin(bfd->bdb->env, 0, Index: subversion/libsvn_fs_base/tree.c =================================================================== --- subversion/libsvn_fs_base/tree.c (revision 31761) +++ subversion/libsvn_fs_base/tree.c (working copy) @@ -208,7 +208,7 @@ dag_node_cache_set(svn_fs_root_t *root, ### is. And I don't want to spend any more time on it. So, ### callers, use only revision root and don't try to update ### an already-cached thing. -- cmpilato */ - abort(); + SVN_ERR_MALFUNCTION(); #if 0 int cache_index = cache_item->idx; @@ -827,7 +827,7 @@ make_path_mutable(svn_fs_root_t *root, case copy_id_inherit_unknown: default: - abort(); /* uh-oh -- somebody didn't calculate copy-ID + SVN_ERR_MALFUNCTION(); /* uh-oh -- somebody didn't calculate copy-ID inheritance data. */ } @@ -2970,7 +2970,7 @@ txn_body_copy(void *baton, stated that this requirement need not be necessary in the future. */ - abort(); + SVN_ERR_MALFUNCTION(); } return SVN_NO_ERROR; Index: subversion/libsvn_fs_fs/dag.c =================================================================== --- subversion/libsvn_fs_fs/dag.c (revision 31761) +++ subversion/libsvn_fs_fs/dag.c (working copy) @@ -722,10 +722,7 @@ svn_fs_fs__dag_clone_root(dag_node_t **r /* Oh, give me a clone... (If they're the same, we haven't cloned the transaction's root directory yet.) */ - if (svn_fs_fs__id_eq(root_id, base_root_id)) - { - abort(); - } + SVN_ERR_ASSERT(!svn_fs_fs__id_eq(root_id, base_root_id)); /* One way or another, root_id now identifies a cloned root node. */ SVN_ERR(svn_fs_fs__dag_get_node(root_p, fs, root_id, pool)); Index: subversion/libsvn_fs/fs-loader.c =================================================================== --- subversion/libsvn_fs/fs-loader.c (revision 31761) +++ subversion/libsvn_fs/fs-loader.c (working copy) @@ -321,7 +321,7 @@ default_warning_func(void *baton, svn_er /* The one unforgiveable sin is to fail silently. Dumping to stderr or /dev/tty is not acceptable default behavior for server processes, since those may both be equivalent to /dev/null. */ - abort(); + SVN_ERR_MALFUNCTION(); } /* This API is publicly deprecated, but we continue to use it Index: subversion/libsvn_fs_fs/tree.c =================================================================== --- subversion/libsvn_fs_fs/tree.c (revision 31761) +++ subversion/libsvn_fs_fs/tree.c (working copy) @@ -755,7 +755,7 @@ make_path_mutable(svn_fs_root_t *root, case copy_id_inherit_unknown: default: - abort(); /* uh-oh -- somebody didn't calculate copy-ID + SVN_ERR_MALFUNCTION(); /* uh-oh -- somebody didn't calculate copy-ID inheritance data. */ } @@ -1608,7 +1608,7 @@ merge_changes(dag_node_t *ancestor_node, /* ### kff todo: this would, of course, be a mighty silly thing for the caller to do, and we might want to consider whether this response is really appropriate. */ - abort(); + SVN_ERR_MALFUNCTION(); } else SVN_ERR(merge(conflict, "/", txn_root_node, @@ -2102,7 +2102,7 @@ copy_helper(svn_fs_root_t *from_root, stated that this requirement need not be necessary in the future. */ - abort(); + SVN_ERR_MALFUNCTION(); } return SVN_NO_ERROR; Index: subversion/libsvn_ra_neon/fetch.c =================================================================== --- subversion/libsvn_ra_neon/fetch.c (revision 31761) +++ subversion/libsvn_ra_neon/fetch.c (working copy) @@ -2115,10 +2115,9 @@ end_element(void *userdata, int state, } else { - SVN_ERR(svn_error_createf(SVN_ERR_XML_UNKNOWN_ENCODING, NULL, - _("Unknown XML encoding: '%s'"), - rb->encoding->data)); - abort(); /* Not reached. */ + return svn_error_createf(SVN_ERR_XML_UNKNOWN_ENCODING, NULL, + _("Unknown XML encoding: '%s'"), + rb->encoding->data); } /* Set the prop. */ Index: subversion/libsvn_ra_neon/replay.c =================================================================== --- subversion/libsvn_ra_neon/replay.c (revision 31761) +++ subversion/libsvn_ra_neon/replay.c (working copy) @@ -216,7 +216,7 @@ start_element(int *elem, void *baton, in &dir_baton)); } else - abort(); + SVN_ERR_MALFUNCTION(); push_dir(rb, dir_baton, name, subpool); } Index: subversion/libsvn_ra_serf/commit.c =================================================================== --- subversion/libsvn_ra_serf/commit.c (revision 31761) +++ subversion/libsvn_ra_serf/commit.c (working copy) @@ -1533,7 +1533,7 @@ absent_directory(const char *path, dir_context_t *ctx = parent_baton; #endif - abort(); + SVN_ERR_MALFUNCTION(); } static svn_error_t * @@ -1896,7 +1896,7 @@ absent_file(const char *path, dir_context_t *ctx = parent_baton; #endif - abort(); + SVN_ERR_MALFUNCTION(); } static svn_error_t * @@ -1925,7 +1925,7 @@ close_edit(void *edit_baton, if (svn_ra_serf__merge_get_status(merge_ctx) != 200) { - abort(); + SVN_ERR_MALFUNCTION(); } /* Inform the WC that we did a commit. */ @@ -1949,10 +1949,7 @@ close_edit(void *edit_baton, SVN_ERR(svn_ra_serf__context_run_wait(&delete_ctx->done, ctx->session, pool)); - if (delete_ctx->status != 204) - { - abort(); - } + SVN_ERR_ASSERT(delete_ctx->status == 204); return SVN_NO_ERROR; }