summaryrefslogtreecommitdiff
path: root/ext/GDBM_File
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-12-17 10:31:11 +0100
committerNicholas Clark <nick@ccl4.org>2012-12-17 10:31:11 +0100
commit93b74b47eb5e224de232c87de1cafcd5a43fd945 (patch)
tree10e948c9cef613e093185a523720b864163f1ffd /ext/GDBM_File
parentd4ead2eb2e301c11d2d2e40b0c3fac9190fd5379 (diff)
downloadperl-93b74b47eb5e224de232c87de1cafcd5a43fd945.tar.gz
GDBM_File must cast fatal_func appropriately for the version of gdbm.h
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
Diffstat (limited to 'ext/GDBM_File')
-rw-r--r--ext/GDBM_File/GDBM_File.xs11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs
index 6e28f22418..33e08e20d1 100644
--- a/ext/GDBM_File/GDBM_File.xs
+++ b/ext/GDBM_File/GDBM_File.xs
@@ -25,6 +25,14 @@ typedef datum datum_key_copy;
#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)
@@ -78,7 +86,8 @@ gdbm_TIEHASH(dbtype, name, read_write, mode)
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 ;
}