summaryrefslogtreecommitdiff
path: root/ext/ODBM_File
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-09-07 21:30:52 +0100
committerNicholas Clark <nick@ccl4.org>2011-09-07 21:30:52 +0100
commit666c7ca6f69d448e1829e85a89fae74e72c1a677 (patch)
treeee3c660391bbd8b3899042c263e3b97c4dd654af /ext/ODBM_File
parentd39de89300b9384bad8b2cf88917ce9f104ae8b2 (diff)
downloadperl-666c7ca6f69d448e1829e85a89fae74e72c1a677.tar.gz
ODBM_File can use the same T_PTROBJ typemap as the other ?DBM_File modules.
This simplifies the RETVAL handling in TIEHASH, and makes the code closer to the other 3 ?DBM_File modules. The difference in TIEHASH handling dates back to 5.000, where only ODBM_File needed helper code around the dbm_open() call. The other 3 were able to #define it as dbm_TIEHASH, and hence had no CODE: section when first written.
Diffstat (limited to 'ext/ODBM_File')
-rw-r--r--ext/ODBM_File/ODBM_File.pm2
-rw-r--r--ext/ODBM_File/ODBM_File.xs4
-rw-r--r--ext/ODBM_File/typemap2
3 files changed, 5 insertions, 3 deletions
diff --git a/ext/ODBM_File/ODBM_File.pm b/ext/ODBM_File/ODBM_File.pm
index 5c8d10b734..958232cb7f 100644
--- a/ext/ODBM_File/ODBM_File.pm
+++ b/ext/ODBM_File/ODBM_File.pm
@@ -7,7 +7,7 @@ require Tie::Hash;
require XSLoader;
our @ISA = qw(Tie::Hash);
-our $VERSION = "1.11";
+our $VERSION = "1.12";
XSLoader::load();
diff --git a/ext/ODBM_File/ODBM_File.xs b/ext/ODBM_File/ODBM_File.xs
index 15c1725665..d1ece7ff9b 100644
--- a/ext/ODBM_File/ODBM_File.xs
+++ b/ext/ODBM_File/ODBM_File.xs
@@ -113,9 +113,9 @@ odbm_TIEHASH(dbtype, filename, flags, mode)
dbp = (void*)(dbminit(filename) >= 0 ? &dbmrefcnt : 0);
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);
}
+ OUTPUT:
+ RETVAL
void
DESTROY(db)
diff --git a/ext/ODBM_File/typemap b/ext/ODBM_File/typemap
index d1f16b4d2c..2612dfda14 100644
--- a/ext/ODBM_File/typemap
+++ b/ext/ODBM_File/typemap
@@ -57,3 +57,5 @@ T_DATUM_V
DBM_ckFilter($arg, filter[fetch_value],\"filter_fetch_value\");
T_GDATUM
sv_usepvn($arg, $var.dptr, $var.dsize);
+T_PTROBJ
+ sv_setref_pv($arg, dbtype, (void*)$var);