Re: svn commit: r11799 - in branches/locking/subversion: include libsvn_fs

"Peter N. Lundblad" <[email protected]> Tue, 9 Nov 2004 21:13:49 +0100 (CET)
Newsgroups gmane.comp.version-control.subversion.svn,gmane.mail.eyebrowse.devel
Message-ID <[email protected]>
On Tue, 9 Nov 2004 [email protected] wrote:

> Author: sussman
> Date: Tue Nov  9 13:27:28 2004
> New Revision: 11799
>
> Added: branches/locking/subversion/libsvn_fs/access.c
> Url: http://svn.collab.net/viewcvs/svn/branches/locking/subversion/libsvn_fs/access.c?view=auto&rev=11799
> ==============================================================================
> --- (empty file)
> +++ branches/locking/subversion/libsvn_fs/access.c	Tue Nov  9 13:27:28 2004
> @@ -0,0 +1,92 @@
> +svn_error_t *
> +svn_fs_access_get_username (const char **username,
> +                            svn_fs_access_t *access_ctx)
> +{
> +  if (access_ctx)
> +    *username = access_ctx->username;
> +  else
> +    return svn_error_create (SVN_ERR_FS_NO_USER, 0, "Access context is NULL.");
> +
Do we usually check precoditions like this? I don't say it is bad, just
don't see it in other places. For example, we don't check in all svn_fs
functions that fs is non-NULL, do we?

Would it make sense to have a special error code for API vilations like
this? This is a kind of internal error to the application.

In any case:
- You should encapsulate the error message in _() if it is going to be
  seen by the user.
- No period at end of error message.


> +
> +svn_error_t *
> +svn_fs_access_add_lock_token (svn_fs_access_t *access_ctx,
> +                              const svn_lock_token_t *token)
> +{
> +  if (! access_ctx)
> +    return svn_error_create (SVN_ERR_FS_NO_USER, 0,
> +                             "Access context is NULL.");
> +  if (! token)
> +    return svn_error_create (SVN_ERR_FS_BAD_LOCK_TOKEN, 0,
> +                             "Lock token is NULL.");
> +
Same here.

Regards,
//Peter