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

Re: svn commit: r34540 - trunk/subversion/libsvn_fs_base/bdb

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Wed, 03 Dec 2008 11:52:31 -0500

Cool. Glad you figured that out.

The great thing about working on this project with such top-notch hackers is
that if I see a line of code that looks so obviously bizarre, I can
generally assume it's that way for a very good reason that I'm missing. :-)

Blair Zajac wrote:
> Oh, I just got why this was done. For this cast
>
> bdb_error_gatherer(const DB_ENV *dbenv, const char *baton, const char *msg)
> {
> bdb_error_info_t *error_info = get_error_info((bdb_env_t *) baton);
>
> I'll revert the commit and add some more documentation on the casts and
> layout of bdb_env_t.
>
> Blair
>
> C. Michael Pilato wrote:
>> Blair, this code you replaced was doing something arguably kinda obscure,
>> and certainly not of the sort that is often found in our codebase. Any
>> chance the original author might have been trying to accomplish something
>> other than just passing a string to a function in the not-so-easiest way?
>>
>>
>> Blair Zajac wrote:
>>> Author: blair
>>> Date: Tue Dec 2 15:56:56 2008
>>> New Revision: 34540
>>>
>>> Log:
>>> * subversion/libsvn_fs_base/bdb/env.c
>>> (create_env):
>>> Instead of relying upon the layout order of a bdb_env_t with the
>>> errpfx_string as the first field so that casting a (bdb_env_t *)
>>> to a (char *) works, refer to the errpfx_string field by name.
>>>
>>> Modified:
>>> trunk/subversion/libsvn_fs_base/bdb/env.c
>>>
>>> Modified: trunk/subversion/libsvn_fs_base/bdb/env.c
>>> URL:
>>> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs_base/bdb/env.c?pathrev=34540&r1=34539&r2=34540
>>>
>>> ==============================================================================
>>>
>>> --- trunk/subversion/libsvn_fs_base/bdb/env.c Tue Dec 2 13:12:13
>>> 2008 (r34539)
>>> +++ trunk/subversion/libsvn_fs_base/bdb/env.c Tue Dec 2 15:56:56
>>> 2008 (r34540)
>>> @@ -311,7 +311,7 @@ create_env(bdb_env_t **bdbp, const char db_err
>>> = db_env_create(&(bdb->env), 0);
>>> if (!db_err)
>>> {
>>> - bdb->env->set_errpfx(bdb->env, (char *) bdb);
>>> + bdb->env->set_errpfx(bdb->env, bdb->errpfx_string);
>>> /* bdb_error_gatherer is in parens to stop macro expansion. */
>>> bdb->env->set_errcall(bdb->env, (bdb_error_gatherer));
>>>
>>> ------------------------------------------------------
>>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=978594
>>>
>>
>>

-- 
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=978968

Received on 2008-12-03 17:52:43 CET

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