This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ODBM_File can use the same T_PTROBJ typemap as the other ?DBM_File modules.
authorNicholas Clark <nick@ccl4.org>
Wed, 7 Sep 2011 20:30:52 +0000 (21:30 +0100)
committerNicholas Clark <nick@ccl4.org>
Wed, 7 Sep 2011 20:30:52 +0000 (21:30 +0100)
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.

ext/ODBM_File/ODBM_File.pm
ext/ODBM_File/ODBM_File.xs
ext/ODBM_File/typemap
pod/perldelta.pod

index 5c8d10b..958232c 100644 (file)
@@ -7,7 +7,7 @@ require Tie::Hash;
 require XSLoader;
 
 our @ISA = qw(Tie::Hash);
-our $VERSION = "1.11";
+our $VERSION = "1.12";
 
 XSLoader::load();
 
index 15c1725..d1ece7f 100644 (file)
@@ -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)
index d1f16b4..2612dfd 100644 (file)
@@ -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);
index 1b16783..e714e2f 100644 (file)
@@ -181,6 +181,13 @@ L<Module::Metadata> has been upgraded from version 1.000005_01 to version 1.0000
 
 =item *
 
+L<ODBM_File> has been upgraded from version 1.11 to version 1.12.
+
+This is only a minor refactoring of the XS code to bring it closer to the
+other C<?DBM_File> modules.
+
+=item *
+
 L<Pod::Simple> has been upgraded from version 3.18 to version 3.19.
 
 =item *