Convert [GNOS]DBM_File::TIEHASH to safecalloc() from safemalloc() then Zero().
authorNicholas Clark <nick@ccl4.org>
Wed, 20 Oct 2010 19:08:37 +0000 (21:08 +0200)
committerNicholas Clark <nick@ccl4.org>
Thu, 21 Oct 2010 09:34:28 +0000 (11:34 +0200)
ext/GDBM_File/GDBM_File.xs
ext/NDBM_File/NDBM_File.xs
ext/ODBM_File/ODBM_File.xs
ext/SDBM_File/SDBM_File.xs

index b418b25..ef951bd 100644 (file)
@@ -73,8 +73,7 @@ gdbm_TIEHASH(dbtype, name, read_write, mode, fatal_func = (FATALFUNC)croak)
 
            RETVAL = NULL ;
            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 = (GDBM_File)safecalloc(1, sizeof(GDBM_File_type)) ;
                RETVAL->dbp = dbp ;
            }
            
index 84d44cb..34c4b59 100644 (file)
@@ -66,8 +66,7 @@ ndbm_TIEHASH(dbtype, filename, flags, mode)
 
            RETVAL = NULL ;
            if ((dbp =  dbm_open(filename, flags, mode))) {
-               RETVAL = (NDBM_File)safemalloc(sizeof(NDBM_File_type)) ;
-               Zero(RETVAL, 1, NDBM_File_type) ;
+               RETVAL = (NDBM_File)safecalloc(1, sizeof(NDBM_File_type));
                RETVAL->dbp = dbp ;
            }
            
index 8faf4a9..2d67f99 100644 (file)
@@ -107,8 +107,7 @@ odbm_TIEHASH(dbtype, filename, flags, mode)
                    croak("ODBM_FILE: Can't open %s", filename);
            }
            dbp = (void*)(dbminit(filename) >= 0 ? &dbmrefcnt : 0);
-           RETVAL = (ODBM_File)safemalloc(sizeof(ODBM_File_type)) ;
-           Zero(RETVAL, 1, ODBM_File_type) ;
+           RETVAL = (ODBM_File)safecalloc(1, sizeof(ODBM_File_type));
            RETVAL->dbp = dbp ;
            ST(0) = sv_mortalcopy(&PL_sv_undef);
            sv_setptrobj(ST(0), RETVAL, dbtype);
index 6aafb6b..ac16062 100644 (file)
@@ -40,8 +40,7 @@ sdbm_TIEHASH(dbtype, filename, flags, mode)
 
            RETVAL = NULL ;
            if ((dbp = sdbm_open(filename,flags,mode))) {
-               RETVAL = (SDBM_File)safemalloc(sizeof(SDBM_File_type)) ;
-               Zero(RETVAL, 1, SDBM_File_type) ;
+               RETVAL = (SDBM_File)safecalloc(1, sizeof(SDBM_File_type));
                RETVAL->dbp = dbp ;
            }