fast_trie 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 4
4
- :build:
3
+ :minor: 5
5
4
  :patch: 0
5
+ :build:
@@ -81,7 +81,7 @@ static VALUE rb_trie_has_key(VALUE self, VALUE key) {
81
81
  Trie *trie;
82
82
  Data_Get_Struct(self, Trie, trie);
83
83
 
84
- if(trie_has_key(trie, (TrieChar*)RSTRING(key)->ptr))
84
+ if(trie_has_key(trie, (TrieChar*)RSTRING_PTR(key)))
85
85
  return Qtrue;
86
86
  else
87
87
  return Qnil;
@@ -102,7 +102,7 @@ static VALUE rb_trie_get(VALUE self, VALUE key) {
102
102
  Data_Get_Struct(self, Trie, trie);
103
103
 
104
104
  TrieData data;
105
- if(trie_retrieve(trie, (TrieChar*)RSTRING(key)->ptr, &data))
105
+ if(trie_retrieve(trie, (TrieChar*)RSTRING_PTR(key), &data))
106
106
  return (VALUE)data;
107
107
  else
108
108
  return Qnil;
@@ -120,17 +120,17 @@ static VALUE rb_trie_add(VALUE self, VALUE args) {
120
120
  Trie *trie;
121
121
  Data_Get_Struct(self, Trie, trie);
122
122
 
123
- int size = RARRAY(args)->len;
123
+ int size = RARRAY_LEN(args);
124
124
  if(size < 1 || size > 2)
125
125
  return Qnil;
126
126
 
127
127
  VALUE key;
128
- key = RARRAY(args)->ptr[0];
128
+ key = RARRAY_PTR(args)[0];
129
129
  StringValue(key);
130
130
 
131
- TrieData value = size == 2 ? RARRAY(args)->ptr[1] : TRIE_DATA_ERROR;
131
+ TrieData value = size == 2 ? RARRAY_PTR(args)[1] : TRIE_DATA_ERROR;
132
132
 
133
- if(trie_store(trie, (TrieChar*)RSTRING(key)->ptr, value))
133
+ if(trie_store(trie, (TrieChar*)RSTRING_PTR(key), value))
134
134
  return Qtrue;
135
135
  else
136
136
  return Qnil;
@@ -149,7 +149,7 @@ static VALUE rb_trie_delete(VALUE self, VALUE key) {
149
149
  Trie *trie;
150
150
  Data_Get_Struct(self, Trie, trie);
151
151
 
152
- if(trie_delete(trie, (TrieChar*)RSTRING(key)->ptr))
152
+ if(trie_delete(trie, (TrieChar*)RSTRING_PTR(key)))
153
153
  return Qtrue;
154
154
  else
155
155
  return Qnil;
@@ -195,10 +195,10 @@ static VALUE rb_trie_children(VALUE self, VALUE prefix) {
195
195
  Trie *trie;
196
196
  Data_Get_Struct(self, Trie, trie);
197
197
 
198
- int prefix_size = RSTRING(prefix)->len;
198
+ int prefix_size = RSTRING_LEN(prefix);
199
199
  TrieState *state = trie_root(trie);
200
200
  VALUE children = rb_ary_new();
201
- TrieChar *char_prefix = (TrieChar*)RSTRING(prefix)->ptr;
201
+ TrieChar *char_prefix = (TrieChar*)RSTRING_PTR(prefix);
202
202
 
203
203
  const TrieChar *iterator = char_prefix;
204
204
  while(*iterator != 0) {
@@ -273,8 +273,8 @@ static VALUE rb_trie_children_with_values(VALUE self, VALUE prefix) {
273
273
  Trie *trie;
274
274
  Data_Get_Struct(self, Trie, trie);
275
275
 
276
- int prefix_size = RSTRING(prefix)->len;
277
- TrieChar *char_prefix = (TrieChar*)RSTRING(prefix)->ptr;
276
+ int prefix_size = RSTRING_LEN(prefix);
277
+ TrieChar *char_prefix = (TrieChar*)RSTRING_PTR(prefix);
278
278
 
279
279
  VALUE children = rb_ary_new();
280
280
 
@@ -398,10 +398,10 @@ static VALUE rb_trie_node_walk_bang(VALUE self, VALUE rchar) {
398
398
  TrieState *state;
399
399
  Data_Get_Struct(self, TrieState, state);
400
400
 
401
- if(RSTRING(rchar)->len != 1)
401
+ if(RSTRING_LEN(rchar) != 1)
402
402
  return Qnil;
403
403
 
404
- Bool result = trie_state_walk(state, *RSTRING(rchar)->ptr);
404
+ Bool result = trie_state_walk(state, *RSTRING_PTR(rchar));
405
405
 
406
406
  if(result) {
407
407
  rb_iv_set(self, "@state", rchar);
@@ -429,10 +429,10 @@ static VALUE rb_trie_node_walk(VALUE self, VALUE rchar) {
429
429
  TrieState *state;
430
430
  Data_Get_Struct(new_node, TrieState, state);
431
431
 
432
- if(RSTRING(rchar)->len != 1)
432
+ if(RSTRING_LEN(rchar) != 1)
433
433
  return Qnil;
434
434
 
435
- Bool result = trie_state_walk(state, *RSTRING(rchar)->ptr);
435
+ Bool result = trie_state_walk(state, *RSTRING_PTR(rchar));
436
436
 
437
437
  if(result) {
438
438
  rb_iv_set(new_node, "@state", rchar);
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_trie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 4
7
+ - 5
9
8
  - 0
10
- version: 0.4.0
9
+ version: 0.5.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Tyler McMullen
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-09-21 00:00:00 -07:00
17
+ date: 2010-12-21 00:00:00 -08:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -31,12 +30,6 @@ extra_rdoc_files:
31
30
  files:
32
31
  - README.textile
33
32
  - VERSION.yml
34
- - ext/darray.o
35
- - ext/fileutils.o
36
- - ext/tail.o
37
- - ext/trie-private.o
38
- - ext/trie.bundle
39
- - ext/trie.o
40
33
  - ext/trie/darray.c
41
34
  - ext/trie/darray.h
42
35
  - ext/trie/extconf.rb
@@ -73,7 +66,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
66
  requirements:
74
67
  - - ">="
75
68
  - !ruby/object:Gem::Version
76
- hash: 3
77
69
  segments:
78
70
  - 0
79
71
  version: "0"
@@ -82,7 +74,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
74
  requirements:
83
75
  - - ">="
84
76
  - !ruby/object:Gem::Version
85
- hash: 3
86
77
  segments:
87
78
  - 0
88
79
  version: "0"
Binary file
Binary file
data/ext/tail.o DELETED
Binary file
Binary file
Binary file
data/ext/trie.o DELETED
Binary file