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 +6 -0
- data/README.rdoc +3 -3
- data/ext/msgpack/buffer.c +0 -4
- data/ext/msgpack/compat.h +8 -7
- data/ext/msgpack/extconf.rb +1 -0
- data/ext/msgpack/packer.c +30 -0
- data/ext/msgpack/packer.h +4 -0
- data/ext/msgpack/packer_class.c +2 -0
- data/lib/msgpack/version.rb +1 -1
- metadata +4 -4
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
@@ -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
|
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
|
|
data/ext/msgpack/buffer.c
CHANGED
data/ext/msgpack/compat.h
CHANGED
@@ -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
|
-
|
48
|
-
|
49
|
-
#
|
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
|
-
|
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
|
|
data/ext/msgpack/extconf.rb
CHANGED
data/ext/msgpack/packer.c
CHANGED
@@ -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)
|
data/ext/msgpack/packer.h
CHANGED
@@ -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);
|
data/ext/msgpack/packer_class.c
CHANGED
@@ -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);
|
data/lib/msgpack/version.rb
CHANGED
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:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
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-
|
18
|
+
date: 2012-12-24 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|