[patch] Cwd.xs optimizations/abstraction
[p5sagit/p5-mst-13.2.git] / ext / GDBM_File / GDBM_File.xs
index 870f056..1ec5ea8 100644 (file)
@@ -42,12 +42,14 @@ typedef datum datum_value ;
 
 typedef void (*FATALFUNC)();
 
+#ifndef GDBM_FAST
 static int
 not_here(char *s)
 {
     croak("GDBM_File::%s not implemented on this architecture", s);
     return -1;
 }
+#endif
 
 /* GDBM allocates the datum with system malloc() and expects the user
  * to free() it.  So we either have to free() it immediately, or have
@@ -56,7 +58,7 @@ not_here(char *s)
 static void
 output_datum(pTHX_ SV *arg, char *str, int size)
 {
-#if !defined(MYMALLOC) || (defined(MYMALLOC) && defined(PERL_POLLUTE_MALLOC))
+#if (!defined(MYMALLOC) || (defined(MYMALLOC) && defined(PERL_POLLUTE_MALLOC))) && !defined(LEAKTEST)
        sv_usepvn(arg, str, size);
 #else
        sv_setpvn(arg, str, size);
@@ -122,6 +124,12 @@ constant(char *name, int arg)
 #else
            goto not_there;
 #endif
+       if (strEQ(name, "GDBM_NOLOCK"))
+#ifdef GDBM_NOLOCK
+           return GDBM_NOLOCK;
+#else
+           goto not_there;
+#endif
        if (strEQ(name, "GDBM_READER"))
 #ifdef GDBM_READER
            return GDBM_READER;
@@ -214,7 +222,7 @@ gdbm_TIEHASH(dbtype, name, read_write, mode, fatal_func = (FATALFUNC)croak)
            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, fatal_func))) {
                RETVAL = (GDBM_File)safemalloc(sizeof(GDBM_File_type)) ;
                Zero(RETVAL, 1, GDBM_File_type) ;
                RETVAL->dbp = dbp ;