This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Eliminate the fifth argument from GDBM_File::TIEHASH.
authorNicholas Clark <nick@ccl4.org>
Thu, 13 Dec 2012 16:06:26 +0000 (17:06 +0100)
committerNicholas Clark <nick@ccl4.org>
Thu, 13 Dec 2012 16:13:35 +0000 (17:13 +0100)
This was intended to provide control of the callback used by gdbm* functions
in case of fatal errors (such as filesystem problems), but did not work (and
could never have worked). No code on CPAN even attempted to use it. The
callback is now always the previous default, croak.

This eliminates the only used of 'FATALFUNC' in the *DBM modules' type
files, so remove it from all of them.

It also eliminates a cast from a data pointer to a function pointer, which
is not legal C, and rightly upsets pedantic ANSI C compilers. The fact that
there was exactly cast, and only in one direction, gives a clue as to how
likely this was ever to work.

ext/GDBM_File/GDBM_File.xs
ext/GDBM_File/typemap
ext/NDBM_File/typemap
ext/ODBM_File/typemap
ext/SDBM_File/typemap

index 4eb00d5..6e28f22 100644 (file)
@@ -25,8 +25,6 @@ typedef datum datum_key_copy;
 
 #define GDBM_BLOCKSIZE 0 /* gdbm defaults to stat blocksize */
 
-typedef void (*FATALFUNC)();
-
 #ifndef GDBM_FAST
 static int
 not_here(char *s)
@@ -70,18 +68,17 @@ MODULE = GDBM_File  PACKAGE = GDBM_File     PREFIX = gdbm_
 INCLUDE: const-xs.inc
 
 GDBM_File
-gdbm_TIEHASH(dbtype, name, read_write, mode, fatal_func = (FATALFUNC)croak_string)
+gdbm_TIEHASH(dbtype, name, read_write, mode)
        char *          dbtype
        char *          name
        int             read_write
        int             mode
-       FATALFUNC       fatal_func
        CODE:
        {
            GDBM_FILE   dbp ;
 
            RETVAL = NULL ;
-           if ((dbp =  gdbm_open(name, GDBM_BLOCKSIZE, read_write, mode, fatal_func))) {
+           if ((dbp =  gdbm_open(name, GDBM_BLOCKSIZE, read_write, mode, croak_string))) {
                RETVAL = (GDBM_File)safecalloc(1, sizeof(GDBM_File_type)) ;
                RETVAL->dbp = dbp ;
            }
index d97acd4..8d6edee 100644 (file)
@@ -11,7 +11,6 @@ SDBM_File             T_PTROBJ
 ODBM_File              T_PTROBJ
 DB_File                        T_PTROBJ
 DBZ_File               T_PTROBJ
-FATALFUNC              T_OPAQUEPTR
 
 INPUT
 T_DATUM_K
index bb741e4..91f4dcb 100644 (file)
@@ -11,7 +11,6 @@ SDBM_File             T_PTROBJ
 ODBM_File              T_PTROBJ
 DB_File                        T_PTROBJ
 DBZ_File               T_PTROBJ
-FATALFUNC              T_OPAQUEPTR
 
 INPUT
 T_DATUM_K
index 2612dfd..8aed61c 100644 (file)
@@ -12,7 +12,6 @@ SDBM_File             T_PTROBJ
 ODBM_File              T_PTROBJ
 DB_File                        T_PTROBJ
 DBZ_File               T_PTROBJ
-FATALFUNC              T_OPAQUEPTR
 
 INPUT
 T_DATUM_K
index d1fc497..44370f2 100644 (file)
@@ -11,7 +11,6 @@ SDBM_File             T_PTROBJ
 ODBM_File              T_PTROBJ
 DB_File                        T_PTROBJ
 DBZ_File               T_PTROBJ
-FATALFUNC              T_OPAQUEPTR
 
 INPUT
 T_DATUM_K