markly 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/markly/markly.c +14 -16
- data/lib/markly/markly.so +0 -0
- data/lib/markly/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: 27b98de3f04fbba3681df9356148129c3adb335740846ba638a4fb2790029e9e
|
4
|
+
data.tar.gz: c6bdd14cff454a313050128e4b4f32e1b7db2306581d8fde7475ccd9021fac36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69a8a8366b7b3eb19d08c1cedd839c5a0a3ec15d3c0e3be1f80e9adcd4a7849704a733249aebb86771a822a3e4b0dbb4a5643b208597be9316c7282f5b6d471a
|
7
|
+
data.tar.gz: 1540db6af546c59fff663ab5f056519fdf48523e56c35a28281e3d5c34f75b4c2d0e0176666af4453b87b16faefeb19880da511067468a34d648d97c15d1a2ff
|
data/ext/markly/markly.c
CHANGED
@@ -41,11 +41,13 @@ static VALUE sym_right;
|
|
41
41
|
static VALUE sym_center;
|
42
42
|
|
43
43
|
static void rb_Markly_Node_free(void *data) {
|
44
|
-
//
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
// If a parent of this node is already freed, `rb_Markly_Node_freed` will ensure all the nodes are nullified.
|
45
|
+
if (data) {
|
46
|
+
cmark_node *node = (cmark_node*)data;
|
47
|
+
|
48
|
+
if (cmark_node_parent(node) == NULL) {
|
49
|
+
cmark_node_free(node);
|
50
|
+
}
|
49
51
|
}
|
50
52
|
}
|
51
53
|
|
@@ -79,6 +81,12 @@ static const rb_data_type_t rb_Markly_Node_Type = {
|
|
79
81
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
80
82
|
};
|
81
83
|
|
84
|
+
static void rb_Markly_Node_freed(cmark_mem *mem, void *user_data) {
|
85
|
+
VALUE self = (VALUE)user_data;
|
86
|
+
|
87
|
+
RTYPEDDATA_DATA(self) = NULL;
|
88
|
+
}
|
89
|
+
|
82
90
|
static VALUE rb_Markly_Node_wrap(cmark_node *node) {
|
83
91
|
if (node == NULL)
|
84
92
|
return Qnil;
|
@@ -91,6 +99,7 @@ static VALUE rb_Markly_Node_wrap(cmark_node *node) {
|
|
91
99
|
|
92
100
|
VALUE self = TypedData_Wrap_Struct(rb_Markly_Node, &rb_Markly_Node_Type, node);
|
93
101
|
cmark_node_set_user_data(node, (void *)self);
|
102
|
+
cmark_node_set_user_data_free_func(node, rb_Markly_Node_freed);
|
94
103
|
|
95
104
|
return self;
|
96
105
|
}
|
@@ -121,16 +130,6 @@ static const rb_data_type_t rb_Markly_Parser_Type = {
|
|
121
130
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
122
131
|
};
|
123
132
|
|
124
|
-
static VALUE rb_Markly_Parser_root(VALUE self) {
|
125
|
-
cmark_parser *parser = NULL;
|
126
|
-
|
127
|
-
TypedData_Get_Struct(self, cmark_parser, &rb_Markly_Parser_Type, parser);
|
128
|
-
|
129
|
-
assert(parser != NULL);
|
130
|
-
|
131
|
-
return rb_Markly_Node_wrap(parser->root);
|
132
|
-
}
|
133
|
-
|
134
133
|
static VALUE rb_Markly_Parser_alloc(VALUE self) {
|
135
134
|
return TypedData_Wrap_Struct(self, &rb_Markly_Parser_Type, NULL);
|
136
135
|
}
|
@@ -1193,7 +1192,6 @@ __attribute__((visibility("default"))) void Init_markly() {
|
|
1193
1192
|
rb_define_method(rb_Markly_Parser, "initialize", rb_Markly_Parser_initialize, 1);
|
1194
1193
|
rb_define_method(rb_Markly_Parser, "enable", rb_Markly_Parser_enable, 1);
|
1195
1194
|
rb_define_method(rb_Markly_Parser, "parse", rb_Markly_Parser_parse, 1);
|
1196
|
-
rb_define_method(rb_Markly_Parser, "root", rb_Markly_Parser_root, 0);
|
1197
1195
|
|
1198
1196
|
rb_Markly_Node = rb_define_class_under(rb_Markly, "Node", rb_cObject);
|
1199
1197
|
rb_define_singleton_method(rb_Markly_Node, "new", rb_node_new, 1);
|
data/lib/markly/markly.so
CHANGED
Binary file
|
data/lib/markly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-06-
|
13
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bake
|