From 93b74b47eb5e224de232c87de1cafcd5a43fd945 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 17 Dec 2012 10:31:11 +0100 Subject: [PATCH] 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 --- ext/GDBM_File/GDBM_File.xs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs index 6e28f22..33e08e2 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 ; } -- 2.7.4