java_bin 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -12,12 +12,16 @@ This is a Solr JavaBin format implementation for Ruby.
12
12
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
13
  * Send me a pull request. Bonus points for topic branches.
14
14
 
15
- === References
15
+ == Install
16
+
17
+ gem install java_bin
18
+
19
+ == References
16
20
 
17
21
  * http://wiki.apache.org/solr/javabin
18
22
  * http://svn.apache.org/viewvc/lucene/solr/trunk/src/common/org/apache/solr/common/util/JavaBinCodec.java?view=markup
19
23
 
20
- === Author
24
+ == Author
21
25
 
22
26
  Toshinori Kajihara <mailto:kennyj@gmail.com>
23
27
 
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  require 'rake/testtask'
22
22
  Rake::TestTask.new(:test) do |test|
23
- test.libs << 'lib' << 'test'
23
+ test.libs << 'lib' << 'test' << 'ext'
24
24
  test.pattern = 'test/**/test_*.rb'
25
25
  test.verbose = true
26
26
  end
data/TODO CHANGED
@@ -1,4 +1,3 @@
1
- * gem化
2
1
  * 他のgemの依存関係
3
2
  ** rsolr/solr-rubyのmonkey-patch
4
3
  * hashのキーをsymbolにする
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -260,8 +260,10 @@ static VALUE JavaBinParser_read_val(JAVA_BIN_PARSER* ptr) {
260
260
 
261
261
  static void JavaBinParser_free(JAVA_BIN_PARSER* ptr) {
262
262
  if (ptr) {
263
- // free(ptr->data);
264
- free(ptr->cache);
263
+ //free(ptr->data);
264
+ if (ptr->cache) {
265
+ free(ptr->cache);
266
+ }
265
267
  free(ptr);
266
268
  }
267
269
  }
@@ -311,11 +313,11 @@ static VALUE rb_cParser_parse(VALUE self, VALUE data) {
311
313
  rb_raise(rb_eRuntimeError, "rb_cParser_parse - data is empty.");
312
314
  }
313
315
 
314
- // ptr->data = (unsigned char*) malloc(dataLen);
315
- // if (!ptr->data) {
316
- // rb_raise(rb_eRuntimeError, "rb_cParser_parse - allocate error");
317
- // }
318
- // memcpy(ptr->data, ptrData, dataLen);
316
+ //ptr->data = (unsigned char*) malloc(dataLen);
317
+ //if (!ptr->data) {
318
+ // rb_raise(rb_eRuntimeError, "rb_cParser_parse - allocate error");
319
+ //}
320
+ //memcpy(ptr->data, ptrData, dataLen);
319
321
  ptr->data = (unsigned char*)ptrData;
320
322
  ptr->data_len = dataLen;
321
323
 
@@ -344,6 +346,10 @@ static VALUE rb_cParser_initialize(VALUE self) {
344
346
  rb_raise(rb_eRuntimeError, "rb_cParser_initialize - allocate error");
345
347
  }
346
348
  DATA_PTR(self) = ptr;
349
+
350
+ /* 参照文字列の準備(ここでも初期化しておかないと、たまにsegしちゃいますruby 1.8.7) */
351
+ ptr->cache = NULL;
352
+ ptr->cache_index = 0;
347
353
 
348
354
  return self;
349
355
  }
@@ -361,7 +367,7 @@ void Init_parser(void) {
361
367
  rb_mJavaBin = rb_define_module("JavaBin");
362
368
  rb_mExt = rb_define_module_under(rb_mJavaBin, "Ext");
363
369
  rb_cParser = rb_define_class_under(rb_mExt, "Parser", rb_cObject);
364
-
370
+
365
371
  /* メモリーアロケーター設定 */
366
372
  rb_define_alloc_func(rb_cParser, JavaBinParser_alloc);
367
373
  /* コンストラクタ */
data/java_bin.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{java_bin}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kennyj"]
12
- s.date = %q{2010-01-11}
12
+ s.date = %q{2010-01-12}
13
13
  s.description = %q{Solr JavaBin format implementation for Ruby.}
14
14
  s.email = %q{kennyj@gmail.com}
15
15
  s.extensions = ["ext/java_bin/ext/extconf.rb"]
@@ -49,8 +49,8 @@ Gem::Specification.new do |s|
49
49
  s.rubygems_version = %q{1.3.5}
50
50
  s.summary = %q{Solr JavaBin format implementation for Ruby.}
51
51
  s.test_files = [
52
- "test/xxx_performance.rb",
53
- "test/test_java_bin_parser.rb",
52
+ "test/test_java_bin_parser.rb",
53
+ "test/xxx_performance.rb",
54
54
  "test/helper.rb"
55
55
  ]
56
56
 
@@ -1,4 +1,5 @@
1
1
  # vim:fileencoding=utf-8
2
+ require 'stringio'
2
3
  require 'helper'
3
4
 
4
5
  case ENV['JavaBin']
@@ -9,7 +10,7 @@ else
9
10
  require 'java_bin/ext'
10
11
  end
11
12
 
12
- class TestJavaBin < Test::Unit::TestCase
13
+ class TestJavaBinParser < Test::Unit::TestCase
13
14
 
14
15
  private
15
16
  def write_v_int(i, output)
@@ -72,7 +73,7 @@ class TestJavaBin < Test::Unit::TestCase
72
73
  puts ""
73
74
  r_et = elapsed_time("ruby eval parse. ", TIMES) { eval(r) }
74
75
  jb_et = elapsed_time("javabin parse. ", TIMES) { @parser.parse(jb) }
75
- assert (jb_et * 3) < r_et if @parser.is_a? JavaBin::Ext::Parser
76
+ assert (jb_et * 2) < r_et if @parser.is_a? JavaBin::Ext::Parser
76
77
  end
77
78
 
78
79
  def test_null
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: java_bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kennyj
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-11 00:00:00 +09:00
12
+ date: 2010-01-12 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -77,6 +77,6 @@ signing_key:
77
77
  specification_version: 3
78
78
  summary: Solr JavaBin format implementation for Ruby.
79
79
  test_files:
80
- - test/xxx_performance.rb
81
80
  - test/test_java_bin_parser.rb
81
+ - test/xxx_performance.rb
82
82
  - test/helper.rb