* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 2018 */
/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/* This header file contains macro definitions so that a variety of DBM
libraries can be used by Exim. Nigel Metheringham provided the original set for
#if defined(USE_TDB)
+# if defined(USE_DB) || defined(USE_GDBM)
+# error USE_TDB conflict with alternate definition
+# endif
+
/* ************************* tdb interface ************************ */
/*XXX https://manpages.org/tdb/3 mentions concurrent writes.
Could we lose the file lock? */
#elif defined USE_DB
+# if defined(USE_TDB) || defined(USE_GDBM)
+# error USE_DB conflict with alternate definition
+# endif
+
# include <db.h>
/* 1.x did no locking
static inline void
dbfn_bdb_error_callback(const DB_ENV * dbenv, const char * pfx, const char * msg)
-{ log_write(0, LOG_MAIN, "Berkeley DB error: %s", msg); }
+{
+#ifndef MACRO_PREDEF
+log_write(0, LOG_MAIN, "Berkeley DB error: %s", msg);
+#endif
+}
#elif defined USE_GDBM
/*XXX TODO: exim's locfile not needed */
+# if defined(USE_TDB) || defined(USE_DB)
+# error USE_GDBM conflict with alternate definition
+# endif
+
# include <gdbm.h>
/* Basic DB type */
exim_datum_free(EXIM_DATUM * d)
{ free(d->dptr); }
-/* size limit */
+/* size limit. GDBM is int-max limited, but we want to be less silly */
# define EXIM_DB_RLIMIT 150
/* If none of USE_DB, USG_GDBM, or USE_TDB are set, the default is the NDBM
-interface */
+interface (which seems to be a wrapper for GDBM) */
/********************* ndbm interface definitions **********************/
# define EXIM_DB_RLIMIT 150
-#endif /* USE_GDBM */
+#endif /* !USE_GDBM */