In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/93b74b47eb5e224de232c87de1cafcd5a43fd945?hp=d4ead2eb2e301c11d2d2e40b0c3fac9190fd5379>

- Log -----------------------------------------------------------------
commit 93b74b47eb5e224de232c87de1cafcd5a43fd945
Author: Nicholas Clark <[email protected]>
Date:   Mon Dec 17 10:31:11 2012 +0100

    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
-----------------------------------------------------------------------

Summary of changes:
 ext/GDBM_File/GDBM_File.xs |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

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 ;
            }

--
Perl5 Master Repository

Reply via email to