re2 2.4.0-x86-linux → 2.4.2-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -6
- data/ext/re2/re2.cc +64 -62
- data/lib/2.6/re2.so +0 -0
- data/lib/2.7/re2.so +0 -0
- data/lib/3.0/re2.so +0 -0
- data/lib/3.1/re2.so +0 -0
- data/lib/3.2/re2.so +0 -0
- data/lib/re2/version.rb +1 -1
- data/re2.gemspec +1 -1
- data/spec/re2/match_data_spec.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 641811473cfc1457adeb45a80c77dfa943a093cbdc1ae215360316bb3ffaccad
|
4
|
+
data.tar.gz: c1817474b24b1bc21e41ce54da56e79c0ed794ea06e050936b50989d03cca971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5727f7c5fa0fe676c3b4a39c2663fb80575a299105d116be1984cadf8c1d016e05a075d086cbd5a94b3e79c3c9fa91d1bc9da21b8e470228c58157730006825e
|
7
|
+
data.tar.gz: 3472dcea0acb8537e34b1cd95902679888c3ba9544212365fb34257ed90556cdd764132efcded8d6feeddfab671b378b473bf792bea309071c45bbb1335f4d38
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Ruby bindings to [RE2][], a "fast, safe, thread-friendly alternative to
|
|
5
5
|
backtracking regular expression engines like those used in PCRE, Perl, and
|
6
6
|
Python".
|
7
7
|
|
8
|
-
**Current version:** 2.4.
|
8
|
+
**Current version:** 2.4.2
|
9
9
|
**Supported Ruby versions:** 2.6, 2.7, 3.0, 3.1, 3.2
|
10
10
|
**Bundled RE2 version:** libre2.11 (2023-11-01)
|
11
11
|
**Supported RE2 versions:** libre2.0 (< 2020-03-02), libre2.1 (2020-03-02), libre2.6 (2020-03-03), libre2.7 (2020-05-01), libre2.8 (2020-07-06), libre2.9 (2020-11-01), libre2.10 (2022-12-01), libre2.11 (2023-07-01)
|
@@ -256,13 +256,17 @@ Contributions
|
|
256
256
|
-------------
|
257
257
|
|
258
258
|
* Thanks to [Jason Woods](https://github.com/driskell) who contributed the
|
259
|
-
original implementations of `RE2::MatchData#begin` and `RE2::MatchData#end
|
260
|
-
* Thanks to [Stefano Rivera](https://github.com/stefanor) who first contributed
|
261
|
-
|
259
|
+
original implementations of `RE2::MatchData#begin` and `RE2::MatchData#end`.
|
260
|
+
* Thanks to [Stefano Rivera](https://github.com/stefanor) who first contributed
|
261
|
+
C++11 support.
|
262
|
+
* Thanks to [Stan Hu](https://github.com/stanhu) for reporting a bug with empty
|
263
|
+
patterns and `RE2::Regexp#scan`, contributing support for libre2.11
|
264
|
+
(2023-07-01) and for vendoring RE2 and abseil and compiling native gems in
|
265
|
+
2.0.
|
262
266
|
* Thanks to [Sebastian Reitenbach](https://github.com/buzzdeee) for reporting
|
263
|
-
the deprecation and removal of the `utf8` encoding option in RE2
|
267
|
+
the deprecation and removal of the `utf8` encoding option in RE2.
|
264
268
|
* Thanks to [Sergio Medina](https://github.com/serch) for reporting a bug when
|
265
|
-
using `RE2::Scanner#scan` with an invalid regular expression
|
269
|
+
using `RE2::Scanner#scan` with an invalid regular expression.
|
266
270
|
* Thanks to [Pritam Baral](https://github.com/pritambaral) for contributing the
|
267
271
|
initial support for `RE2::Set`.
|
268
272
|
* Thanks to [Mike Dalessio](https://github.com/flavorjones) for reviewing the
|
data/ext/re2/re2.cc
CHANGED
@@ -130,33 +130,33 @@ static void parse_re2_options(RE2::Options* re2_options, const VALUE options) {
|
|
130
130
|
#define re2_compact_callback(x)
|
131
131
|
#endif
|
132
132
|
|
133
|
-
static void re2_matchdata_mark(void *
|
134
|
-
re2_matchdata *
|
135
|
-
rb_gc_mark_movable(
|
136
|
-
rb_gc_mark_movable(
|
133
|
+
static void re2_matchdata_mark(void *ptr) {
|
134
|
+
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
135
|
+
rb_gc_mark_movable(m->regexp);
|
136
|
+
rb_gc_mark_movable(m->text);
|
137
137
|
}
|
138
138
|
|
139
139
|
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
140
|
-
static void
|
141
|
-
re2_matchdata *
|
142
|
-
|
143
|
-
|
140
|
+
static void re2_matchdata_compact(void *ptr) {
|
141
|
+
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
142
|
+
m->regexp = rb_gc_location(m->regexp);
|
143
|
+
m->text = rb_gc_location(m->text);
|
144
144
|
}
|
145
145
|
#endif
|
146
146
|
|
147
|
-
static void re2_matchdata_free(void *
|
148
|
-
re2_matchdata *
|
149
|
-
if (
|
150
|
-
delete[]
|
147
|
+
static void re2_matchdata_free(void *ptr) {
|
148
|
+
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
149
|
+
if (m->matches) {
|
150
|
+
delete[] m->matches;
|
151
151
|
}
|
152
|
-
xfree(
|
152
|
+
xfree(m);
|
153
153
|
}
|
154
154
|
|
155
|
-
static size_t re2_matchdata_memsize(const void *
|
156
|
-
const re2_matchdata *
|
157
|
-
size_t size = sizeof(
|
158
|
-
if (
|
159
|
-
size += sizeof(
|
155
|
+
static size_t re2_matchdata_memsize(const void *ptr) {
|
156
|
+
const re2_matchdata *m = reinterpret_cast<const re2_matchdata *>(ptr);
|
157
|
+
size_t size = sizeof(*m);
|
158
|
+
if (m->matches) {
|
159
|
+
size += sizeof(*m->matches) * m->number_of_matches;
|
160
160
|
}
|
161
161
|
|
162
162
|
return size;
|
@@ -168,40 +168,40 @@ static const rb_data_type_t re2_matchdata_data_type = {
|
|
168
168
|
.dmark = re2_matchdata_mark,
|
169
169
|
.dfree = re2_matchdata_free,
|
170
170
|
.dsize = re2_matchdata_memsize,
|
171
|
-
re2_compact_callback(
|
171
|
+
re2_compact_callback(re2_matchdata_compact)
|
172
172
|
},
|
173
173
|
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
|
174
174
|
// macro to update VALUE references, as to trigger write barriers.
|
175
175
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
|
176
176
|
};
|
177
177
|
|
178
|
-
static void re2_scanner_mark(void *
|
179
|
-
re2_scanner *
|
180
|
-
rb_gc_mark_movable(
|
181
|
-
rb_gc_mark_movable(
|
178
|
+
static void re2_scanner_mark(void *ptr) {
|
179
|
+
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
180
|
+
rb_gc_mark_movable(s->regexp);
|
181
|
+
rb_gc_mark_movable(s->text);
|
182
182
|
}
|
183
183
|
|
184
184
|
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
185
|
-
static void
|
186
|
-
re2_scanner *
|
187
|
-
|
188
|
-
|
185
|
+
static void re2_scanner_compact(void *ptr) {
|
186
|
+
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
187
|
+
s->regexp = rb_gc_location(s->regexp);
|
188
|
+
s->text = rb_gc_location(s->text);
|
189
189
|
}
|
190
190
|
#endif
|
191
191
|
|
192
|
-
static void re2_scanner_free(void *
|
193
|
-
re2_scanner *
|
194
|
-
if (
|
195
|
-
delete
|
192
|
+
static void re2_scanner_free(void *ptr) {
|
193
|
+
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
194
|
+
if (s->input) {
|
195
|
+
delete s->input;
|
196
196
|
}
|
197
|
-
xfree(
|
197
|
+
xfree(s);
|
198
198
|
}
|
199
199
|
|
200
|
-
static size_t re2_scanner_memsize(const void *
|
201
|
-
const re2_scanner *
|
202
|
-
size_t size = sizeof(
|
203
|
-
if (
|
204
|
-
size += sizeof(
|
200
|
+
static size_t re2_scanner_memsize(const void *ptr) {
|
201
|
+
const re2_scanner *s = reinterpret_cast<const re2_scanner *>(ptr);
|
202
|
+
size_t size = sizeof(*s);
|
203
|
+
if (s->input) {
|
204
|
+
size += sizeof(*s->input);
|
205
205
|
}
|
206
206
|
|
207
207
|
return size;
|
@@ -213,26 +213,26 @@ static const rb_data_type_t re2_scanner_data_type = {
|
|
213
213
|
.dmark = re2_scanner_mark,
|
214
214
|
.dfree = re2_scanner_free,
|
215
215
|
.dsize = re2_scanner_memsize,
|
216
|
-
re2_compact_callback(
|
216
|
+
re2_compact_callback(re2_scanner_compact)
|
217
217
|
},
|
218
218
|
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
|
219
219
|
// macro to update VALUE references, as to trigger write barriers.
|
220
220
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
|
221
221
|
};
|
222
222
|
|
223
|
-
static void re2_regexp_free(void *
|
224
|
-
re2_pattern *
|
225
|
-
if (
|
226
|
-
delete
|
223
|
+
static void re2_regexp_free(void *ptr) {
|
224
|
+
re2_pattern *p = reinterpret_cast<re2_pattern *>(ptr);
|
225
|
+
if (p->pattern) {
|
226
|
+
delete p->pattern;
|
227
227
|
}
|
228
|
-
xfree(
|
228
|
+
xfree(p);
|
229
229
|
}
|
230
230
|
|
231
|
-
static size_t re2_regexp_memsize(const void *
|
232
|
-
const re2_pattern *
|
233
|
-
size_t size = sizeof(
|
234
|
-
if (
|
235
|
-
size += sizeof(
|
231
|
+
static size_t re2_regexp_memsize(const void *ptr) {
|
232
|
+
const re2_pattern *p = reinterpret_cast<const re2_pattern *>(ptr);
|
233
|
+
size_t size = sizeof(*p);
|
234
|
+
if (p->pattern) {
|
235
|
+
size += sizeof(*p->pattern);
|
236
236
|
}
|
237
237
|
|
238
238
|
return size;
|
@@ -1579,19 +1579,19 @@ static VALUE re2_QuoteMeta(VALUE, VALUE unquoted) {
|
|
1579
1579
|
return rb_str_new(quoted_string.data(), quoted_string.size());
|
1580
1580
|
}
|
1581
1581
|
|
1582
|
-
static void re2_set_free(void *
|
1583
|
-
re2_set *
|
1584
|
-
if (
|
1585
|
-
delete
|
1582
|
+
static void re2_set_free(void *ptr) {
|
1583
|
+
re2_set *s = reinterpret_cast<re2_set *>(ptr);
|
1584
|
+
if (s->set) {
|
1585
|
+
delete s->set;
|
1586
1586
|
}
|
1587
|
-
xfree(
|
1587
|
+
xfree(s);
|
1588
1588
|
}
|
1589
1589
|
|
1590
|
-
static size_t re2_set_memsize(const void *
|
1591
|
-
const re2_set *
|
1592
|
-
size_t size = sizeof(
|
1593
|
-
if (
|
1594
|
-
size += sizeof(
|
1590
|
+
static size_t re2_set_memsize(const void *ptr) {
|
1591
|
+
const re2_set *s = reinterpret_cast<const re2_set *>(ptr);
|
1592
|
+
size_t size = sizeof(*s);
|
1593
|
+
if (s->set) {
|
1594
|
+
size += sizeof(*s->set);
|
1595
1595
|
}
|
1596
1596
|
|
1597
1597
|
return size;
|
@@ -1877,12 +1877,14 @@ extern "C" void Init_re2(void) {
|
|
1877
1877
|
re2_eSetUnsupportedError = rb_define_class_under(re2_cSet, "UnsupportedError",
|
1878
1878
|
rb_const_get(rb_cObject, rb_intern("StandardError")));
|
1879
1879
|
|
1880
|
-
rb_define_alloc_func(re2_cRegexp,
|
1880
|
+
rb_define_alloc_func(re2_cRegexp,
|
1881
|
+
reinterpret_cast<VALUE (*)(VALUE)>(re2_regexp_allocate));
|
1881
1882
|
rb_define_alloc_func(re2_cMatchData,
|
1882
|
-
|
1883
|
+
reinterpret_cast<VALUE (*)(VALUE)>(re2_matchdata_allocate));
|
1883
1884
|
rb_define_alloc_func(re2_cScanner,
|
1884
|
-
|
1885
|
-
rb_define_alloc_func(re2_cSet,
|
1885
|
+
reinterpret_cast<VALUE (*)(VALUE)>(re2_scanner_allocate));
|
1886
|
+
rb_define_alloc_func(re2_cSet,
|
1887
|
+
reinterpret_cast<VALUE (*)(VALUE)>(re2_set_allocate));
|
1886
1888
|
|
1887
1889
|
rb_define_method(re2_cMatchData, "string",
|
1888
1890
|
RUBY_METHOD_FUNC(re2_matchdata_string), 0);
|
data/lib/2.6/re2.so
CHANGED
Binary file
|
data/lib/2.7/re2.so
CHANGED
Binary file
|
data/lib/3.0/re2.so
CHANGED
Binary file
|
data/lib/3.1/re2.so
CHANGED
Binary file
|
data/lib/3.2/re2.so
CHANGED
Binary file
|
data/lib/re2/version.rb
CHANGED
data/re2.gemspec
CHANGED
@@ -11,7 +11,6 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.license = "BSD-3-Clause"
|
12
12
|
s.required_ruby_version = ">= 2.6.0"
|
13
13
|
s.files = [
|
14
|
-
".rspec",
|
15
14
|
"dependencies.yml",
|
16
15
|
"ext/re2/extconf.rb",
|
17
16
|
"ext/re2/re2.cc",
|
@@ -28,6 +27,7 @@ Gem::Specification.new do |s|
|
|
28
27
|
"re2.gemspec"
|
29
28
|
]
|
30
29
|
s.test_files = [
|
30
|
+
".rspec",
|
31
31
|
"spec/spec_helper.rb",
|
32
32
|
"spec/re2_spec.rb",
|
33
33
|
"spec/kernel_spec.rb",
|
data/spec/re2/match_data_spec.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require 'objspace'
|
3
|
+
|
2
4
|
RSpec.describe RE2::MatchData do
|
5
|
+
it "reports a larger consuming memory size when it has more matches" do
|
6
|
+
matches1 = RE2::Regexp.new('w(o)').match('woo')
|
7
|
+
matches2 = RE2::Regexp.new('w(o)(o)').match('woo')
|
8
|
+
|
9
|
+
expect(ObjectSpace.memsize_of(matches1)).to be < ObjectSpace.memsize_of(matches2)
|
10
|
+
end
|
11
|
+
|
3
12
|
describe "#to_a" do
|
4
13
|
it "is populated with the match and capturing groups" do
|
5
14
|
a = RE2::Regexp.new('w(o)(o)').match('woo').to_a
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: re2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-11-
|
12
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -115,6 +115,7 @@ signing_key:
|
|
115
115
|
specification_version: 4
|
116
116
|
summary: Ruby bindings to RE2.
|
117
117
|
test_files:
|
118
|
+
- ".rspec"
|
118
119
|
- spec/spec_helper.rb
|
119
120
|
- spec/re2_spec.rb
|
120
121
|
- spec/kernel_spec.rb
|