Re: svn commit: r11871 - in trunk/subversion/libsvn_fs_base: . bdb

Branko Čibej <[email protected]> Fri, 12 Nov 2004 22:14:36 +0100
Newsgroups gmane.comp.version-control.subversion.svn,gmane.mail.eyebrowse.devel
Message-ID <[email protected]>
[email protected] wrote:

>+/* In BDB 4.3, "buffer too small" errors come back with
>+   DB_BUFFER_SMALL (instead of ENOMEM, which is now fatal). */
>+#if (DB_VERSION_MAJOR > 4) \
>+    || (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR >= 3)
>+#define SVN_BDB_DB_BUFFER_SMALL DB_BUFFER_SMALL
>+#else
>+#define SVN_BDB_DB_BUFFER_SMALL ENOMEM
>+#endif
>  
>
#ifndef DB_BUFFER_SMALL
#define SVN_BDB_BUFFER_SMALL ENOMEM
#else
#define SVN_BDB_BUFFER_SMALL DB_BUFFER_SMALL
#endif
  

That's what other bits of that file do, so let's be consistent. Or you 
could even

#ifndef DB_NUFFER_SMALL
#define DB_BUFFER_SMALL ENOMEM
#endif
  

This checking of the version number just confuses things. Unfortunately 
it's necessary for SVN_BDB_OPEN_PARAMS, because they went and changed 
the signature of a function and that's something no amount of macro 
magic can fix without looking at the version number...

> /* BDB error callback.  See bdb_errcall_baton_t in fs.h for more info. */
> static void
>-bdb_error_gatherer (const char *char_baton, char *msg)
>+#if (DB_VERSION_MAJOR > 4) \
>+    || (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR >= 3)
>+bdb_error_gatherer (const DB_ENV *dbenv, const char *baton, const char *msg)
>+#else
>+bdb_error_gatherer (const char *baton, char *msg)
>+#endif
>  
>
I'd do this in bdb_compat.h myself, along the lines of 
SVN_BDB_OPEN_PARAMS. Put all the #ifdef cruft in that header, to keep 
the rest of the code moderately readable.

-- Brane