summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-10-20 21:08:37 +0200
committerNicholas Clark <nick@ccl4.org>2010-10-21 11:34:28 +0200
commita5c6857cbad41a80aba26d560558a58cbba0505f (patch)
tree3e9da72b95e329f6a8aae589d9222e6911fb4598 /ext
parent76cc365d064e9bf5a0e771bb8ae2bf380b8b0d25 (diff)
downloadperl-a5c6857cbad41a80aba26d560558a58cbba0505f.tar.gz
Convert [GNOS]DBM_File::TIEHASH to safecalloc() from safemalloc() then Zero().
Diffstat (limited to 'ext')
-rw-r--r--ext/GDBM_File/GDBM_File.xs3
-rw-r--r--ext/NDBM_File/NDBM_File.xs3
-rw-r--r--ext/ODBM_File/ODBM_File.xs3
-rw-r--r--ext/SDBM_File/SDBM_File.xs3
4 files changed, 4 insertions, 8 deletions
diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs
index b418b2537b..ef951bdd25 100644
--- a/ext/GDBM_File/GDBM_File.xs
+++ b/ext/GDBM_File/GDBM_File.xs
@@ -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 ;
}
diff --git a/ext/NDBM_File/NDBM_File.xs b/ext/NDBM_File/NDBM_File.xs
index 84d44cba46..34c4b59829 100644
--- a/ext/NDBM_File/NDBM_File.xs
+++ b/ext/NDBM_File/NDBM_File.xs
@@ -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 ;
}
diff --git a/ext/ODBM_File/ODBM_File.xs b/ext/ODBM_File/ODBM_File.xs
index 8faf4a92d6..2d67f99f5c 100644
--- a/ext/ODBM_File/ODBM_File.xs
+++ b/ext/ODBM_File/ODBM_File.xs
@@ -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);
diff --git a/ext/SDBM_File/SDBM_File.xs b/ext/SDBM_File/SDBM_File.xs
index 6aafb6b99f..ac16062800 100644
--- a/ext/SDBM_File/SDBM_File.xs
+++ b/ext/SDBM_File/SDBM_File.xs
@@ -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 ;
}