The fifth argument to gdbm_open() is an optional callback function for fatal
errors. The prototype for this function has changed between gdbm 1.8.3 and
1.9.0, from void (*)() to void(*)(const char *). This distinction doesn't
matter to a C compiler, but does to a C++ compiler, which we use to test the
core build. So, cast appropriately, depending on the version macros in
gdbm.h
#define GDBM_BLOCKSIZE 0 /* gdbm defaults to stat blocksize */
+#if defined(GDBM_VERSION_MAJOR) && defined(GDBM_VERSION_MINOR) \
+ && GDBM_VERSION_MAJOR > 1 || \
+ (GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR >= 9)
+typedef void (*FATALFUNC)(const char *);
+#else
+typedef void (*FATALFUNC)();
+#endif
+
#ifndef GDBM_FAST
static int
not_here(char *s)
GDBM_FILE dbp ;
RETVAL = NULL ;
- if ((dbp = gdbm_open(name, GDBM_BLOCKSIZE, read_write, mode, croak_string))) {
+ if ((dbp = gdbm_open(name, GDBM_BLOCKSIZE, read_write, mode,
+ (FATALFUNC) croak_string))) {
RETVAL = (GDBM_File)safecalloc(1, sizeof(GDBM_File_type)) ;
RETVAL->dbp = dbp ;
}