usamin 7.7.4 → 7.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/usamin/usamin.cpp +7 -14
- data/lib/usamin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dc9e7a6a2f8cf8fd04b8bd8063f014dd6b78a04b6727a0d1a60fec9f5dc3bc6
|
4
|
+
data.tar.gz: 8fb71ac883d87559cb9a2d4c993925cf3cff431904e141bf82a652a6f57385c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56d2aa592fc15f8647859d793d025e1a78af802ffc868073997d533b1e62c5563e5d3ec26a0fc5b795fc6c34454e36c4a625cf9f524e51744e9bccba567f6fee
|
7
|
+
data.tar.gz: fcfdd4ec9ebf5437a16aa1584a1450b218040072961d7cd8e4aff0a3d1a1a2f89996665b01fb1b9861c193fb9fa9f3f2b56af139168e5eb9fd90d61f9daae355
|
data/ext/usamin/usamin.cpp
CHANGED
@@ -35,7 +35,7 @@ static inline VALUE get_utf8_str(VALUE str) {
|
|
35
35
|
Check_Type(str, T_STRING);
|
36
36
|
int encoding = rb_enc_get_index(str);
|
37
37
|
if (encoding == utf8index || rb_enc_compatible(str, utf8value) == utf8)
|
38
|
-
return
|
38
|
+
return str;
|
39
39
|
else
|
40
40
|
return rb_str_conv_enc(str, rb_enc_from_index(encoding), utf8);
|
41
41
|
}
|
@@ -52,18 +52,16 @@ static inline bool str_compare(const char* str1, const long len1, const char* st
|
|
52
52
|
return memcmp(str1, str2, len1) == 0;
|
53
53
|
}
|
54
54
|
|
55
|
-
static inline bool str_compare_xx(VALUE
|
55
|
+
static inline bool str_compare_xx(VALUE str1, const rapidjson::Value &str2) {
|
56
56
|
bool free_flag = true;
|
57
57
|
if (RB_TYPE_P(str1, T_STRING)) {
|
58
|
-
|
59
|
-
|
60
|
-
free_flag = false;
|
61
|
-
else
|
62
|
-
str1 = rb_str_conv_enc(str1, rb_enc_from_index(encoding), utf8);
|
58
|
+
str1 = get_utf8_str(str1);
|
59
|
+
free_flag = false;
|
63
60
|
} else if (SYMBOL_P(str1)) {
|
64
|
-
str1 = rb_sym_to_s(str1);
|
61
|
+
str1 = get_utf8_str(rb_sym_to_s(str1));
|
65
62
|
} else {
|
66
63
|
StringValue(str1);
|
64
|
+
str1 = get_utf8_str(str1);
|
67
65
|
}
|
68
66
|
bool ret = str_compare(RSTRING_PTR(str1), RSTRING_LEN(str1), str2.GetString(), str2.GetStringLength());
|
69
67
|
if (free_flag)
|
@@ -129,9 +127,7 @@ static inline VALUE make_array(UsaminValue *value) {
|
|
129
127
|
|
130
128
|
static inline rapidjson::ParseResult parse(rapidjson::Document &doc, const VALUE str, bool fast = false) {
|
131
129
|
VALUE v = get_utf8_str(str);
|
132
|
-
|
133
|
-
rb_str_free(v);
|
134
|
-
return ret;
|
130
|
+
return fast ? doc.Parse<kParseFastFlags>(RSTRING_PTR(v), RSTRING_LEN(v)) : doc.Parse(RSTRING_PTR(v), RSTRING_LEN(v));
|
135
131
|
}
|
136
132
|
|
137
133
|
|
@@ -275,7 +271,6 @@ template <class Writer> static void write(Writer &writer, const VALUE value) {
|
|
275
271
|
{
|
276
272
|
VALUE v = rb_big2str(value, 10);
|
277
273
|
writer.RawValue(RSTRING_PTR(v), static_cast<unsigned int>(RSTRING_LEN(v)), rapidjson::kNumberType);
|
278
|
-
rb_str_free(v);
|
279
274
|
}
|
280
275
|
break;
|
281
276
|
default:
|
@@ -290,13 +285,11 @@ template <class Writer> static void write(Writer &writer, const VALUE value) {
|
|
290
285
|
template <class Writer> static inline void write_str(Writer &writer, const VALUE value) {
|
291
286
|
VALUE v = get_utf8_str(value);
|
292
287
|
writer.String(RSTRING_PTR(v), static_cast<unsigned int>(RSTRING_LEN(v)));
|
293
|
-
rb_str_free(v);
|
294
288
|
}
|
295
289
|
|
296
290
|
template <class Writer> static inline void write_key_str(Writer &writer, const VALUE value) {
|
297
291
|
VALUE v = get_utf8_str(value);
|
298
292
|
writer.Key(RSTRING_PTR(v), static_cast<unsigned int>(RSTRING_LEN(v)));
|
299
|
-
rb_str_free(v);
|
300
293
|
}
|
301
294
|
|
302
295
|
template <class Writer> static inline void write_key_to_s(Writer &writer, const VALUE value) {
|
data/lib/usamin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usamin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.7.
|
4
|
+
version: 7.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ishotihadus
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|