[前][次][番号順一覧][スレッド一覧]

ruby-changes:66344

From: Hiroshi <ko1@a...>
Date: Tue, 25 May 2021 15:18:51 +0900 (JST)
Subject: [ruby-changes:66344] 55cd3e4ebf (master): Removed dbm from ruby repo

https://git.ruby-lang.org/ruby.git/commit/?id=55cd3e4ebf

From 55cd3e4ebff8fa75854ecadcd77abbf7cf4b5823 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Mon, 24 May 2021 18:52:18 +0900
Subject: Removed dbm from ruby repo

---
 doc/maintainers.rdoc      |    4 -
 doc/standard_library.rdoc |    1 -
 ext/dbm/dbm.c             | 1156 ---------------------------------------------
 ext/dbm/dbm.gemspec       |   21 -
 ext/dbm/depend            |  162 -------
 ext/dbm/extconf.rb        |  292 ------------
 test/dbm/test_dbm.rb      |  634 -------------------------
 tool/sync_default_gems.rb |    6 -
 8 files changed, 2276 deletions(-)
 delete mode 100644 ext/dbm/dbm.c
 delete mode 100644 ext/dbm/dbm.gemspec
 delete mode 100644 ext/dbm/depend
 delete mode 100644 ext/dbm/extconf.rb
 delete mode 100644 test/dbm/test_dbm.rb

diff --git a/doc/maintainers.rdoc b/doc/maintainers.rdoc
index 6f69ffc..cb70587 100644
--- a/doc/maintainers.rdoc
+++ b/doc/maintainers.rdoc
@@ -312,10 +312,6 @@ Yukihiro Matsumoto (matz) https://github.com/ruby/ruby/blob/trunk/doc/maintainers.rdoc#L312
   _unmaintained_
   https://github.com/ruby/date
   https://rubygems.org/gems/date
-[ext/dbm]
-  _unmaintained_
-  https://github.com/ruby/dbm
-  https://rubygems.org/gems/dbm
 [ext/etc]
   Ruby core team
   https://github.com/ruby/etc
diff --git a/doc/standard_library.rdoc b/doc/standard_library.rdoc
index 7300b72..2e201af 100644
--- a/doc/standard_library.rdoc
+++ b/doc/standard_library.rdoc
@@ -83,7 +83,6 @@ WeakRef:: Allows a referenced object to be garbage-collected https://github.com/ruby/ruby/blob/trunk/doc/standard_library.rdoc#L83
 BigDecimal:: Provides arbitrary-precision floating point decimal arithmetic
 Date:: A subclass of Object includes Comparable module for handling dates
 DateTime:: Subclass of Date to handling dates, hours, minutes, seconds, offsets
-DBM:: Provides a wrapper for the UNIX-style Database Manager Library
 Digest:: Provides a framework for message digest libraries
 Etc:: Provides access to information typically stored in UNIX /etc directory
 Fcntl:: Loads constants defined in the OS fcntl.h C header file
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
deleted file mode 100644
index de75366..0000000
--- a/ext/dbm/dbm.c
+++ /dev/null
@@ -1,1156 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/doc/standard_library.rdoc#L0
-/************************************************
-
-  dbm.c -
-
-  $Author$
-  created at: Mon Jan 24 15:59:52 JST 1994
-
-  Copyright (C) 1995-2001 Yukihiro Matsumoto
-
-************************************************/
-
-#include "ruby.h"
-
-#ifdef HAVE_CDEFS_H
-# include <cdefs.h>
-#endif
-#ifdef HAVE_SYS_CDEFS_H
-# include <sys/cdefs.h>
-#endif
-#include DBM_HDR
-#include <fcntl.h>
-#include <errno.h>
-
-#define DSIZE_TYPE TYPEOF_DATUM_DSIZE
-#if SIZEOF_DATUM_DSIZE > SIZEOF_INT
-# define RSTRING_DSIZE(s) RSTRING_LEN(s)
-# define TOO_LONG(n) ((void)(n),0)
-#else
-# define RSTRING_DSIZE(s) RSTRING_LENINT(s)
-# define TOO_LONG(n) ((long)(+(DSIZE_TYPE)(n)) != (n))
-#endif
-
-static VALUE rb_cDBM, rb_eDBMError;
-
-#define RUBY_DBM_RW_BIT 0x20000000
-
-struct dbmdata {
-    long di_size;
-    DBM *di_dbm;
-};
-
-NORETURN(static void closed_dbm(void));
-
-static void
-closed_dbm(void)
-{
-    rb_raise(rb_eDBMError, "closed DBM file");
-}
-
-#define GetDBM(obj, dbmp) do {\
-    TypedData_Get_Struct((obj), struct dbmdata, &dbm_type, (dbmp));\
-    if ((dbmp)->di_dbm == 0) closed_dbm();\
-} while (0)
-
-#define GetDBM2(obj, dbmp, dbm) do {\
-    GetDBM((obj), (dbmp));\
-    (dbm) = (dbmp)->di_dbm;\
-} while (0)
-
-static void
-free_dbm(void *ptr)
-{
-    struct dbmdata *dbmp = ptr;
-    if (dbmp->di_dbm)
-	dbm_close(dbmp->di_dbm);
-    xfree(dbmp);
-}
-
-static size_t
-memsize_dbm(const void *ptr)
-{
-    const struct dbmdata *dbmp = ptr;
-    size_t size = sizeof(*dbmp);
-    if (dbmp->di_dbm)
-	size += DBM_SIZEOF_DBM;
-    return size;
-}
-
-static const rb_data_type_t dbm_type = {
-    "dbm",
-    {0, free_dbm, memsize_dbm,},
-    0, 0,
-    RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
-/*
- * call-seq:
- *   dbm.close
- *
- * Closes the database.
- */
-static VALUE
-fdbm_close(VALUE obj)
-{
-    struct dbmdata *dbmp;
-
-    GetDBM(obj, dbmp);
-    dbm_close(dbmp->di_dbm);
-    dbmp->di_dbm = 0;
-
-    return Qnil;
-}
-
-/*
- * call-seq:
- *   dbm.closed? -> true or false
- *
- * Returns true if the database is closed, false otherwise.
- */
-static VALUE
-fdbm_closed(VALUE obj)
-{
-    struct dbmdata *dbmp;
-
-    TypedData_Get_Struct(obj, struct dbmdata, &dbm_type, dbmp);
-    if (dbmp->di_dbm == 0)
-	return Qtrue;
-
-    return Qfalse;
-}
-
-static VALUE
-fdbm_alloc(VALUE klass)
-{
-    struct dbmdata *dbmp;
-
-    return TypedData_Make_Struct(klass, struct dbmdata, &dbm_type, dbmp);
-}
-
-/*
- * call-seq:
- *   DBM.new(filename[, mode[, flags]]) -> dbm
- *
- * Open a dbm database with the specified name, which can include a directory
- * path. Any file extensions needed will be supplied automatically by the dbm
- * library. For example, Berkeley DB appends '.db', and GNU gdbm uses two
- * physical files with extensions '.dir' and '.pag'.
- *
- * The mode should be an integer, as for Unix chmod.
- *
- * Flags should be one of READER, WRITER, WRCREAT or NEWDB.
- */
-static VALUE
-fdbm_initialize(int argc, VALUE *argv, VALUE obj)
-{
-    VALUE file, vmode, vflags;
-    DBM *dbm;
-    struct dbmdata *dbmp;
-    int mode, flags = 0;
-
-    TypedData_Get_Struct(obj, struct dbmdata, &dbm_type, dbmp);
-    if (rb_scan_args(argc, argv, "12", &file, &vmode, &vflags) == 1) {
-	mode = 0666;		/* default value */
-    }
-    else if (NIL_P(vmode)) {
-	mode = -1;		/* return nil if DB not exist */
-    }
-    else {
-	mode = NUM2INT(vmode);
-    }
-
-    if (!NIL_P(vflags))
-        flags = NUM2INT(vflags);
-
-    FilePathValue(file);
-
-    /*
-     * Note:
-     * gdbm 1.10 works with O_CLOEXEC.  gdbm 1.9.1 silently ignore it.
-     */
-#ifndef O_CLOEXEC
-#   define O_CLOEXEC 0
-#endif
-
-    if (flags & RUBY_DBM_RW_BIT) {
-        flags &= ~RUBY_DBM_RW_BIT;
-        dbm = dbm_open(RSTRING_PTR(file), flags|O_CLOEXEC, mode);
-    }
-    else {
-        dbm = 0;
-        if (mode >= 0) {
-            dbm = dbm_open(RSTRING_PTR(file), O_RDWR|O_CREAT|O_CLOEXEC, mode);
-        }
-        if (!dbm) {
-            dbm = dbm_open(RSTRING_PTR(file), O_RDWR|O_CLOEXEC, 0);
-        }
-        if (!dbm) {
-            dbm = dbm_open(RSTRING_PTR(file), O_RDONLY|O_CLOEXEC, 0);
-        }
-    }
-
-    if (dbm) {
-	/*
-	 * History of dbm_pagfno() and dbm_dirfno() in ndbm and its compatibles.
-	 * (dbm_pagfno() and dbm_dirfno() is not standardized.)
-	 *
-	 * 1986: 4.3BSD provides ndbm.
-	 *       It provides dbm_pagfno() and dbm_dirfno() as macros.
-	 * 1991: gdbm-1.5 provides them as functions.
-	 *       They returns a same descriptor.
-	 *       (Earlier releases may have the functions too.)
-	 * 1991: Net/2 provides Berkeley DB.
-	 *       It doesn't provide dbm_pagfno() and dbm_dirfno().
-	 * 1992: 4.4BSD Alpha provides Berkeley DB with dbm_dirfno() as a function.
-	 *       dbm_pagfno() is a macro as DBM_PAGFNO_NOT_AVAILABLE.
-	 * 1997: Berkeley DB 2.0 is released by Sleepycat Software, Inc.
-	 *       It defines dbm_pagfno() and dbm_dirfno() as macros.
-	 * 2011: gdbm-1.9 creates a separate dir file.
-	 *       dbm_pagfno() and dbm_dirfno() returns different descriptors.
-	 */
-#if defined(HAVE_DBM_PAGFNO)
-        rb_fd_fix_cloexec(dbm_pagfno(dbm));
-#endif
-#if defined(HAVE_DBM_DIRFNO)
-        rb_fd_fix_cloexec(dbm_dirfno(dbm));
-#endif
-
-#if defined(RUBYDBM_DB_HEADER) && defined(HAVE_TYPE_DBC)
-	/* Disable Berkeley DB error messages such as:
-	 * DB->put: attempt to modify a read-only database */
-        ((DBC*)dbm)->dbp->set_errfile(((DBC*)dbm)->dbp, NULL);
-#endif
-    }
-
-    if (!dbm) {
-	if (mode == -1) return Qnil;
-	rb_sys_fail_str(file);
-    }
-
-    if (dbmp->di_dbm)
-	dbm_close(dbmp->di_dbm);
-    dbmp->di_dbm = dbm;
-    dbmp->di_size = -1;
-
-    return obj;
-}
-
-/*
- * call-seq:
- *   DBM.open(filename[, mode[, flags]]) -> dbm
- *   DBM.open(filename[, mode[, flags]]) {|dbm| block}
- *
- * Open a dbm database and yields it if a block is given. See also
- * <code>DBM.new</code>.
- */
-static VALUE
-fdbm_s_open(int argc, VALUE *argv, VALUE klass)
-{
-    VALUE obj = fdbm_alloc(klass);
-
-    if (NIL_P(fdbm_initialize(argc, argv, obj))) {
-	return Qnil;
-    }
-
-    if (rb_block_given_p()) {
-        return rb_ensure(rb_yield, obj, fdbm_close, obj);
-    }
-
-    return obj;
-}
-
-static VALUE
-fdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
-{
-    datum key, value;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    long len;
-
-    ExportStringValue(keystr);
-    len = RSTRING_LEN(keystr);
-    if (TOO_LONG(len)) goto not_found;
-    key.dptr = RSTRING_PTR(keystr);
-    key.dsize = (DSIZE_TYPE)len;
-
-    GetDBM2(obj, dbmp, dbm);
-    value = dbm_fetch(dbm, key);
-    if (value.dptr == 0) {
-      not_found:
-	if (NIL_P(ifnone) && rb_block_given_p()) {
-	    keystr = rb_str_dup(keystr);
-	    return rb_yield(keystr);
-	}
-	return ifnone;
-    }
-    return rb_str_new(value.dptr, value.dsize);
-}
-
-/*
- * call-seq:
- *   dbm[key] -> string value or nil
- *
- * Return a value from the database by locating the key string
- * provided.  If the key is not found, returns nil.
- */
-static VALUE
-fdbm_aref(VALUE obj, VALUE keystr)
-{
-    return fdbm_fetch(obj, keystr, Qnil);
-}
-
-/*
- * call-seq:
- *   dbm.fetch(key[, ifnone]) -> value
- *
- * Return a value from the database by locating the key string
- * provided.  If the key is not found, returns +ifnone+. If +ifnone+
- * is not given, raises IndexError.
- */
-static VALUE
-fdbm_fetch_m(int argc, VALUE *argv, VALUE obj)
-{
-    VALUE keystr, valstr, ifnone;
-
-    rb_scan_args(argc, argv, "11", &keystr, &ifnone);
-    valstr = fdbm_fetch(obj, keystr, ifnone);
-    if (argc == 1 && !rb_block_given_p() && NIL_P(valstr))
-	rb_raise(rb_eIndexError, "key not found");
-
-    return valstr;
-}
-
-/*
- * call (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]