ruby-radix 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. data/ext/radix.c +15 -0
  2. data/ruby-radix.gemspec +1 -1
  3. metadata +2 -2
@@ -242,6 +242,9 @@ rb_radix_add(int argc, VALUE *argv, VALUE self)
242
242
  plen = -1;
243
243
  }
244
244
 
245
+ if (TYPE(v_addr) != T_STRING)
246
+ v_addr = rb_obj_as_string(v_addr);
247
+
245
248
  prefix = args_to_prefix(RSTRING_PTR(v_addr), plen);
246
249
  if (prefix == NULL)
247
250
  return Qnil;
@@ -271,6 +274,9 @@ rb_radix_add0(int argc, VALUE *argv, VALUE self)
271
274
  plen = -1;
272
275
  }
273
276
 
277
+ if (TYPE(v_addr) != T_STRING)
278
+ v_addr = rb_obj_as_string(v_addr);
279
+
274
280
  prefix = args_to_prefix(RSTRING_PTR(v_addr), plen);
275
281
  if (prefix == NULL)
276
282
  return Qnil;
@@ -299,6 +305,9 @@ static VALUE rb_radix_delete(int argc, VALUE *argv, VALUE self)
299
305
  plen = -1;
300
306
  }
301
307
 
308
+ if (TYPE(v_addr) != T_STRING)
309
+ v_addr = rb_obj_as_string(v_addr);
310
+
302
311
  prefix = args_to_prefix(RSTRING_PTR(v_addr), plen);
303
312
  if (prefix == NULL)
304
313
  return Qnil;
@@ -349,6 +358,9 @@ rb_radix_search_best(int argc, VALUE *argv, VALUE self)
349
358
  plen = -1;
350
359
  }
351
360
 
361
+ if (TYPE(v_addr) != T_STRING)
362
+ v_addr = rb_obj_as_string(v_addr);
363
+
352
364
  prefix = args_to_prefix(RSTRING_PTR(v_addr), plen);
353
365
  if (prefix == NULL)
354
366
  return Qnil;
@@ -398,6 +410,9 @@ rb_radix_search_exact(int argc, VALUE *argv, VALUE self)
398
410
  plen = -1;
399
411
  }
400
412
 
413
+ if (TYPE(v_addr) != T_STRING)
414
+ v_addr = rb_obj_as_string(v_addr);
415
+
401
416
  prefix = args_to_prefix(RSTRING_PTR(v_addr), plen);
402
417
  if (prefix == NULL)
403
418
  return Qnil;
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ruby-radix"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
  s.authors = ["sogabe"]
5
5
  s.email = ["sogabe@iij.ad.jp"]
6
6
  s.homepage = "https://github.com/iij/ruby-radix"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-radix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-03 00:00:00.000000000 Z
12
+ date: 2013-01-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ruby-radix is an implementation of a radix tree data structure for the
15
15
  storage and retrieval of IPv4 and IPv6 network prefixes.