efficient_join 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/efficient_join/efficient_join.c +13 -19
- data/lib/efficient_join/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5901b92dc6e259cbf76193da6107a3c3dde02c6dddcf66812e9d449322eae6fc
|
4
|
+
data.tar.gz: d9f11fbf636346979abc3654cdfb1e7518b9891532732905404ab2ca08e4617c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7d39e4ad25fb936ab6213e8d582f2bd9fd3e2a53bf7f24c33452839e473dc984773b8998d880db1a89d602ddd4fc9d45e47eafc39d202b579fad234a2231b8a
|
7
|
+
data.tar.gz: 0c90ce377ad5ed1bd0483cdaaef14702bd743005052833d120f9c813445ff2b92fbfdd204aed18c0576e8b05fb359e6b1e3515b3a9fbdf43c5d35ea12548e85f
|
@@ -46,13 +46,18 @@ static inline void strbuf_write_int64(struct strbuf_t *strbuf, int64_t value)
|
|
46
46
|
strbuf->pos += bytes_written;
|
47
47
|
}
|
48
48
|
|
49
|
-
|
49
|
+
VALUE rb_efficient_join(VALUE self, VALUE _header, VALUE _footer, VALUE _item_prefix, VALUE _item_suffix, VALUE _join, VALUE number_array) {
|
50
50
|
VALUE out;
|
51
|
-
const long array_len = RARRAY_LEN(
|
52
|
-
|
53
|
-
const
|
54
|
-
const
|
55
|
-
const
|
51
|
+
const long array_len = RARRAY_LEN(number_array);
|
52
|
+
const char* header = StringValuePtr(_header);
|
53
|
+
const char* footer = StringValuePtr(_footer);
|
54
|
+
const char* item_prefix = StringValuePtr(_item_prefix);
|
55
|
+
const char* item_suffix = StringValuePtr(_item_suffix);
|
56
|
+
const char* join = StringValuePtr(_join);
|
57
|
+
VALUE *c_array = RARRAY_PTR(number_array);
|
58
|
+
const size_t prefix_len = RSTRING_LEN(_item_prefix);
|
59
|
+
const size_t suffix_len = RSTRING_LEN(_item_suffix);
|
60
|
+
const size_t join_len = RSTRING_LEN(_join);
|
56
61
|
|
57
62
|
struct strbuf_t join_buf = strbuf_new(suffix_len + join_len + prefix_len);
|
58
63
|
// estimate likely maximum buffer size, to avoid reallocs
|
@@ -63,7 +68,7 @@ static VALUE _join(const char *header, const char *footer, const char *item_pref
|
|
63
68
|
strbuf_write_str(&join_buf, join, join_len);
|
64
69
|
strbuf_write_str(&join_buf, item_prefix, prefix_len);
|
65
70
|
|
66
|
-
strbuf_write_str(&buf, header,
|
71
|
+
strbuf_write_str(&buf, header, RSTRING_LEN(_header));
|
67
72
|
strbuf_write_str(&buf, item_prefix, prefix_len);
|
68
73
|
|
69
74
|
for (long i=0; i<array_len; ++i) {
|
@@ -91,7 +96,7 @@ static VALUE _join(const char *header, const char *footer, const char *item_pref
|
|
91
96
|
}
|
92
97
|
}
|
93
98
|
strbuf_write_str(&buf, item_suffix, suffix_len);
|
94
|
-
strbuf_write_str(&buf, footer,
|
99
|
+
strbuf_write_str(&buf, footer, RSTRING_LEN(_footer));
|
95
100
|
|
96
101
|
out = rb_str_new(buf.buf, buf.pos);
|
97
102
|
|
@@ -101,17 +106,6 @@ static VALUE _join(const char *header, const char *footer, const char *item_pref
|
|
101
106
|
return out;
|
102
107
|
}
|
103
108
|
|
104
|
-
VALUE rb_efficient_join(VALUE self, VALUE header, VALUE footer, VALUE prefix, VALUE suffix, VALUE join, VALUE number_array) {
|
105
|
-
return _join(
|
106
|
-
StringValueCStr(header),
|
107
|
-
StringValueCStr(footer),
|
108
|
-
StringValueCStr(prefix),
|
109
|
-
StringValueCStr(suffix),
|
110
|
-
StringValueCStr(join),
|
111
|
-
number_array
|
112
|
-
);
|
113
|
-
}
|
114
|
-
|
115
109
|
void Init_efficient_join()
|
116
110
|
{
|
117
111
|
VALUE mod = rb_define_module("EfficientJoinCExt");
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: efficient_join
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Morton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
rubygems_version: 3.0.
|
98
|
+
rubygems_version: 3.0.4
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: "."
|