DBM Filters
Paul Marquess [Tue, 8 Jun 1999 22:34:01 +0000 (23:34 +0100)]
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB29C6C3B@mbtlipnt02.btlabs.bt.co.uk>

p4raw-id: //depot/perl@3603

ext/GDBM_File/GDBM_File.pm
ext/GDBM_File/GDBM_File.xs
ext/NDBM_File/NDBM_File.pm
ext/NDBM_File/NDBM_File.xs
ext/ODBM_File/ODBM_File.pm
ext/ODBM_File/ODBM_File.xs
ext/SDBM_File/SDBM_File.pm
ext/SDBM_File/SDBM_File.xs

index 42bb6d2..aff0152 100644 (file)
@@ -59,7 +59,7 @@ require DynaLoader;
        GDBM_WRITER
 );
 
-$VERSION = "1.02";
+$VERSION = "1.03";
 
 sub AUTOLOAD {
     my($constname);
index db28891..be1817b 100644 (file)
@@ -304,7 +304,8 @@ gdbm_setopt (db, optflag, optval, optlen)
 #define setFilter(type)                                        \
        {                                               \
            if (db->type)                               \
-               RETVAL = newSVsv(db->type) ;            \
+               RETVAL = sv_mortalcopy(db->type) ;      \
+           ST(0) = RETVAL ;                            \
            if (db->type && (code == &PL_sv_undef)) {   \
                 SvREFCNT_dec(db->type) ;               \
                db->type = NULL ;                       \
@@ -326,8 +327,6 @@ filter_fetch_key(db, code)
        SV *            RETVAL = &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_key(db, code)
@@ -336,8 +335,6 @@ filter_store_key(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_fetch_value(db, code)
@@ -346,8 +343,6 @@ filter_fetch_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_value) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_value(db, code)
@@ -356,6 +351,4 @@ filter_store_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_value) ;
-       OUTPUT:
-           RETVAL
 
index cad800a..8db59ee 100644 (file)
@@ -12,7 +12,7 @@ require DynaLoader;
 
 @ISA = qw(Tie::Hash DynaLoader);
 
-$VERSION = "1.02";
+$VERSION = "1.03";
 
 bootstrap NDBM_File $VERSION;
 
index 60b141e..29cc288 100644 (file)
@@ -117,7 +117,8 @@ ndbm_clearerr(db)
 #define setFilter(type)                                        \
        {                                               \
            if (db->type)                               \
-               RETVAL = newSVsv(db->type) ;            \
+               RETVAL = sv_mortalcopy(db->type) ;      \
+           ST(0) = RETVAL ;                            \
            if (db->type && (code == &PL_sv_undef)) {   \
                 SvREFCNT_dec(db->type) ;               \
                db->type = NULL ;                       \
@@ -139,8 +140,6 @@ filter_fetch_key(db, code)
        SV *            RETVAL = &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_key(db, code)
@@ -149,8 +148,6 @@ filter_store_key(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_fetch_value(db, code)
@@ -159,8 +156,6 @@ filter_fetch_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_value) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_value(db, code)
@@ -169,6 +164,4 @@ filter_store_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_value) ;
-       OUTPUT:
-           RETVAL
 
index 572318b..0af875d 100644 (file)
@@ -8,7 +8,7 @@ require DynaLoader;
 
 @ISA = qw(Tie::Hash DynaLoader);
 
-$VERSION = "1.01";
+$VERSION = "1.02";
 
 bootstrap ODBM_File $VERSION;
 
index 9ad794d..7601c34 100644 (file)
@@ -158,7 +158,8 @@ odbm_NEXTKEY(db, key)
 #define setFilter(type)                                        \
        {                                               \
            if (db->type)                               \
-               RETVAL = newSVsv(db->type) ;            \
+               RETVAL = sv_mortalcopy(db->type) ;      \
+           ST(0) = RETVAL ;                            \
            if (db->type && (code == &PL_sv_undef)) {   \
                 SvREFCNT_dec(db->type) ;               \
                db->type = Nullsv ;                     \
@@ -180,8 +181,6 @@ filter_fetch_key(db, code)
        SV *            RETVAL = &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_key(db, code)
@@ -190,8 +189,6 @@ filter_store_key(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_fetch_value(db, code)
@@ -200,8 +197,6 @@ filter_fetch_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_value) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_value(db, code)
@@ -210,6 +205,4 @@ filter_store_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_value) ;
-       OUTPUT:
-           RETVAL
 
index 006bbbd..34c9717 100644 (file)
@@ -8,7 +8,7 @@ require DynaLoader;
 
 @ISA = qw(Tie::Hash DynaLoader);
 
-$VERSION = "1.01" ;
+$VERSION = "1.02" ;
 
 bootstrap SDBM_File $VERSION;
 
index e8711f4..c2e940b 100644 (file)
@@ -23,16 +23,13 @@ typedef datum datum_value ;
            if (db->filtering)                                  \
                croak("recursion detected in %s", name) ;       \
            db->filtering = TRUE ;                              \
-           /* SAVE_DEFSV ;*/   /* save $_ */                   \
            save_defsv = newSVsv(DEFSV) ;                       \
            sv_setsv(DEFSV, arg) ;                              \
            PUSHMARK(sp) ;                                      \
            (void) perl_call_sv(db->type, G_DISCARD|G_NOARGS);  \
-           /* SPAGAIN ; */                                             \
            sv_setsv(arg, DEFSV) ;                              \
            sv_setsv(DEFSV, save_defsv) ;                               \
            SvREFCNT_dec(save_defsv) ;                          \
-           /* PUTBACK ; */                                             \
            db->filtering = FALSE ;                             \
            /*printf("end of filtering %s\n", name) ;*/         \
        }
@@ -143,7 +140,8 @@ sdbm_clearerr(db)
 #define setFilter(type)                                        \
        {                                               \
            if (db->type)                               \
-               RETVAL = newSVsv(db->type) ;            \
+               RETVAL = sv_mortalcopy(db->type) ;      \
+           ST(0) = RETVAL ;                            \
            if (db->type && (code == &PL_sv_undef)) {   \
                 SvREFCNT_dec(db->type) ;               \
                db->type = NULL ;                       \
@@ -165,8 +163,6 @@ filter_fetch_key(db, code)
        SV *            RETVAL = &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_key(db, code)
@@ -175,8 +171,6 @@ filter_store_key(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_key) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_fetch_value(db, code)
@@ -185,8 +179,6 @@ filter_fetch_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_fetch_value) ;
-       OUTPUT:
-           RETVAL
 
 SV *
 filter_store_value(db, code)
@@ -195,6 +187,4 @@ filter_store_value(db, code)
        SV *            RETVAL =  &PL_sv_undef ;
        CODE:
            setFilter(filter_store_value) ;
-       OUTPUT:
-           RETVAL