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

Re: Upgrade to db 4.1

From: Zack Weinberg <zack_at_codesourcery.com>
Date: 2002-10-16 20:10:39 CEST

On Wed, Oct 16, 2002 at 10:01:09AM -0700, Justin Erenkrantz wrote:
> --On Wednesday, October 16, 2002 12:52 PM +0200 brane@xbc.nu wrote:
>
> To give you an idea what *every* open call is going to look like,
> here's the code to open the changes table and to maintain backwards
> compatibility if you rely on the header files:
>
> DB_ERR (changes->open (changes,
> #if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4) && \
> defined(DB_VERSION_MINOR) && (DB_VERSION_MINOR >= 1)
> NULL,
> #endif
> "changes", 0, DB_BTREE,
> (create ? (DB_CREATE | DB_EXCL) : 0)
> #if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4) && \
> defined(DB_VERSION_MINOR) && (DB_VERSION_MINOR >= 1)
> | DB_AUTO_COMMIT
> #endif
> , 0666));

Can't you wrap things up in a compatibility header file? Like this:

#define BDB_VERSION (DB_VERSION_MAJOR * 1000 + DB_VERSION_MINOR)

#if BDB_VERSION > 4001
#define BDB_OPEN_ARGS(db, cr) \
   db, NULL, #db, (cr ? (DB_CREAT | DB_EXCL) : 0) | DB_AUTO_COMMIT, 0666
#else
#define BDB_OPEN_ARGS(db, cr) \
   db, #db, (cr ? (DB_CREAT | DB_EXCL) : 0), 0666
#endif

...

  DB_ERR (changes->open (BDB_OPEN_ARGS (changes, create)));

zw

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 16 20:11:23 2002

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.