glib2 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/glib2/rbglib-bytes.c +6 -1
- data/ext/glib2/rbglib.h +6 -1
- data/test/test-bytes.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '02369ea278700a7eb9a86d3d262c1285e20ec17e'
|
4
|
+
data.tar.gz: ff3fa9197fd8bdc49974be2694c7cba5a56c554d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dde83bcd8b3546d1db154aa76e99d7d63b7d4c5942168b6f5de287969d85e0d425e9d3e95f663a7fca2d99024aadcc8e33f4837d34a41d93668161c1411ba46
|
7
|
+
data.tar.gz: 3026321f0348810656ec618752da8d0dc2821ef17feb7897bab8ae53def124b2e3bf85c1b1e9f368e5efe8d833c450e1ec18c54194c7077f42847e48d1271359
|
data/ext/glib2/rbglib-bytes.c
CHANGED
@@ -38,7 +38,12 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
|
|
38
38
|
bytes = g_bytes_new(NULL, 0);
|
39
39
|
} else {
|
40
40
|
const gchar *data = RVAL2CSTR_PTR(rb_data);
|
41
|
-
|
41
|
+
if (RB_OBJ_FROZEN(rb_data)) {
|
42
|
+
bytes = g_bytes_new_static(data, RSTRING_LEN(rb_data));
|
43
|
+
rb_iv_set(self, "source", rb_data);
|
44
|
+
} else {
|
45
|
+
bytes = g_bytes_new(data, RSTRING_LEN(rb_data));
|
46
|
+
}
|
42
47
|
}
|
43
48
|
G_INITIALIZE(self, bytes);
|
44
49
|
|
data/ext/glib2/rbglib.h
CHANGED
@@ -36,7 +36,7 @@ extern "C" {
|
|
36
36
|
|
37
37
|
#define RBGLIB_MAJOR_VERSION 3
|
38
38
|
#define RBGLIB_MINOR_VERSION 2
|
39
|
-
#define RBGLIB_MICRO_VERSION
|
39
|
+
#define RBGLIB_MICRO_VERSION 1
|
40
40
|
|
41
41
|
#ifndef RB_ZALLOC
|
42
42
|
# ifdef ZALLOC
|
@@ -46,6 +46,11 @@ extern "C" {
|
|
46
46
|
# endif
|
47
47
|
#endif
|
48
48
|
|
49
|
+
/* For Ruby < 2.3 */
|
50
|
+
#ifndef RB_OBJ_FROZEN
|
51
|
+
# define RB_OBJ_FROZEN(obj) OBJ_FROZEN(obj)
|
52
|
+
#endif
|
53
|
+
|
49
54
|
#ifndef RSTRING_PTR
|
50
55
|
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
51
56
|
# define RSTRING_LEN(s) (RSTRING(s)->len)
|
data/test/test-bytes.rb
CHANGED
@@ -21,6 +21,21 @@ class TestGLibBytes < Test::Unit::TestCase
|
|
21
21
|
only_glib_version(2, 32, 0)
|
22
22
|
end
|
23
23
|
|
24
|
+
sub_test_case ".new" do
|
25
|
+
def create_bytes(options={})
|
26
|
+
data = "Hello"
|
27
|
+
data.freeze if options[:freeze]
|
28
|
+
[data.object_id, GLib::Bytes.new(data)]
|
29
|
+
end
|
30
|
+
|
31
|
+
test "frozen" do
|
32
|
+
id, bytes = create_bytes(:freeze => true)
|
33
|
+
GC.start
|
34
|
+
assert_equal(bytes.to_s,
|
35
|
+
ObjectSpace._id2ref(id))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
24
39
|
test "#to_s" do
|
25
40
|
data = "Hello"
|
26
41
|
bytes = GLib::Bytes.new(data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME2 Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|