Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

segfault when getdup(unknown_key). Fixed, thanks Dmitry. Closes gh-29

  • Loading branch information...
commit 632976b8681723a5225e11469359577c17d74c3b 1 parent 2bcfcb8
@jmettraux authored
View
4 CHANGELOG.txt
@@ -2,7 +2,9 @@
= rufus-tokyo CHANGELOG.txt
-== rufus-tokyo - 1.0.6 not yet released
+== rufus-tokyo - 1.0.6 released 2010/02/01
+
+- gh #29 : segfault when getdup(unknown_key). Fixed, thanks Dmitry
== rufus-tokyo - 1.0.5 released 2010/01/06
View
1  CREDITS.txt
@@ -26,6 +26,7 @@ Mark 'mebaran' http://github.com/mebaran
== feedback / support
+Dmitry A. Ustalov http://github.com/eveel
Aaron Zhang free/tcfree issue
Swerling http://github.com/swerling
Alexandre Gravem
View
1  lib/rufus/tokyo/cabinet/abstract.rb
@@ -562,7 +562,6 @@ def putdup (k, v)
def get4 (k)
l = lib.tcbdbget4(as_btree, k, Rufus::Tokyo.blen(k))
-
Rufus::Tokyo::List.new(l).release
end
alias :getdup :get4
View
4 lib/rufus/tokyo/cabinet/util.rb
@@ -374,7 +374,7 @@ def each
#
def to_a
- self.collect { |e| e }
+ @pointer.address.zero? ? nil : self.collect { |e| e }
end
# Closes (frees) this list
@@ -392,6 +392,8 @@ def free
#
def self.free (list_pointer)
+ return if list_pointer.address.zero?
+
CabinetLib.tclistdel(list_pointer)
end
View
5 spec/cabinet_btree_spec.rb
@@ -32,6 +32,11 @@
@db.getdup('a').should.equal([ 'a0', 'a1' ])
end
+ it 'should return nul when getdupping a missing key' do
+
+ @db.getdup('b').should.equal(nil)
+ end
+
it 'should be able to fetch keys for duplicate values' do
[ %w[John Hornbeck],
%w[Tim Gourley],
View
5 spec/edo_cabinet_btree_spec.rb
@@ -38,6 +38,11 @@
@db.getdup('a').should.equal([ 'a0', 'a1' ])
end
+ it 'should return nul when getdupping a missing key' do
+
+ @db.getdup('b').should.equal(nil)
+ end
+
it 'should be able to fetch keys for duplicate values' do
[ %w[John Hornbeck],
%w[Tim Gourley],
Please sign in to comment.
Something went wrong with that request. Please try again.