* ext/dbm/extconf.rb: dbm_clearerr should be available in all ndbm

implementation.  If it is not available, it is caused by
  header/library mismatch such that Berkeley DB header & gdbm library.

* ext/dbm/dbm.c (fdbm_store): use dbm_clearerr() unconditionally.
  gdbm 1.9 provides it as a real function instead of a empty macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-11-12 07:06:09 +00:00
Родитель 5c29d116c2
Коммит df2e1f85d2
3 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Sat Nov 12 15:59:42 2011 Tanaka Akira <akr@fsij.org>
* ext/dbm/extconf.rb: dbm_clearerr should be available in all ndbm
implementation. If it is not available, it is caused by
header/library mismatch such that Berkeley DB header & gdbm library.
* ext/dbm/dbm.c (fdbm_store): use dbm_clearerr() unconditionally.
gdbm 1.9 provides it as a real function instead of a empty macro.
Sat Nov 12 13:35:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* bootstraptest/runner.rb: don't suppress SIGINT.

Просмотреть файл

@ -639,9 +639,7 @@ fdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
if (dbm_store(dbm, key, val, DBM_REPLACE)) {
#ifdef HAVE_DBM_CLEARERR
dbm_clearerr(dbm);
#endif
if (errno == EPERM) rb_sys_fail(0);
rb_raise(rb_eDBMError, "dbm_store failed");
}

Просмотреть файл

@ -29,23 +29,20 @@ headers.found = []
headers.defs = nil
def headers.db_check(db)
have_gdbm = false
hsearch = nil
case db
when /^db[2-5]?$/
hsearch = "-DDB_DBM_HSEARCH"
when "gdbm"
have_gdbm = true
when "gdbm_compat"
have_gdbm = true
have_library("gdbm") or return false
end
if (hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", h, hsearch)} or
hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", ["db.h", h], hsearch)}) and
(have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch) || have_func('dbm_open("", 0, 0)', hdr, hsearch))
have_func('dbm_clearerr((DBM *)0)', hdr, hsearch) unless have_gdbm
(have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch) || have_func('dbm_open("", 0, 0)', hdr, hsearch)) and
have_func('dbm_clearerr((DBM *)0)', hdr, hsearch)
if hsearch
$defs << hsearch
@defs = hsearch