msgpack 0.5.0 → 0.5.1

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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,104 +9,104 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-20 00:00:00.000000000 Z
12
+ date: 2012-12-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: bundler
15
+ prerelease: false
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
18
  - - ~>
20
19
  - !ruby/object:Gem::Version
21
20
  version: '1.0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
21
  none: false
22
+ name: bundler
23
+ version_requirements: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - ~>
28
26
  - !ruby/object:Gem::Version
29
27
  version: '1.0'
28
+ none: false
29
+ type: :development
30
30
  - !ruby/object:Gem::Dependency
31
- name: rake
31
+ prerelease: false
32
32
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
33
  requirements:
35
34
  - - ~>
36
35
  - !ruby/object:Gem::Version
37
36
  version: 0.9.2
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
37
  none: false
38
+ name: rake
39
+ version_requirements: !ruby/object:Gem::Requirement
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
43
  version: 0.9.2
44
+ none: false
45
+ type: :development
46
46
  - !ruby/object:Gem::Dependency
47
- name: rake-compiler
47
+ prerelease: false
48
48
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
49
  requirements:
51
50
  - - ~>
52
51
  - !ruby/object:Gem::Version
53
52
  version: 0.8.1
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
53
  none: false
54
+ name: rake-compiler
55
+ version_requirements: !ruby/object:Gem::Requirement
58
56
  requirements:
59
57
  - - ~>
60
58
  - !ruby/object:Gem::Version
61
59
  version: 0.8.1
60
+ none: false
61
+ type: :development
62
62
  - !ruby/object:Gem::Dependency
63
- name: rspec
63
+ prerelease: false
64
64
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
65
  requirements:
67
66
  - - ~>
68
67
  - !ruby/object:Gem::Version
69
68
  version: '2.11'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
69
  none: false
70
+ name: rspec
71
+ version_requirements: !ruby/object:Gem::Requirement
74
72
  requirements:
75
73
  - - ~>
76
74
  - !ruby/object:Gem::Version
77
75
  version: '2.11'
76
+ none: false
77
+ type: :development
78
78
  - !ruby/object:Gem::Dependency
79
- name: json
79
+ prerelease: false
80
80
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
81
  requirements:
83
82
  - - ~>
84
83
  - !ruby/object:Gem::Version
85
84
  version: '1.7'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
85
  none: false
86
+ name: json
87
+ version_requirements: !ruby/object:Gem::Requirement
90
88
  requirements:
91
89
  - - ~>
92
90
  - !ruby/object:Gem::Version
93
91
  version: '1.7'
92
+ none: false
93
+ type: :development
94
94
  - !ruby/object:Gem::Dependency
95
- name: yard
95
+ prerelease: false
96
96
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
97
  requirements:
99
98
  - - ~>
100
99
  - !ruby/object:Gem::Version
101
100
  version: 0.8.2
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
101
  none: false
102
+ name: yard
103
+ version_requirements: !ruby/object:Gem::Requirement
106
104
  requirements:
107
105
  - - ~>
108
106
  - !ruby/object:Gem::Version
109
107
  version: 0.8.2
108
+ none: false
109
+ type: :development
110
110
  description: MessagePack is a binary-based efficient object serialization library.
111
111
  It enables to exchange structured objects between many languages like JSON. But
112
112
  unlike JSON, it is very fast and small.
@@ -116,53 +116,100 @@ extensions:
116
116
  - ext/msgpack/extconf.rb
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - .gitignore
120
- - ChangeLog
121
- - Gemfile
122
- - README.rdoc
123
- - Rakefile
124
- - doclib/msgpack.rb
125
- - doclib/msgpack/buffer.rb
126
- - doclib/msgpack/core_ext.rb
127
- - doclib/msgpack/error.rb
128
- - doclib/msgpack/packer.rb
129
- - doclib/msgpack/unpacker.rb
130
- - ext/msgpack/buffer.c
131
- - ext/msgpack/buffer.h
132
- - ext/msgpack/buffer_class.c
133
- - ext/msgpack/buffer_class.h
134
- - ext/msgpack/compat.h
135
- - ext/msgpack/core_ext.c
136
- - ext/msgpack/core_ext.h
137
- - ext/msgpack/extconf.rb
138
- - ext/msgpack/packer.c
139
- - ext/msgpack/packer.h
140
- - ext/msgpack/packer_class.c
141
- - ext/msgpack/packer_class.h
142
- - ext/msgpack/rbinit.c
143
- - ext/msgpack/rmem.c
144
- - ext/msgpack/rmem.h
145
- - ext/msgpack/sysdep.h
146
- - ext/msgpack/sysdep_endian.h
147
- - ext/msgpack/sysdep_types.h
148
- - ext/msgpack/unpacker.c
149
- - ext/msgpack/unpacker.h
150
- - ext/msgpack/unpacker_class.c
151
- - ext/msgpack/unpacker_class.h
152
- - lib/msgpack.rb
153
- - lib/msgpack/version.rb
154
- - msgpack.gemspec
155
- - spec/buffer_io_spec.rb
156
- - spec/buffer_spec.rb
157
- - spec/cases.json
158
- - spec/cases.msg
159
- - spec/cases_compact.msg
160
- - spec/cases_spec.rb
161
- - spec/format_spec.rb
162
- - spec/packer_spec.rb
163
- - spec/random_compat.rb
164
- - spec/spec_helper.rb
165
- - spec/unpacker_spec.rb
119
+ - !binary |-
120
+ LmdpdGlnbm9yZQ==
121
+ - !binary |-
122
+ Q2hhbmdlTG9n
123
+ - !binary |-
124
+ R2VtZmlsZQ==
125
+ - !binary |-
126
+ UkVBRE1FLnJkb2M=
127
+ - !binary |-
128
+ UmFrZWZpbGU=
129
+ - !binary |-
130
+ ZG9jbGliL21zZ3BhY2sucmI=
131
+ - !binary |-
132
+ ZG9jbGliL21zZ3BhY2svYnVmZmVyLnJi
133
+ - !binary |-
134
+ ZG9jbGliL21zZ3BhY2svY29yZV9leHQucmI=
135
+ - !binary |-
136
+ ZG9jbGliL21zZ3BhY2svZXJyb3IucmI=
137
+ - !binary |-
138
+ ZG9jbGliL21zZ3BhY2svcGFja2VyLnJi
139
+ - !binary |-
140
+ ZG9jbGliL21zZ3BhY2svdW5wYWNrZXIucmI=
141
+ - !binary |-
142
+ ZXh0L21zZ3BhY2svYnVmZmVyLmM=
143
+ - !binary |-
144
+ ZXh0L21zZ3BhY2svYnVmZmVyLmg=
145
+ - !binary |-
146
+ ZXh0L21zZ3BhY2svYnVmZmVyX2NsYXNzLmM=
147
+ - !binary |-
148
+ ZXh0L21zZ3BhY2svYnVmZmVyX2NsYXNzLmg=
149
+ - !binary |-
150
+ ZXh0L21zZ3BhY2svY29tcGF0Lmg=
151
+ - !binary |-
152
+ ZXh0L21zZ3BhY2svY29yZV9leHQuYw==
153
+ - !binary |-
154
+ ZXh0L21zZ3BhY2svY29yZV9leHQuaA==
155
+ - !binary |-
156
+ ZXh0L21zZ3BhY2svZXh0Y29uZi5yYg==
157
+ - !binary |-
158
+ ZXh0L21zZ3BhY2svcGFja2VyLmM=
159
+ - !binary |-
160
+ ZXh0L21zZ3BhY2svcGFja2VyLmg=
161
+ - !binary |-
162
+ ZXh0L21zZ3BhY2svcGFja2VyX2NsYXNzLmM=
163
+ - !binary |-
164
+ ZXh0L21zZ3BhY2svcGFja2VyX2NsYXNzLmg=
165
+ - !binary |-
166
+ ZXh0L21zZ3BhY2svcmJpbml0LmM=
167
+ - !binary |-
168
+ ZXh0L21zZ3BhY2svcm1lbS5j
169
+ - !binary |-
170
+ ZXh0L21zZ3BhY2svcm1lbS5o
171
+ - !binary |-
172
+ ZXh0L21zZ3BhY2svc3lzZGVwLmg=
173
+ - !binary |-
174
+ ZXh0L21zZ3BhY2svc3lzZGVwX2VuZGlhbi5o
175
+ - !binary |-
176
+ ZXh0L21zZ3BhY2svc3lzZGVwX3R5cGVzLmg=
177
+ - !binary |-
178
+ ZXh0L21zZ3BhY2svdW5wYWNrZXIuYw==
179
+ - !binary |-
180
+ ZXh0L21zZ3BhY2svdW5wYWNrZXIuaA==
181
+ - !binary |-
182
+ ZXh0L21zZ3BhY2svdW5wYWNrZXJfY2xhc3MuYw==
183
+ - !binary |-
184
+ ZXh0L21zZ3BhY2svdW5wYWNrZXJfY2xhc3MuaA==
185
+ - !binary |-
186
+ bGliL21zZ3BhY2sucmI=
187
+ - !binary |-
188
+ bGliL21zZ3BhY2svdmVyc2lvbi5yYg==
189
+ - !binary |-
190
+ bXNncGFjay5nZW1zcGVj
191
+ - !binary |-
192
+ c3BlYy9idWZmZXJfaW9fc3BlYy5yYg==
193
+ - !binary |-
194
+ c3BlYy9idWZmZXJfc3BlYy5yYg==
195
+ - !binary |-
196
+ c3BlYy9jYXNlcy5qc29u
197
+ - !binary |-
198
+ c3BlYy9jYXNlcy5tc2c=
199
+ - !binary |-
200
+ c3BlYy9jYXNlc19jb21wYWN0Lm1zZw==
201
+ - !binary |-
202
+ c3BlYy9jYXNlc19zcGVjLnJi
203
+ - !binary |-
204
+ c3BlYy9mb3JtYXRfc3BlYy5yYg==
205
+ - !binary |-
206
+ c3BlYy9wYWNrZXJfc3BlYy5yYg==
207
+ - !binary |-
208
+ c3BlYy9yYW5kb21fY29tcGF0LnJi
209
+ - !binary |-
210
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
211
+ - !binary |-
212
+ c3BlYy91bnBhY2tlcl9zcGVjLnJi
166
213
  homepage: http://msgpack.org/
167
214
  licenses: []
168
215
  post_install_message:
@@ -170,39 +217,44 @@ rdoc_options: []
170
217
  require_paths:
171
218
  - lib
172
219
  required_ruby_version: !ruby/object:Gem::Requirement
173
- none: false
174
220
  requirements:
175
221
  - - ! '>='
176
222
  - !ruby/object:Gem::Version
177
223
  version: '0'
178
- segments:
179
- - 0
180
- hash: -2311966328594479476
181
- required_rubygems_version: !ruby/object:Gem::Requirement
182
224
  none: false
225
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
226
  requirements:
184
227
  - - ! '>='
185
228
  - !ruby/object:Gem::Version
186
229
  version: '0'
187
- segments:
188
- - 0
189
- hash: -2311966328594479476
230
+ none: false
190
231
  requirements: []
191
232
  rubyforge_project: msgpack
192
- rubygems_version: 1.8.23
233
+ rubygems_version: 1.8.24
193
234
  signing_key:
194
235
  specification_version: 3
195
236
  summary: MessagePack, a binary-based efficient data interchange format.
196
237
  test_files:
197
- - spec/buffer_io_spec.rb
198
- - spec/buffer_spec.rb
199
- - spec/cases.json
200
- - spec/cases.msg
201
- - spec/cases_compact.msg
202
- - spec/cases_spec.rb
203
- - spec/format_spec.rb
204
- - spec/packer_spec.rb
205
- - spec/random_compat.rb
206
- - spec/spec_helper.rb
207
- - spec/unpacker_spec.rb
238
+ - !binary |-
239
+ c3BlYy9idWZmZXJfaW9fc3BlYy5yYg==
240
+ - !binary |-
241
+ c3BlYy9idWZmZXJfc3BlYy5yYg==
242
+ - !binary |-
243
+ c3BlYy9jYXNlcy5qc29u
244
+ - !binary |-
245
+ c3BlYy9jYXNlcy5tc2c=
246
+ - !binary |-
247
+ c3BlYy9jYXNlc19jb21wYWN0Lm1zZw==
248
+ - !binary |-
249
+ c3BlYy9jYXNlc19zcGVjLnJi
250
+ - !binary |-
251
+ c3BlYy9mb3JtYXRfc3BlYy5yYg==
252
+ - !binary |-
253
+ c3BlYy9wYWNrZXJfc3BlYy5yYg==
254
+ - !binary |-
255
+ c3BlYy9yYW5kb21fY29tcGF0LnJi
256
+ - !binary |-
257
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
258
+ - !binary |-
259
+ c3BlYy91bnBhY2tlcl9zcGVjLnJi
208
260
  has_rdoc: false