msgpack 0.5.0-x86-mingw32 → 0.5.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ 2012-12-23 version 0.5.1:
3
+
4
+ * Fixed compile error with Rubinius 2.0.0-dev
5
+ * Optimized msgpack_packer_write_hash for Rubinius
6
+
7
+
2
8
  2012-12-20 version 0.5.0:
3
9
 
4
10
  * Rewrote all code and improved performance significantly
@@ -54,7 +54,7 @@ Packer provides advanced API to serialize objects in streaming style:
54
54
  pk = MessagePack::Packer.new(io)
55
55
  pk.write_array_header(2).write(e1).write(e2).flush
56
56
 
57
- See API reference for details.
57
+ See {API reference}[http://ruby.msgpack.org/MessagePack/Packer.html] for details.
58
58
 
59
59
  = Deserializing objects
60
60
 
@@ -83,14 +83,14 @@ or event-driven style which works well with EventMachine:
83
83
  }
84
84
  end
85
85
 
86
- See API reference for details.
86
+ See {API reference}[http://ruby.msgpack.org/MessagePack/Unpacker.html] for details.
87
87
 
88
88
 
89
89
  = Buffer API
90
90
 
91
91
  MessagePack for Ruby provides a buffer API so that you can read or write data by hand, not via Packer or Unpacker API.
92
92
 
93
- This MessagePack::Buffer API is backed with a fixed-length shared memory pool which is very fast for small data (<= 4KB),
93
+ This {MessagePack::Buffer}[http://ruby.msgpack.org/MessagePack/Buffer.html] is backed with a fixed-length shared memory pool which is very fast for small data (<= 4KB),
94
94
  and has zero-copy capability which significantly affects performance to handle large binary data.
95
95
 
96
96
 
@@ -23,10 +23,6 @@
23
23
  int s_enc_ascii8bit;
24
24
  #endif
25
25
 
26
- #ifdef RUBY_VM
27
- #define HAVE_RB_STR_REPLACE
28
- #endif
29
-
30
26
  #ifndef HAVE_RB_STR_REPLACE
31
27
  static ID s_replace;
32
28
  #endif
@@ -42,17 +42,18 @@
42
42
 
43
43
  /*
44
44
  * define STR_DUP_LIKELY_DOES_COPY
45
+ * check rb_str_dup actually copies the string or not
45
46
  */
46
- #if defined(RUBY_VM) /* MRI 1.9 */
47
- /* if FL_ALL(str, FL_USER1|FL_USER3) == STR_ASSOC_P(str) returns true,
48
- * rb_str_dup will copy the string */
49
- # define STR_DUP_LIKELY_DOES_COPY(str) FL_ALL(str, FL_USER1|FL_USER3)
47
+ #if defined(RUBY_VM) && defined(FL_ALL) && defined(FL_USER1) && defined(FL_USER3) /* MRI 1.9 */
48
+ # define STR_DUP_LIKELY_DOES_COPY(str) FL_ALL(str, FL_USER1|FL_USER3) /* same as STR_ASSOC_P(str) */
49
+
50
+ #elif defined(FL_TEST) && defined(ELTS_SHARED) /* MRI 1.8 */
51
+ # define STR_DUP_LIKELY_DOES_COPY(str) (!FL_TEST(str, ELTS_SHARED))
50
52
 
51
- #elif defined(RUBINIUS) || defined(JRUBY) /* Rubinius and JRuby */
53
+ //#elif defined(RUBINIUS) || defined(JRUBY) /* Rubinius and JRuby */
54
+ #else
52
55
  # define STR_DUP_LIKELY_DOES_COPY(str) (1)
53
56
 
54
- #else /* MRI 1.8 */
55
- # define STR_DUP_LIKELY_DOES_COPY(str) (!FL_TEST(str, ELTS_SHARED))
56
57
  #endif
57
58
 
58
59
 
@@ -2,6 +2,7 @@ require 'mkmf'
2
2
 
3
3
  have_header("ruby/st.h")
4
4
  have_header("st.h")
5
+ have_func("rb_str_replace", ["ruby.h"])
5
6
 
6
7
  $CFLAGS << %[ -I.. -Wall -O3 -g -std=c99]
7
8
  #$CFLAGS << %[ -DDISABLE_RMEM]
@@ -18,6 +18,26 @@
18
18
 
19
19
  #include "packer.h"
20
20
 
21
+ #ifdef RUBINIUS
22
+ static ID s_to_iter;
23
+ static ID s_next;
24
+ static ID s_key;
25
+ static ID s_value;
26
+ #endif
27
+
28
+ void msgpack_packer_static_init()
29
+ {
30
+ #ifdef RUBINIUS
31
+ s_to_iter = rb_intern("to_iter");
32
+ s_next = rb_intern("next");
33
+ s_key = rb_intern("key");
34
+ s_value = rb_intern("value");
35
+ #endif
36
+ }
37
+
38
+ void msgpack_packer_static_destroy()
39
+ { }
40
+
21
41
  void msgpack_packer_init(msgpack_packer_t* pk)
22
42
  {
23
43
  memset(pk, 0, sizeof(msgpack_packer_t));
@@ -89,7 +109,17 @@ void msgpack_packer_write_hash_value(msgpack_packer_t* pk, VALUE v)
89
109
  unsigned int len32 = (unsigned int)len;
90
110
  msgpack_packer_write_map_header(pk, len32);
91
111
 
112
+ #ifdef RUBINIUS
113
+ VALUE iter = rb_funcall(v, s_to_iter, 0);
114
+ VALUE entry = Qnil;
115
+ while(RTEST(entry = rb_funcall(iter, s_next, 1, entry))) {
116
+ VALUE key = rb_funcall(entry, s_key, 0);
117
+ VALUE val = rb_funcall(entry, s_value, 0);
118
+ write_hash_foreach(key, val, (VALUE) pk);
119
+ }
120
+ #else
92
121
  rb_hash_foreach(v, write_hash_foreach, (VALUE) pk);
122
+ #endif
93
123
  }
94
124
 
95
125
  static void _msgpack_packer_write_other_value(msgpack_packer_t* pk, VALUE v)
@@ -41,6 +41,10 @@ struct msgpack_packer_t {
41
41
 
42
42
  #define PACKER_BUFFER_(pk) (&(pk)->buffer)
43
43
 
44
+ void msgpack_packer_static_init();
45
+
46
+ void msgpack_packer_static_destroy();
47
+
44
48
  void msgpack_packer_init(msgpack_packer_t* pk);
45
49
 
46
50
  void msgpack_packer_destroy(msgpack_packer_t* pk);
@@ -250,6 +250,8 @@ void MessagePack_Packer_module_init(VALUE mMessagePack)
250
250
  s_to_msgpack = rb_intern("to_msgpack");
251
251
  s_write = rb_intern("write");
252
252
 
253
+ msgpack_packer_static_init();
254
+
253
255
  cMessagePack_Packer = rb_define_class_under(mMessagePack, "Packer", rb_cObject);
254
256
 
255
257
  rb_define_alloc_func(cMessagePack_Packer, Packer_alloc);
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - FURUHASHI Sadayuki
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-21 00:00:00 +09:00
18
+ date: 2012-12-24 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency