More compiler tweaks.
[p5sagit/p5-mst-13.2.git] / ext / GDBM_File / GDBM_File.xs
index c6dc484..ac1ca8c 100644 (file)
@@ -16,23 +16,31 @@ typedef GDBM_FILE GDBM_File;
 #define gdbm_DELETE(db,key)                    gdbm_delete(db,key)
 #define gdbm_FIRSTKEY(db)                      gdbm_firstkey(db)
 #define gdbm_NEXTKEY(db,key)                   gdbm_nextkey(db,key)
+#define gdbm_EXISTS(db,key)                    gdbm_exists(db,key)
 
 typedef datum gdatum;
 
 typedef void (*FATALFUNC)();
 
 static int
-not_here(s)
-char *s;
+not_here(char *s)
 {
     croak("GDBM_File::%s not implemented on this architecture", s);
     return -1;
 }
 
+/* Versions of gdbm prior to 1.7x might not have the gdbm_sync,
+   gdbm_exists, and gdbm_setopt functions.  Apparently Slackware
+   (Linux) 2.1 contains gdbm-1.5 (which dates back to 1991).
+*/
+#ifndef GDBM_FAST
+#define gdbm_exists(db,key) not_here("gdbm_exists")
+#define gdbm_sync(db) (void) not_here("gdbm_sync")
+#define gdbm_setopt(db,optflag,optval,optlen) not_here("gdbm_setopt")
+#endif
+
 static double
-constant(name, arg)
-char *name;
-int arg;
+constant(char *name, int arg)
 {
     errno = 0;
     switch (*name) {
@@ -193,7 +201,7 @@ gdbm_STORE(db, key, value, flags = GDBM_REPLACE)
        if (RETVAL) {
            if (RETVAL < 0 && errno == EPERM)
                croak("No write permission to gdbm file");
-           warn("gdbm store returned %d, errno %d, key \"%.*s\"",
+           croak("gdbm store returned %d, errno %d, key \"%.*s\"",
                        RETVAL,errno,key.dsize,key.dptr);
            /* gdbm_clearerr(db); */
        }
@@ -216,3 +224,20 @@ int
 gdbm_reorganize(db)
        GDBM_File       db
 
+
+void
+gdbm_sync(db)
+       GDBM_File       db
+
+int
+gdbm_EXISTS(db, key)
+       GDBM_File       db
+       datum           key
+
+int
+gdbm_setopt (db, optflag, optval, optlen)
+       GDBM_File       db
+       int             optflag
+       int             &optval
+       int             optlen
+