X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fdatabase.c;h=f179615d902eba4423441cfd223dd73ac24cec66;hb=63a686a3d18465a8c96b8cc4a273c295f8a5a379;hp=79dd595c5772208336d0c4a38d6329a581d2cb8b;hpb=b50fd71ea3c920afc5ba60af567d73940993be3f;p=chise%2Fxemacs-chise.git.1 diff --git a/src/database.c b/src/database.c index 79dd595..f179615 100644 --- a/src/database.c +++ b/src/database.c @@ -43,20 +43,37 @@ Boston, MA 02111-1307, USA. */ /* glibc 2.1 doesn't have this problem with DB 2.x */ #if !(defined __GLIBC__ && __GLIBC_MINOR__ >= 1) #ifdef HAVE_INTTYPES_H +#ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ +#endif #include +#if !HAVE_U_INT8_T typedef uint8_t u_int8_t; +#endif +#if !HAVE_U_INT16_T typedef uint16_t u_int16_t; +#endif +#if !HAVE_U_INT32_T typedef uint32_t u_int32_t; +#endif #ifdef WE_DONT_NEED_QUADS +#if !HAVE_U_INT64_T typedef uint64_t u_int64_t; +#endif #endif /* WE_DONT_NEED_QUADS */ #endif /* HAVE_INTTYPES_H */ #endif /* !(defined __GLIBC__ && __GLIBC_MINOR__ >= 1) */ +/* Berkeley DB wants __STDC__ to be defined; else if does `#define const' */ +#if ! defined (__STDC__) && ! defined(__cplusplus) +#define __STDC__ 0 +#endif #include DB_H_FILE /* Berkeley db's header file */ #ifndef DB_VERSION_MAJOR # define DB_VERSION_MAJOR 1 #endif /* DB_VERSION_MAJOR */ +#ifndef DB_VERSION_MINOR +# define DB_VERSION_MINOR 0 +#endif /* DB_VERSION_MINOR */ Lisp_Object Qberkeley_db; Lisp_Object Qhash, Qbtree, Qrecno, Qunknown; #if DB_VERSION_MAJOR > 2 @@ -688,8 +705,14 @@ and defaults to 0755. status = db_create (&dbase, NULL, 0); if (status) return Qnil; +#if DB_VERSION_MAJOR < 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 1) status = dbase->open (dbase, filename, NULL, real_subtype, accessmask, modemask); +#else /* DB_VERSION >= 4.1 */ + /* DB_AUTO_COMMIT requires transaction support, don't try it */ + status = dbase->open (dbase, NULL, filename, NULL, real_subtype, + accessmask, modemask); +#endif /* DB_VERSION < 4.1 */ if (status) { dbase->close (dbase, 0);