usamin 7.7.6 → 7.7.7
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 +30 -9
- 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: 7413ecd5a577b354f0a536da1b2bd451b5ea59e1b19d2c7875f34371769071f4
|
4
|
+
data.tar.gz: '08a17cb48a760174d1fb5bdbd70fbbb68b65ad1070e91b2cbbdde14452a74d49'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb85ee9718f07ef82f87992a38400159fb5601c9479e13718e89bb50e0d4c4a8acf61790efe4cf4a0fa3ab890e1650adf0749c570aebbd428f105cf6f41c4a9
|
7
|
+
data.tar.gz: b9a27406ab4d05ca2cae353e4627bd1c4cb5b01719f50d9c7f3600629bbdce37120467017dd8016b889d4b8fa0f1ccad24357c5bcb90816927e95226bc2baa38
|
data/ext/usamin/usamin.cpp
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
#include <rapidjson/writer.h>
|
11
11
|
#include <rapidjson/prettywriter.h>
|
12
12
|
#include <rapidjson/error/en.h>
|
13
|
+
#include <iostream>
|
13
14
|
|
14
15
|
#if SIZEOF_VALUE < SIZEOF_VOIDP
|
15
16
|
#error SIZEOF_VOIDP must not be greater than SIZEOF_VALUE.
|
@@ -81,35 +82,55 @@ static inline void check_array(UsaminValue *ptr) {
|
|
81
82
|
}
|
82
83
|
|
83
84
|
|
84
|
-
static
|
85
|
+
static void usamin_free(void *p) {
|
86
|
+
if (!p)
|
87
|
+
return;
|
88
|
+
UsaminValue **ptr = (UsaminValue**)p;
|
85
89
|
if (*ptr)
|
86
90
|
delete *ptr;
|
87
|
-
ruby_xfree(
|
88
|
-
return Qnil;
|
91
|
+
ruby_xfree(p);
|
89
92
|
}
|
90
93
|
|
91
|
-
static
|
94
|
+
static void usamin_mark(void *p) {
|
95
|
+
if (!p)
|
96
|
+
return;
|
97
|
+
UsaminValue **ptr = (UsaminValue**)p;
|
92
98
|
if (*ptr && (*ptr)->root_document != Qnil)
|
93
99
|
rb_gc_mark((*ptr)->root_document);
|
94
|
-
return Qnil;
|
95
100
|
}
|
96
101
|
|
102
|
+
static size_t usamin_size(const void *p) {
|
103
|
+
if (!p)
|
104
|
+
return 0;
|
105
|
+
UsaminValue **ptr = (UsaminValue**)p;
|
106
|
+
size_t s = 0;
|
107
|
+
if (*ptr) {
|
108
|
+
s += sizeof(UsaminValue);
|
109
|
+
if ((*ptr)->free_flag)
|
110
|
+
s += ((rapidjson::Document*)(*ptr)->value)->GetAllocator().Capacity();
|
111
|
+
}
|
112
|
+
return s;
|
113
|
+
}
|
114
|
+
|
115
|
+
static const rb_data_type_t rb_usamin_value_type = { "UsaminValue", { usamin_mark, usamin_free, usamin_size }, nullptr, nullptr, RUBY_TYPED_FREE_IMMEDIATELY };
|
116
|
+
|
97
117
|
static VALUE usamin_alloc(const VALUE klass) {
|
98
|
-
UsaminValue** ptr
|
118
|
+
UsaminValue** ptr;
|
119
|
+
VALUE ret = TypedData_Make_Struct(klass, UsaminValue*, &rb_usamin_value_type, ptr);
|
99
120
|
*ptr = nullptr;
|
100
|
-
return
|
121
|
+
return ret;
|
101
122
|
}
|
102
123
|
|
103
124
|
|
104
125
|
static inline UsaminValue* get_value(VALUE value) {
|
105
126
|
UsaminValue** ptr;
|
106
|
-
|
127
|
+
TypedData_Get_Struct(value, UsaminValue*, &rb_usamin_value_type, ptr);
|
107
128
|
return *ptr;
|
108
129
|
}
|
109
130
|
|
110
131
|
static inline void set_value(VALUE value, UsaminValue *usamin) {
|
111
132
|
UsaminValue **ptr;
|
112
|
-
|
133
|
+
TypedData_Get_Struct(value, UsaminValue*, &rb_usamin_value_type, ptr);
|
113
134
|
*ptr = usamin;
|
114
135
|
}
|
115
136
|
|
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.7
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|