From: Gurusamy Sarathy Date: Wed, 24 Mar 1999 08:37:02 +0000 (+0000) Subject: integrate change#3115 from maint-5.005 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca63f0d242a6920af7209f1a190c17b7800ce145;p=p5sagit%2Fp5-mst-13.2.git integrate change#3115 from maint-5.005 p4raw-link: @3115 on //depot/maint-5.005/perl: 5a4724ee428f7c08669162fcb68dee455ffa09d6 p4raw-id: //depot/perl@3145 p4raw-integrated: from //depot/maint-5.005/perl@3144 'copy in' ext/DB_File/Changes ext/DB_File/DB_File.pm ext/DB_File/DB_File.xs ext/DB_File/typemap (@3010..) --- diff --git a/ext/DB_File/Changes b/ext/DB_File/Changes index c71d5b8..2fab919 100644 --- a/ext/DB_File/Changes +++ b/ext/DB_File/Changes @@ -229,3 +229,6 @@ mapping problem with O_RDONLY on the Hurd * Updated the message that db-recno.t prints when tests 51, 53 or 55 fail. +1.65 6th March 1999 + * Fixed a bug in the recno PUSH logic. + * The BOOT version check now needs 2.3.4 when using Berkeley DB version 2 diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm index 738de7c..e5759ff 100644 --- a/ext/DB_File/DB_File.pm +++ b/ext/DB_File/DB_File.pm @@ -1,8 +1,8 @@ # DB_File.pm -- Perl 5 interface to Berkeley DB # # written by Paul Marquess (Paul.Marquess@btinternet.com) -# last modified 21st February 1999 -# version 1.64 +# last modified 6th March 1999 +# version 1.65 # # Copyright (c) 1995-9 Paul Marquess. All rights reserved. # This program is free software; you can redistribute it and/or @@ -145,7 +145,7 @@ use vars qw($VERSION @ISA @EXPORT $AUTOLOAD $DB_BTREE $DB_HASH $DB_RECNO $db_ver use Carp; -$VERSION = "1.64" ; +$VERSION = "1.65" ; #typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; $DB_BTREE = new DB_File::BTREEINFO ; diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs index 540fa9c..94113eb 100644 --- a/ext/DB_File/DB_File.xs +++ b/ext/DB_File/DB_File.xs @@ -3,8 +3,8 @@ DB_File.xs -- Perl 5 interface to Berkeley DB written by Paul Marquess - last modified 21st February 1999 - version 1.64 + last modified 6th March 1999 + version 1.65 All comments/suggestions/problems are welcome @@ -63,6 +63,8 @@ 1.64 - Tidied up the 1.x to 2.x flags mapping code. Added a patch from Mark Kettenis to fix a flag mapping problem with O_RDONLY on the Hurd + 1.65 - Fixed a bug in the PUSH logic. + Added BOOT check that using 2.3.4 or greater @@ -346,9 +348,9 @@ GetVersionInfo() (void)db_version(&Major, &Minor, &Patch) ; - /* check that libdb is recent enough */ - if (Major == 2 && Minor == 0 && Patch < 5) - croak("DB_File needs Berkeley DB 2.0.5 or greater, you have %d.%d.%d\n", + /* check that libdb is recent enough -- we need 2.3.4 or greater */ + if (Major == 2 && (Minor < 3 || (Minor == 3 && Patch < 4))) + croak("DB_File needs Berkeley DB 2.3.4 or greater, you have %d.%d.%d\n", Major, Minor, Patch) ; #if PERL_VERSION > 3 @@ -1228,7 +1230,6 @@ db_FIRSTKEY(db) { DBTKEY key ; DBT value ; - DB * Db = db->dbp ; DBT_flags(key) ; DBT_flags(value) ; @@ -1245,7 +1246,6 @@ db_NEXTKEY(db, key) CODE: { DBT value ; - DB * Db = db->dbp ; DBT_flags(value) ; CurrentDB = db ; @@ -1308,7 +1308,6 @@ pop(db) { DBTKEY key ; DBT value ; - DB * Db = db->dbp ; DBT_flags(key) ; DBT_flags(value) ; @@ -1336,7 +1335,6 @@ shift(db) { DBT value ; DBTKEY key ; - DB * Db = db->dbp ; DBT_flags(key) ; DBT_flags(value) ; @@ -1363,7 +1361,6 @@ push(db, ...) CODE: { DBTKEY key ; - DBTKEY * keyptr = &key ; DBT value ; DB * Db = db->dbp ; int i ; @@ -1372,34 +1369,34 @@ push(db, ...) DBT_flags(key) ; DBT_flags(value) ; CurrentDB = db ; - /* Set the Cursor to the Last element */ - RETVAL = do_SEQ(db, key, value, R_LAST) ; - if (RETVAL >= 0) - { - if (RETVAL == 1) - keyptr = &empty ; #ifdef DB_VERSION_MAJOR + RETVAL = 0 ; + key = empty ; for (i = 1 ; i < items ; ++i) { - - ++ (* (int*)key.data) ; value.data = SvPV(ST(i), n_a) ; value.size = n_a ; - RETVAL = (Db->put)(Db, NULL, &key, &value, 0) ; + RETVAL = (Db->put)(Db, NULL, &key, &value, DB_APPEND) ; if (RETVAL != 0) break; } #else + /* Set the Cursor to the Last element */ + RETVAL = do_SEQ(db, key, value, R_LAST) ; + if (RETVAL >= 0) + { + if (RETVAL == 1) + key = empty ; for (i = items - 1 ; i > 0 ; --i) { value.data = SvPV(ST(i), n_a) ; value.size = n_a ; - RETVAL = (Db->put)(Db, keyptr, &value, R_IAFTER) ; + RETVAL = (Db->put)(Db, &key, &value, R_IAFTER) ; if (RETVAL != 0) break; } -#endif } +#endif } OUTPUT: RETVAL diff --git a/ext/DB_File/typemap b/ext/DB_File/typemap index 3463ec0..994ba27 100644 --- a/ext/DB_File/typemap +++ b/ext/DB_File/typemap @@ -2,7 +2,7 @@ # # written by Paul Marquess # last modified 21st February 1999 -# version 1.64 +# version 1.65 # #################################### DB SECTION #