fiveruns-memcache-client 1.5.0.4 → 1.5.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ = 1.5.0.5
2
+
3
+ * Remove native C CRC32_ITU_T extension in favor of Zlib's crc32 method.
4
+ memcache-client is now pure Ruby again and will work with JRuby and Rubinius.
5
+
1
6
  = 1.5.0.4
2
7
 
3
8
  * Get test suite working again (packagethief)
@@ -4,38 +4,7 @@ require 'socket'
4
4
  require 'thread'
5
5
  require 'timeout'
6
6
  require 'rubygems'
7
-
8
- class String
9
-
10
- ##
11
- # Uses the ITU-T polynomial in the CRC32 algorithm.
12
- begin
13
- require 'crc32'
14
- def crc32_ITU_T
15
- CRC32.itu_t(self)
16
- end
17
- rescue LoadError => e
18
- puts "Loading with slow CRC32 ITU-T implementation: #{e.message}"
19
-
20
- def crc32_ITU_T
21
- r = 0xFFFFFFFF
22
-
23
- each_byte do |i|
24
- r ^= i
25
- 8.times do
26
- if (r & 1) != 0 then
27
- r = (r>>1) ^ 0xEDB88320
28
- else
29
- r >>= 1
30
- end
31
- end
32
- end
33
-
34
- r ^ 0xFFFFFFFF
35
- end
36
- end
37
-
38
- end
7
+ require 'zlib'
39
8
 
40
9
  ##
41
10
  # A Ruby client library for memcached.
@@ -500,7 +469,7 @@ class MemCache
500
469
  # sketchy for down servers).
501
470
 
502
471
  def hash_for(key)
503
- (key.crc32_ITU_T >> 16) & 0x7fff
472
+ (Zlib.crc32(key) >> 16) & 0x7fff
504
473
  end
505
474
 
506
475
  ##
@@ -164,17 +164,6 @@ class TestMemCache < Test::Unit::TestCase
164
164
  assert_match /get my_namespace:key\r\n/, server.socket.written.string
165
165
  end
166
166
 
167
- def test_crc32_ITU_T
168
- assert_equal 0, ''.crc32_ITU_T
169
- # First value is the fast C version, last value is the pure Ruby version
170
- assert_in [-886631737, 1260851911], 'my_namespace:key'.crc32_ITU_T
171
- assert_in [-224284233, 870540390], 'my_name√space:key'.crc32_ITU_T
172
- end
173
-
174
- def assert_in(possible_values, value)
175
- assert possible_values.include?(value), "#{possible_values.inspect} should contain #{value}"
176
- end
177
-
178
167
  def test_initialize
179
168
  cache = MemCache.new :namespace => 'my_namespace', :readonly => true
180
169
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiveruns-memcache-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.4
4
+ version: 1.5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -19,8 +19,8 @@ description: A Ruby-based memcached client library
19
19
  email: mperham@gmail.com
20
20
  executables: []
21
21
 
22
- extensions:
23
- - ext/crc32/extconf.rb
22
+ extensions: []
23
+
24
24
  extra_rdoc_files: []
25
25
 
26
26
  files:
@@ -30,7 +30,6 @@ files:
30
30
  - Rakefile
31
31
  - lib/memcache.rb
32
32
  - lib/memcache_util.rb
33
- - ext/crc32/crc32.c
34
33
  has_rdoc: false
35
34
  homepage: http://github.com/fiveruns/memcache-client
36
35
  post_install_message:
@@ -1,38 +0,0 @@
1
- #include "ruby.h"
2
- #include "stdio.h"
3
-
4
- static VALUE t_itu_t(VALUE self, VALUE string) {
5
- VALUE str = StringValue(string);
6
- #ifdef RSTRING_LEN
7
- int n = RSTRING_LEN(str);
8
- #else
9
- int n = RSTRING(str)->len;
10
- #endif
11
-
12
- #ifdef RSTRING_PTR
13
- char* p = RSTRING_PTR(str);
14
- #else
15
- char* p = RSTRING(str)->ptr;
16
- #endif
17
-
18
- unsigned long r = 0xFFFFFFFF;
19
- int i, j;
20
-
21
- for (i = 0; i < n; i++) {
22
- r = r ^ p[i];
23
- for (j = 0; j < 8; j++) {
24
- if ( (r & 1) != 0 ) {
25
- r = (r >> 1) ^ 0xEDB88320;
26
- } else {
27
- r = r >> 1;
28
- }
29
- }
30
- }
31
- return INT2FIX(r ^ 0xFFFFFFFF);
32
- }
33
-
34
- VALUE cCRC32;
35
- void Init_crc32() {
36
- cCRC32 = rb_define_module("CRC32");
37
- rb_define_module_function(cCRC32, "itu_t", t_itu_t, 1);
38
- }
@@ -1,5 +0,0 @@
1
- require 'mkmf'
2
-
3
- dir_config("crc32")
4
-
5
- create_makefile("crc32")