libcdb-ruby 0.0.3-x86-mswin32-60 → 0.0.4-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,5 +1,10 @@
1
1
  = Revision history for libcdb-ruby
2
2
 
3
+ == 0.0.4 [2012-08-09]
4
+
5
+ * Fixed writing with Ruby 1.9.3 on Windows.
6
+ * Fixed leaking CDB pointer when closing reader.
7
+
3
8
  == 0.0.3 [2012-04-02]
4
9
 
5
10
  * Fixed linking error on Mac OS X. (Issue #1 reported by minaguib)
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to libcdb-ruby version 0.0.2
5
+ This documentation refers to libcdb-ruby version 0.0.4
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -63,9 +63,10 @@ creating and reading {constant databases}[http://cr.yp.to/cdb.html].
63
63
  == PREREQUISITES
64
64
 
65
65
  <b></b>
66
- * Ruby 1.8.7+ or 1.9+ (see below for details)
67
- * TinyCDB[http://corpit.ru/mjt/tinycdb.html] headers (not
68
- needed when installing the fat binary gem on Windows)
66
+ * Ruby 1.8.7+ or 1.9+ (see {below}[rdoc-label:label-SUPPORTED+PLATFORMS]
67
+ for details)
68
+ * TinyCDB[http://corpit.ru/mjt/tinycdb.html] headers (not needed when
69
+ installing the fat binary gem on Windows)
69
70
 
70
71
  Debian/Ubuntu:: +libcdb-dev+
71
72
  Fedora/SuSE:: +tinycdb-devel+
@@ -75,8 +76,8 @@ creating and reading {constant databases}[http://cr.yp.to/cdb.html].
75
76
  == SUPPORTED PLATFORMS
76
77
 
77
78
  <b></b>
78
- Linux:: 1.8 & 1.9 (Tested on Ubuntu with 1.8.7p302 and 1.9.3p19)
79
- Windows:: 1.9 only (Tested on XP with 1.9.3p0)
79
+ Linux:: 1.8 & 1.9 (Tested on Ubuntu with 1.8.7p361, 1.9.2p320 and 1.9.3p195)
80
+ Windows:: 1.9 only (Tested on XP with 1.9.2p290 and 1.9.3p194)
80
81
 
81
82
 
82
83
  == LINKS
@@ -503,6 +503,7 @@ rcdb_reader_close(VALUE self) {
503
503
  RCDB_READER_GET(self, cdb);
504
504
  rb_iv_set(self, "closed", Qtrue);
505
505
 
506
+ cdb_free(cdb);
506
507
  rb_io_close(rb_iv_get(self, "@io"));
507
508
 
508
509
  return Qnil;
@@ -77,8 +77,8 @@ rcdb_writer_put_value(struct cdb_make *cdbm, VALUE key, VALUE val, enum cdb_put_
77
77
  case CDB_PUT_INSERT:
78
78
  /* see if key already exists */
79
79
  switch (cdb_make_exists(cdbm,
80
- RSTRING_PTR(key),
81
- RSTRING_LEN(key))) {
80
+ RSTRING_PTR(key),
81
+ RSTRING_LEN(key))) {
82
82
  case 0:
83
83
  /* doesn't exist, add all */
84
84
  mode = CDB_PUT_ADD;
data/lib/libcdb.rb CHANGED
@@ -13,8 +13,8 @@ module LibCDB
13
13
 
14
14
  extend Forwardable
15
15
 
16
- MODE_READ = 'r' # :nodoc:
17
- MODE_WRITE = 'w' # :nodoc:
16
+ MODE_READ = 'r'.freeze # :nodoc:
17
+ MODE_WRITE = 'w'.freeze # :nodoc:
18
18
 
19
19
  class << self
20
20
 
@@ -32,20 +32,12 @@ module LibCDB
32
32
  # <tt>r+</tt>:: CDB (initially opened for reading)
33
33
  # <tt>w+</tt>:: CDB (initially opened for writing)
34
34
  def open(path, mode = MODE_READ)
35
- klass, args = self, []
36
-
37
- case mode
38
- when 'r+' then args = [mode = MODE_READ]
39
- when 'w+' then args = [ MODE_WRITE]
40
- when MODE_READ then klass = Reader
41
- when MODE_WRITE then klass, mode = Writer, 'w+'
42
- else raise ArgumentError, "illegal access mode #{mode}"
43
- end
35
+ klass, args = _open_args(path, mode)
44
36
 
45
37
  cdb = begin
46
- klass.new(io = File.open(path, mode), *args)
38
+ klass.new(*args)
47
39
  rescue
48
- io.close if io
40
+ args.first.close
49
41
  raise
50
42
  end
51
43
 
@@ -86,6 +78,22 @@ module LibCDB
86
78
  }
87
79
  end
88
80
 
81
+ private
82
+
83
+ def _open_args(path, mode)
84
+ klass, args = self, []
85
+
86
+ case mode
87
+ when 'r+' then args = [mode = MODE_READ]
88
+ when 'w+' then args = [ MODE_WRITE]
89
+ when MODE_READ then klass = Reader
90
+ when MODE_WRITE then klass, mode = Writer, 'w+'
91
+ else raise ArgumentError, "illegal access mode #{mode.inspect}"
92
+ end
93
+
94
+ [klass, args.unshift(File.open(path, mode + 'b'))]
95
+ end
96
+
89
97
  end
90
98
 
91
99
  # call-seq:
@@ -102,7 +110,7 @@ module LibCDB
102
110
  case mode
103
111
  when MODE_READ then open_read
104
112
  when MODE_WRITE then open_write
105
- else raise ArgumentError, "illegal access mode #{mode}"
113
+ else raise ArgumentError, "illegal access mode #{mode.inspect}"
106
114
  end
107
115
  end
108
116
 
@@ -248,7 +256,7 @@ module LibCDB
248
256
  @mode = new_mode
249
257
  new_mode += '+' if new_mode == MODE_WRITE
250
258
 
251
- io.reopen(io.path, new_mode)
259
+ io.reopen(io.path, new_mode + 'b')
252
260
  end
253
261
 
254
262
  end
Binary file
@@ -6,7 +6,7 @@ module LibCDB
6
6
 
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 3
9
+ TINY = 4
10
10
 
11
11
  class << self
12
12
 
metadata CHANGED
@@ -1,30 +1,21 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: libcdb-ruby
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: x86-mswin32-60
12
- authors:
7
+ authors:
13
8
  - Jens Wille
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-02 00:00:00 Z
12
+ date: 2012-08-09 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: Ruby bindings for CDB Constant Databases.
22
15
  email: jens.wille@uni-koeln.de
23
16
  executables: []
24
-
25
17
  extensions: []
26
-
27
- extra_rdoc_files:
18
+ extra_rdoc_files:
28
19
  - README
29
20
  - COPYING
30
21
  - ChangeLog
@@ -32,71 +23,61 @@ extra_rdoc_files:
32
23
  - ext/libcdb/ruby_cdb.c
33
24
  - ext/libcdb/ruby_cdb_reader.c
34
25
  - ext/libcdb/ruby_cdb_writer.c
35
- files:
26
+ files:
36
27
  - lib/libcdb-ruby.rb
37
- - lib/libcdb/version.rb
38
28
  - lib/cdb.rb
29
+ - lib/libcdb/version.rb
39
30
  - lib/libcdb.rb
40
- - ChangeLog
41
31
  - COPYING
42
- - README
43
- - Rakefile
44
32
  - TODO
45
- - ext/libcdb/ruby_cdb_writer.h
46
- - ext/libcdb/ruby_cdb.c
47
- - ext/libcdb/ruby_libcdb.h
48
- - ext/libcdb/ruby_cdb_reader.c
49
- - ext/libcdb/ruby_cdb.h
33
+ - ChangeLog
34
+ - Rakefile
35
+ - README
50
36
  - ext/libcdb/ruby_cdb_writer.c
37
+ - ext/libcdb/ruby_cdb.h
38
+ - ext/libcdb/libcdb_ruby.def
51
39
  - ext/libcdb/extconf.rb
40
+ - ext/libcdb/ruby_cdb_writer.h
41
+ - ext/libcdb/ruby_libcdb.h
52
42
  - ext/libcdb/ruby_cdb_reader.h
53
43
  - ext/libcdb/libcdb.c
54
- - ext/libcdb/libcdb_ruby.def
55
- - spec/libcdb/writer_spec.rb
56
- - spec/libcdb/reader_spec.rb
44
+ - ext/libcdb/ruby_cdb_reader.c
45
+ - ext/libcdb/ruby_cdb.c
57
46
  - spec/spec_helper.rb
47
+ - spec/libcdb/reader_spec.rb
48
+ - spec/libcdb/writer_spec.rb
58
49
  - .rspec
59
- - lib/libcdb/1.8/libcdb_ruby.so
60
- - lib/libcdb/1.9/libcdb_ruby.so
50
+ - lib/libcdb/libcdb_ruby.so
61
51
  homepage: http://github.com/blackwinter/libcdb-ruby
62
52
  licenses: []
63
-
64
53
  post_install_message:
65
- rdoc_options:
66
- - --main
67
- - README
54
+ rdoc_options:
68
55
  - --charset
69
56
  - UTF-8
70
- - --title
71
- - libcdb-ruby Application documentation (v0.0.3)
72
- - --all
73
57
  - --line-numbers
74
- require_paths:
58
+ - --all
59
+ - --title
60
+ - libcdb-ruby Application documentation (v0.0.4)
61
+ - --main
62
+ - README
63
+ require_paths:
75
64
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
65
+ required_ruby_version: !ruby/object:Gem::Requirement
77
66
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
- - 0
84
- version: "0"
85
- required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
72
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 3
91
- segments:
92
- - 0
93
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
94
77
  requirements: []
95
-
96
78
  rubyforge_project:
97
- rubygems_version: 1.8.21
79
+ rubygems_version: 1.8.24
98
80
  signing_key:
99
81
  specification_version: 3
100
82
  summary: Ruby bindings for CDB Constant Databases.
101
83
  test_files: []
102
-
Binary file
Binary file