dbm 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/ext/dbm/dbm.c +24 -23
  3. data/ext/dbm/extconf.rb +4 -2
  4. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a41f0541a5b1ca11d6e5fd00833ba33e351eb902d20c8ec39e0c3014a349653
4
- data.tar.gz: 554e59b084ca58459e020fcc72bc0f3a295500b1b9271eaa2875beb2d8bb6f78
3
+ metadata.gz: fcbc9c6af29e76a1546f65dd589d42dc37e144ee1b4e79d0246059eefd6b757c
4
+ data.tar.gz: 73f4ead14bf9420540b06c299a452b2133b90fd889258ca4381cd9cb2fe72d12
5
5
  SHA512:
6
- metadata.gz: 875a4d5ff103150e3c76aae3598d0f29f7ec05f9d1daf88a7071d611f12aa2292073fa598737fbfd6e962156bffa469507654f1830cbd794ddf195b2620e62c5
7
- data.tar.gz: 238be2641e4b18103f54cd5298b4bec0d4d334a4b33d75af9ce1079c7fc1dd6219b0045878f7dc2da85e59f872d8120255cedb2dbee620df437d9323c4bb4e49
6
+ metadata.gz: f1d2da0344a7c3f7540798f94d673298471ad908b657e0bacc5e01c4873133741d2cfcfdd34feb032b2fad5dbcaf0e0dd2da2ab00d24ce269dc1f7f95a442960
7
+ data.tar.gz: f9d641e66a7bf434afabc723d43f27e52167be3b175fdc379b91c120672caff747b33f9941faa2679b59fb13690045f1370dae7802490edba0cbff12ff99dcf7
@@ -39,6 +39,8 @@ struct dbmdata {
39
39
  DBM *di_dbm;
40
40
  };
41
41
 
42
+ NORETURN(static void closed_dbm(void));
43
+
42
44
  static void
43
45
  closed_dbm(void)
44
46
  {
@@ -277,12 +279,11 @@ fdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
277
279
  not_found:
278
280
  if (NIL_P(ifnone) && rb_block_given_p()) {
279
281
  keystr = rb_str_dup(keystr);
280
- OBJ_TAINT(keystr);
281
282
  return rb_yield(keystr);
282
283
  }
283
284
  return ifnone;
284
285
  }
285
- return rb_tainted_str_new(value.dptr, value.dsize);
286
+ return rb_str_new(value.dptr, value.dsize);
286
287
  }
287
288
 
288
289
  /*
@@ -342,7 +343,7 @@ fdbm_key(VALUE obj, VALUE valstr)
342
343
  val = dbm_fetch(dbm, key);
343
344
  if ((long)val.dsize == RSTRING_LEN(valstr) &&
344
345
  memcmp(val.dptr, RSTRING_PTR(valstr), val.dsize) == 0) {
345
- return rb_tainted_str_new(key.dptr, key.dsize);
346
+ return rb_str_new(key.dptr, key.dsize);
346
347
  }
347
348
  }
348
349
  return Qnil;
@@ -375,8 +376,8 @@ fdbm_select(VALUE obj)
375
376
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
376
377
  VALUE assoc, v;
377
378
  val = dbm_fetch(dbm, key);
378
- assoc = rb_assoc_new(rb_tainted_str_new(key.dptr, key.dsize),
379
- rb_tainted_str_new(val.dptr, val.dsize));
379
+ assoc = rb_assoc_new(rb_str_new(key.dptr, key.dsize),
380
+ rb_str_new(val.dptr, val.dsize));
380
381
  v = rb_yield(assoc);
381
382
  if (RTEST(v)) {
382
383
  rb_ary_push(new, assoc);
@@ -444,7 +445,7 @@ fdbm_delete(VALUE obj, VALUE keystr)
444
445
  }
445
446
 
446
447
  /* need to save value before dbm_delete() */
447
- valstr = rb_tainted_str_new(value.dptr, value.dsize);
448
+ valstr = rb_str_new(value.dptr, value.dsize);
448
449
 
449
450
  if (dbm_delete(dbm, key)) {
450
451
  dbmp->di_size = -1;
@@ -479,8 +480,8 @@ fdbm_shift(VALUE obj)
479
480
  key = dbm_firstkey(dbm);
480
481
  if (!key.dptr) return Qnil;
481
482
  val = dbm_fetch(dbm, key);
482
- keystr = rb_tainted_str_new(key.dptr, key.dsize);
483
- valstr = rb_tainted_str_new(val.dptr, val.dsize);
483
+ keystr = rb_str_new(key.dptr, key.dsize);
484
+ valstr = rb_str_new(val.dptr, val.dsize);
484
485
  dbm_delete(dbm, key);
485
486
 
486
487
  return rb_assoc_new(keystr, valstr);
@@ -512,9 +513,9 @@ fdbm_delete_if(VALUE obj)
512
513
 
513
514
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
514
515
  val = dbm_fetch(dbm, key);
515
- keystr = rb_tainted_str_new(key.dptr, key.dsize);
516
+ keystr = rb_str_new(key.dptr, key.dsize);
516
517
  OBJ_FREEZE(keystr);
517
- valstr = rb_tainted_str_new(val.dptr, val.dsize);
518
+ valstr = rb_str_new(val.dptr, val.dsize);
518
519
  ret = rb_protect(rb_yield, rb_assoc_new(rb_str_dup(keystr), valstr), &status);
519
520
  if (status != 0) break;
520
521
  if (RTEST(ret)) rb_ary_push(ary, keystr);
@@ -581,8 +582,8 @@ fdbm_invert(VALUE obj)
581
582
  GetDBM2(obj, dbmp, dbm);
582
583
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
583
584
  val = dbm_fetch(dbm, key);
584
- keystr = rb_tainted_str_new(key.dptr, key.dsize);
585
- valstr = rb_tainted_str_new(val.dptr, val.dsize);
585
+ keystr = rb_str_new(key.dptr, key.dsize);
586
+ valstr = rb_str_new(val.dptr, val.dsize);
586
587
  rb_hash_aset(hash, valstr, keystr);
587
588
  }
588
589
  return hash;
@@ -742,7 +743,7 @@ fdbm_each_value(VALUE obj)
742
743
  GetDBM2(obj, dbmp, dbm);
743
744
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
744
745
  val = dbm_fetch(dbm, key);
745
- rb_yield(rb_tainted_str_new(val.dptr, val.dsize));
746
+ rb_yield(rb_str_new(val.dptr, val.dsize));
746
747
  GetDBM2(obj, dbmp, dbm);
747
748
  }
748
749
  return obj;
@@ -765,7 +766,7 @@ fdbm_each_key(VALUE obj)
765
766
 
766
767
  GetDBM2(obj, dbmp, dbm);
767
768
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
768
- rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
769
+ rb_yield(rb_str_new(key.dptr, key.dsize));
769
770
  GetDBM2(obj, dbmp, dbm);
770
771
  }
771
772
  return obj;
@@ -792,8 +793,8 @@ fdbm_each_pair(VALUE obj)
792
793
 
793
794
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
794
795
  val = dbm_fetch(dbm, key);
795
- keystr = rb_tainted_str_new(key.dptr, key.dsize);
796
- valstr = rb_tainted_str_new(val.dptr, val.dsize);
796
+ keystr = rb_str_new(key.dptr, key.dsize);
797
+ valstr = rb_str_new(val.dptr, val.dsize);
797
798
  rb_yield(rb_assoc_new(keystr, valstr));
798
799
  GetDBM2(obj, dbmp, dbm);
799
800
  }
@@ -819,7 +820,7 @@ fdbm_keys(VALUE obj)
819
820
 
820
821
  ary = rb_ary_new();
821
822
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
822
- rb_ary_push(ary, rb_tainted_str_new(key.dptr, key.dsize));
823
+ rb_ary_push(ary, rb_str_new(key.dptr, key.dsize));
823
824
  }
824
825
 
825
826
  return ary;
@@ -843,7 +844,7 @@ fdbm_values(VALUE obj)
843
844
  ary = rb_ary_new();
844
845
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
845
846
  val = dbm_fetch(dbm, key);
846
- rb_ary_push(ary, rb_tainted_str_new(val.dptr, val.dsize));
847
+ rb_ary_push(ary, rb_str_new(val.dptr, val.dsize));
847
848
  }
848
849
 
849
850
  return ary;
@@ -929,8 +930,8 @@ fdbm_to_a(VALUE obj)
929
930
  ary = rb_ary_new();
930
931
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
931
932
  val = dbm_fetch(dbm, key);
932
- rb_ary_push(ary, rb_assoc_new(rb_tainted_str_new(key.dptr, key.dsize),
933
- rb_tainted_str_new(val.dptr, val.dsize)));
933
+ rb_ary_push(ary, rb_assoc_new(rb_str_new(key.dptr, key.dsize),
934
+ rb_str_new(val.dptr, val.dsize)));
934
935
  }
935
936
 
936
937
  return ary;
@@ -955,8 +956,8 @@ fdbm_to_hash(VALUE obj)
955
956
  hash = rb_hash_new();
956
957
  for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
957
958
  val = dbm_fetch(dbm, key);
958
- rb_hash_aset(hash, rb_tainted_str_new(key.dptr, key.dsize),
959
- rb_tainted_str_new(val.dptr, val.dsize));
959
+ rb_hash_aset(hash, rb_str_new(key.dptr, key.dsize),
960
+ rb_str_new(val.dptr, val.dsize));
960
961
  }
961
962
 
962
963
  return hash;
@@ -992,7 +993,7 @@ fdbm_reject(VALUE obj)
992
993
  * It is based on dbm library in Unix Version 7 but has different API to
993
994
  * support multiple databases in a process.
994
995
  * - {Berkeley DB}[http://en.wikipedia.org/wiki/Berkeley_DB] versions
995
- * 1 thru 5, also known as BDB and Sleepycat DB, now owned by Oracle
996
+ * 1 thru 6, also known as BDB and Sleepycat DB, now owned by Oracle
996
997
  * Corporation.
997
998
  * - Berkeley DB 1.x, still found in 4.4BSD derivatives (FreeBSD, OpenBSD, etc).
998
999
  * - {gdbm}[http://www.gnu.org/software/gdbm/], the GNU implementation of dbm.
@@ -7,6 +7,7 @@
7
7
  # db Berkeley DB (libdb)
8
8
  # db2 Berkeley DB (libdb2)
9
9
  # db1 Berkeley DB (libdb1)
10
+ # db6 Berkeley DB (libdb6)
10
11
  # db5 Berkeley DB (libdb5)
11
12
  # db4 Berkeley DB (libdb4)
12
13
  # db3 Berkeley DB (libdb3)
@@ -23,7 +24,7 @@ dir_config("dbm")
23
24
  if dblib = with_config("dbm-type", nil)
24
25
  dblib = dblib.split(/[ ,]+/)
25
26
  else
26
- dblib = %w(libc db db2 db1 db5 db4 db3 gdbm_compat gdbm qdbm)
27
+ dblib = %w(libc db db2 db1 db6 db5 db4 db3 gdbm_compat gdbm qdbm)
27
28
  end
28
29
 
29
30
  headers = {
@@ -34,6 +35,7 @@ headers = {
34
35
  "db3" => ["db3/db.h", "db3.h", "db.h"],
35
36
  "db4" => ["db4/db.h", "db4.h", "db.h"],
36
37
  "db5" => ["db5/db.h", "db5.h", "db.h"],
38
+ "db6" => ["db6/db.h", "db6.h", "db.h"],
37
39
  "gdbm_compat" => ["gdbm-ndbm.h", "gdbm/ndbm.h", "ndbm.h"], # GDBM since 1.8.1
38
40
  "gdbm" => ["gdbm-ndbm.h", "gdbm/ndbm.h", "ndbm.h"], # GDBM until 1.8.0
39
41
  "qdbm" => ["qdbm/relic.h", "relic.h"],
@@ -131,7 +133,7 @@ def headers.db_check2(db, hdr)
131
133
  hsearch = nil
132
134
 
133
135
  case db
134
- when /^db[2-5]?$/
136
+ when /^db[2-6]?$/
135
137
  hsearch = "-DDB_DBM_HSEARCH"
136
138
  when "gdbm_compat"
137
139
  have_library("gdbm") or return false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yukihiro Matsumoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-08 00:00:00.000000000 Z
11
+ date: 2019-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -67,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubyforge_project:
71
- rubygems_version: 2.7.3
70
+ rubygems_version: 3.0.3
72
71
  signing_key:
73
72
  specification_version: 4
74
73
  summary: Provides a wrapper for the UNIX-style Database Manager Library