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

Re: [PATCH] svn_error_t * return value

From: Karl Fogel <kfogel_at_galois.collab.net>
Date: 2001-02-15 15:54:24 CET

Yoshiki Hayashi <yoshiki@xemacs.org> writes:
> Some more lightweight stuff. While I was reading, I noticed
> some functions use just 0 instead of SVN_NO_ERROR as their
> return values.

Thanks for noticing! I think this might have been a conscious
stylistic decision on JimB's part; will leave this patch for him to
apply or not.

> Skelton of ChangeLog is created by M-x patch-to-changelog. A
> little advertisement of XEmacs. :-)

Heh. I'll check it out -- something like that ought to work in both
Emaces.

-K

> * delta.c (delta_dirs):
> * delta.c (replace):
> * delta.c (replace_from_scratch):
> * delta.c (replace_related):
> * delta.c (add): abort (). This function is not implemented yet.
> * delta.c (delta_files):
> * delta.c (file_from_scratch):
> * delta.c (send_text_delta):
> * delta.c (delta_proplists):
> * delta.c (dir_from_scratch): abort (). This function is
> not implemented yet.
> * delta.c (svn_fs_file_delta):
> * err.c (svn_fs__wrap_db):
> * err.c (svn_fs__check_fs):
> * fs.c (check_already_open):
> * fs.c (cleanup_fs_db):
> * fs.c (cleanup_fs):
> * fs.c (allocate_env):
> * fs.c (svn_fs_create_berkeley):
> * fs.c (svn_fs_open_berkeley):
> * fs.c (svn_fs_berkeley_recover):
> * nodes-table.c (svn_fs__get_rep):
> * nodes-table.c (svn_fs__put_rep):
> * nodes-table.c (svn_fs__new_node_id):
> * nodes-table.c (svn_fs__new_successor_id):
> * rep.c (make_nodes):
> * rep.c (get_representation_skel):
> * rep.c (put_representation_skel):
> * rep.c (svn_fs__get_node_revision):
> * rep.c (new_node_id):
> * rep.c (svn_fs__create_node):
> * rep.c (new_successor_id):
> * rep.c (svn_fs__create_successor):
> * revision.c (get_revision_skel):
> * revision.c (svn_fs__revision_root):
> * revision.c (put_revision_skel):
> * revision.c (make_revisions):
> * trail.c (begin_trail):
> * trail.c (abort_trail):
> * trail.c (svn_fs__retry_txn):
> * tree.c (txn_body_node_prop):
> * tree.c (svn_fs_node_prop):
> * tree.c (txn_body_change_node_prop):
> * tree.c (svn_fs_change_node_prop):
> * tree.c (txn_body_delete):
> * txn-table.c (put_txn):
> * txn-table.c (allocate_txn_id):
> * txn-table.c (svn_fs__create_txn):
> * txn-table.c (svn_fs__get_txn):
> * txn-table.c (svn_fs__set_txn_root):
> Return SVN_NO_ERROR instead of 0 for uniformity and readability.
>
> Index: delta.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/delta.c,v
> retrieving revision 1.24
> diff -u -r1.24 delta.c
> --- delta.c 2001/02/12 00:26:13 1.24
> +++ delta.c 2001/02/15 05:47:31
> @@ -195,7 +195,7 @@
> }
> }
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -310,7 +310,7 @@
> source, source_path,
> source_entries[best]->name));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -352,7 +352,7 @@
>
> svn_fs_run_cleanup_node (c->pool, new);
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -429,7 +429,7 @@
> svn_fs_run_cleanup_node (c->pool, a);
> svn_fs_run_cleanup_node (c->pool, t);
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -455,6 +455,7 @@
> svn_fs_dir_t *target, svn_string_t *name)
> {
> /* ...; */
> + abort ();
> return SVN_NO_ERROR;
> }
>
> @@ -494,7 +495,7 @@
>
> svn_txdelta_free (delta_stream);
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -518,7 +519,7 @@
>
> svn_txdelta_free (delta_stream);
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -568,7 +569,7 @@
> while (window);
> }
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -658,7 +659,7 @@
> }
> }
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -671,6 +672,7 @@
> svn_fs_dir_t *target)
> {
> /* ...; */
> + abort ();
> return SVN_NO_ERROR;
> }
>
> @@ -698,7 +700,7 @@
> svn_txdelta (&delta_stream, source, target, pool);
>
> *stream = delta_stream;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> Index: err.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/err.c,v
> retrieving revision 1.22
> diff -u -r1.22 err.c
> --- err.c 2001/02/13 16:14:16 1.22
> +++ err.c 2001/02/15 05:47:31
> @@ -52,7 +52,7 @@
> svn_fs__wrap_db (svn_fs_t *fs, const char *operation, int db_err)
> {
> if (! db_err)
> - return 0;
> + return SVN_NO_ERROR;
> else
> return svn_fs__dberrf (fs->pool, db_err,
> "Berkeley DB error while %s for "
> @@ -65,7 +65,7 @@
> svn_fs__check_fs (svn_fs_t *fs)
> {
> if (fs->env)
> - return 0;
> + return SVN_NO_ERROR;
> else
> return svn_error_create (SVN_ERR_FS_NOT_OPEN, 0, 0, fs->pool,
> "filesystem object has not been opened yet");
> Index: fs.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/fs.c,v
> retrieving revision 1.36
> diff -u -r1.36 fs.c
> --- fs.c 2001/02/13 16:44:02 1.36
> +++ fs.c 2001/02/15 05:47:31
> @@ -41,7 +41,7 @@
> return svn_error_create (SVN_ERR_FS_ALREADY_OPEN, 0, 0, fs->pool,
> "filesystem object already open");
> else
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -75,7 +75,7 @@
> SVN_ERR (DB_WRAP (fs, msg, db->close (db, 0)));
> }
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
> /* Close whatever Berkeley DB resources are allocated to FS. */
> @@ -85,7 +85,7 @@
> DB_ENV *env = fs->env;
>
> if (! env)
> - return 0;
> + return SVN_NO_ERROR;
>
> /* Close the databases. */
> SVN_ERR (cleanup_fs_db (fs, &fs->nodes, "nodes"));
> @@ -122,7 +122,7 @@
> SVN_ERR (DB_WRAP (fs, "closing environment",
> env->close (env, 0)));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -239,7 +239,7 @@
> SVN_ERR (DB_WRAP (fs, "setting deadlock detection policy",
> fs->env->set_lk_detect (fs->env, DB_LOCK_RANDOM)));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -293,7 +293,7 @@
> svn_err = svn_fs__dag_init_fs (fs);
> if (svn_err) goto error;
>
> - return 0;
> + return SVN_NO_ERROR;
>
> error:
> (void) cleanup_fs (fs);
> @@ -339,7 +339,7 @@
> fs->env, 0));
> if (svn_err) goto error;
>
> - return 0;
> + return SVN_NO_ERROR;
>
> error:
> cleanup_fs (fs);
> @@ -380,7 +380,7 @@
> if (db_err)
> return svn_fs__dberr (pool, db_err);
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> Index: nodes-table.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/nodes-table.c,v
> retrieving revision 1.5
> diff -u -r1.5 nodes-table.c
> --- nodes-table.c 2001/02/13 16:17:24 1.5
> +++ nodes-table.c 2001/02/15 05:47:31
> @@ -302,7 +302,7 @@
> return svn_fs__err_corrupt_representation (fs, id);
>
> *skel_p = skel;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -325,7 +325,7 @@
> svn_fs__skel_to_dbt (&value, skel, pool),
> 0)));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -392,7 +392,7 @@
> id[2] = -1;
>
> *id_p = id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -482,7 +482,7 @@
> {
> /* NEW_ID isn't currently in use, so return that. */
> *successor_p = new_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
> else
> SVN_ERR (DB_WRAP (fs, "checking for next node revision", db_err));
> @@ -534,7 +534,7 @@
> new_id[id_len + 2] = -1;
>
> *successor_p = new_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
> /* If the last key before NEW_ID is a branch off of ID, then
> @@ -549,7 +549,7 @@
> new_id[id_len + 2] = -1;
>
> *successor_p = new_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
> /* Otherwise, something strange is going on. */
> Index: rep.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/rep.c,v
> retrieving revision 1.2
> diff -u -r1.2 rep.c
> --- rep.c 2001/02/12 00:26:14 1.2
> +++ rep.c 2001/02/15 05:47:31
> @@ -143,7 +143,7 @@
> create ? (DB_CREATE | DB_EXCL) : 0,
> 0666)));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -197,7 +197,7 @@
> return svn_fs__err_corrupt_representation (fs, id);
>
> *skel_p = skel;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -219,7 +219,7 @@
> svn_fs__skel_to_dbt (&value, skel, pool),
> 0)));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -249,7 +249,7 @@
> return svn_fs__err_corrupt_representation (fs, id);
>
> *skel_p = skel->children->next;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -351,7 +351,7 @@
> id[2] = -1;
>
> *id_p = id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -371,7 +371,7 @@
> SVN_ERR (put_representation_skel (fs, db_txn, id, skel, pool));
>
> *id_p = id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -471,7 +471,7 @@
> {
> /* NEW_ID isn't currently in use, so return that. */
> *successor_p = new_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
> else
> SVN_ERR (DB_WRAP (fs, "checking for next node revision", db_err));
> @@ -523,7 +523,7 @@
> new_id[id_len + 2] = -1;
>
> *successor_p = new_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
> /* If the last key before NEW_ID is a branch off of ID, then
> @@ -538,7 +538,7 @@
> new_id[id_len + 2] = -1;
>
> *successor_p = new_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
> /* Otherwise, something strange is going on. */
> @@ -565,7 +565,7 @@
> SVN_ERR (put_representation_skel (fs, db_txn, new_id, new_skel, pool));
>
> *new_id_p = new_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> Index: revision.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/revision.c,v
> retrieving revision 1.7
> diff -u -r1.7 revision.c
> --- revision.c 2001/02/12 00:26:14 1.7
> +++ revision.c 2001/02/15 05:47:32
> @@ -86,7 +86,7 @@
> if (! revision)
> return corrupt_revision (fs, v);
> *skel = revision;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -116,7 +116,7 @@
> goto corrupt;
>
> *id_p = id;
> - return 0;
> + return SVN_NO_ERROR;
>
> corrupt:
> apr_pool_destroy (subpool);
> @@ -163,7 +163,7 @@
> Revisions are numbered starting with zero; Berkeley DB record numbers
> begin with one. */
> *v_p = recno - 1;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -189,7 +189,7 @@
> create ? (DB_CREATE | DB_EXCL) : 0,
> 0666)));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> Index: trail.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/trail.c,v
> retrieving revision 1.4
> diff -u -r1.4 trail.c
> --- trail.c 2001/02/12 16:51:13 1.4
> +++ trail.c 2001/02/15 05:47:32
> @@ -43,7 +43,7 @@
> txn_begin (fs->env, 0, &trail->db_txn, 0)));
>
> *trail_p = trail;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -62,7 +62,7 @@
>
> apr_pool_destroy (trail->pool);
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -91,7 +91,7 @@
> SVN_ERR (DB_WRAP (fs,
> "committing Berkeley DB transaction",
> txn_commit (trail->db_txn, 0)));
> - return 0;
> + return SVN_NO_ERROR;
> }
>
> /* Is this a real error, or do we just need to retry? */
> Index: tree.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/tree.c,v
> retrieving revision 1.14
> diff -u -r1.14 tree.c
> --- tree.c 2001/02/13 22:29:18 1.14
> +++ tree.c 2001/02/15 05:47:32
> @@ -257,12 +257,12 @@
> {
> *(args->value_p) = svn_string_ncreate (value->data, value->len,
> trail->pool);
> - return 0;
> + return SVN_NO_ERROR;
> }
> }
>
> *(args->value_p) = 0;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -284,7 +284,7 @@
> SVN_ERR (svn_fs__retry_txn (node->fs, txn_body_node_prop, &args, pool));
>
> *value_p = value;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -349,7 +349,7 @@
>
> SVN_ERR (svn_fs__dag_set_proplist (args->node->dag_node, proplist, trail));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -369,7 +369,7 @@
> SVN_ERR (svn_fs__retry_txn (node->fs, txn_body_change_node_prop, &args,
> pool));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -440,7 +440,7 @@
> SVN_ERR (make_clone (parent, trail));
> SVN_ERR (svn_fs__dag_delete (parent, entry_name, trail));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> Index: txn-table.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/libsvn_fs/txn-table.c,v
> retrieving revision 1.13
> diff -u -r1.13 txn-table.c
> --- txn-table.c 2001/02/13 16:21:27 1.13
> +++ txn-table.c 2001/02/15 05:47:32
> @@ -102,7 +102,7 @@
> fs->transactions->put (fs->transactions, trail->db_txn,
> &key, &value, 0)));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -154,7 +154,7 @@
> }
>
> *id_p = next_id_str;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -170,7 +170,7 @@
> SVN_ERR (put_txn (fs, svn_txn, root_id, root_id, trail));
>
> *txn_id_p = svn_txn;
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> @@ -217,7 +217,7 @@
>
> *root_id_p = root_id;
> *base_root_id_p = base_root_id;
> - return 0;
> + return SVN_NO_ERROR;
> }
> }
>
> @@ -234,7 +234,7 @@
> if (! svn_fs_id_eq (old_root_id, root_id))
> SVN_ERR (put_txn (fs, svn_txn, root_id, base_root_id, trail));
>
> - return 0;
> + return SVN_NO_ERROR;
> }
>
>
> --
> Yoshiki Hayashi
Received on Sat Oct 21 14:36:22 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.