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

Re: svn commit: r35023 - trunk/subversion/libsvn_fs_fs

From: Blair Zajac <blair_at_orcaware.com>
Date: Sun, 04 Jan 2009 16:52:33 -0800

Stefan Sperling wrote:
> On Mon, Jan 05, 2009 at 12:08:19AM +0100, Stefan Sperling wrote:
>> On Sun, Jan 04, 2009 at 08:34:33PM +0200, Daniel Shahaf wrote:
>>> Stefan Sperling wrote on Sun, 4 Jan 2009 at 14:39 +0100:
>>>> On Sun, Jan 04, 2009 at 09:07:01AM +0200, Daniel Shahaf wrote:
>>>>>>> @@ -180,6 +190,8 @@ path_rev_packed(svn_fs_t *fs, svn_revnum
>>>>>>> fs_fs_data_t *ffd = fs->fsap_data;
>>>>>>> assert(ffd->max_files_per_dir);
>>>>>>> + assert(is_packed_rev(fs, rev));
>>>>>> We're not using assert() anymore, but SVN_ASSERT(), assuming the method
>>>>>> returns an svn_error_t *.
>>>>>>
>>>>> It returns const char *.
>>>> You could probably use SVN_ERR_ASSERT_NO_RETURN() in this case.
>>>> It was made for functions that do not return svn_error_t*.
>>>>
>>>> But assert()s do not get compiled into release builds anyway.
>>>> It's aborts() which are really bad when used outside of the
>>>> SVN_ERR_ASSERT* macros.
>>>>
>>> If people think assert()s are bad, we can change those functions so
>>> they return 'svn_error_t *' and use SVN_ERR_ASSERT().
>> Not necessary. SVN_ERR_ASSERT_NO_RETURN() has been designed for
>> use in functions that return something other than svn_error_t*.
>>
>> >From subversion/include/svn_error.h:
>
> Er, I quoted the wrong macro, sorry.
>
> This is the one:
>
> /** Similar to SVN_ERR_ASSERT(), but without the option of returning
> * an error to the calling function.
> *
> * If possible you should use SVN_ERR_ASSERT() instead.
> *
> * @since New in 1.6.
> */
> #define SVN_ERR_ASSERT_NO_RETURN(expr) \
> do { \
> if (!(expr)) { \
> svn_error__malfunction(FALSE, __FILE__, __LINE__, #expr); \
> abort(); \
> } \
> } while (0)

It's still better to switch to a function that returns an svn_error_t *. This
macro is nice, but it can cause an abort in library code, which we've been
moving away from.

Blair

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1003945
Received on 2009-01-05 09:21:27 CET

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