glib2 4.3.6 → 4.3.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c8949cf46b34ae921ab43a60165c8f0d887106fa6c51683756abba836dee8c7
4
- data.tar.gz: 228cc639dad9178cf9addeb8b4b39f52abc38cdea38cafda2c49765057d44e83
3
+ metadata.gz: 13603eaf69a3a85c8762ccfeacba4711fc02db8e82d3dc838d335137519c1390
4
+ data.tar.gz: 26feb4d19dc061daedffff8a4bf30a2a7b4056515b721c7b7a015181c9ed1d47
5
5
  SHA512:
6
- metadata.gz: 767513877daa200b92dee690e0f32e19cb1d72832894a0328a37406df3f963edbebfa113caaa911ee687a19d06ed257152f49e075ec6f4cbf1247544b6b58f22
7
- data.tar.gz: 78378d1881f14171228ffef6d6b3470eecac9b7bf05f490f943c1d296f96e4a7dfc944baf4687d511c238f7fe040ec8073f2cf8f906573d5913d60726db0a008
6
+ metadata.gz: cbd6bd0e6eef38055625b2986bc1c7c46ec32deb4c730ae3ebfb6d28b6461483e2b509598a430bdbcf694d2edebfc9e510854d0c9f6651d25e369762e965c74b
7
+ data.tar.gz: 3a19333522e6448596eab0d93bf8689b14b5c99adf78e12459310a7f9c113c06eb13771940b9067e5a4233a177e9d89bd43b350b58396739d757a9f60401eba7
data/ext/glib2/rbglib.h CHANGED
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
33
33
 
34
34
  #define RBGLIB_MAJOR_VERSION 4
35
35
  #define RBGLIB_MINOR_VERSION 3
36
- #define RBGLIB_MICRO_VERSION 6
36
+ #define RBGLIB_MICRO_VERSION 7
37
37
 
38
38
  /* For Ruby < 3.0 */
39
39
  #ifndef RB_LL2NUM
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2015-2021 Ruby-GNOME Project Team
2
+ * Copyright (C) 2015-2026 Ruby-GNOME Project Team
3
3
  *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU Lesser General Public
@@ -19,24 +19,6 @@
19
19
 
20
20
  #include "rbgprivate.h"
21
21
 
22
- /* They MRI are internal definitions. Using them reduces
23
- * maintainability. We should reconsider about using them when they
24
- * are changed in MRI. */
25
- /* from vm_core.h */
26
- #define RUBY_TAG_BREAK 0x2
27
-
28
- /* from internal.h */
29
- struct vm_throw_data {
30
- VALUE flags;
31
- VALUE reserved;
32
- const VALUE throw_obj;
33
- /* const struct rb_control_frame_struct *catch_frame; */
34
- /* VALUE throw_state; */
35
- };
36
- /* from vm_insnhelper.h */
37
- #define THROW_DATA_VAL(obj) (((struct vm_throw_data *)(obj))->throw_obj)
38
-
39
-
40
22
  #define RG_TARGET_NAMESPACE cRegex
41
23
  #define _SELF(s) ((GRegex*)RVAL2BOXED(s, G_TYPE_REGEX))
42
24
 
@@ -301,26 +283,28 @@ rg_regex_eval_callback(const GMatchInfo *match_info,
301
283
  {
302
284
  VALUE returned_data;
303
285
  RGRegexEvalCallbackData *data = user_data;
286
+ gboolean stop = FALSE;
304
287
 
305
288
  data->match_info = match_info;
306
289
  returned_data = rb_protect(rg_regex_eval_callback_body,
307
290
  (VALUE)data,
308
291
  &(data->status));
309
292
 
310
- if (data->status == RUBY_TAG_BREAK) {
311
- returned_data = THROW_DATA_VAL(rb_errinfo());
312
- }
313
-
314
- if (NIL_P(returned_data)) {
315
- gchar *matched;
316
- matched = g_match_info_fetch(match_info, 0);
317
- g_string_append(result, matched);
318
- g_free(matched);
293
+ if (data->status == 0) {
294
+ if (RB_TEST(returned_data)) {
295
+ g_string_append(result, RVAL2CSTR(returned_data));
296
+ } else {
297
+ gchar *matched;
298
+ matched = g_match_info_fetch(match_info, 0);
299
+ g_string_append(result, matched);
300
+ g_free(matched);
301
+ stop = (returned_data == RUBY_Qfalse);
302
+ }
319
303
  } else {
320
- g_string_append(result, RVAL2CSTR(returned_data));
304
+ stop = TRUE;
321
305
  }
322
306
 
323
- return data->status != 0;
307
+ return stop;
324
308
  }
325
309
 
326
310
  static VALUE
@@ -369,7 +353,7 @@ rg_replace(gint argc, VALUE *argv, VALUE self)
369
353
  rg_regex_eval_callback,
370
354
  &data,
371
355
  &error);
372
- if (!(data.status == 0 || data.status == RUBY_TAG_BREAK)) {
356
+ if (data.status != 0) {
373
357
  if (error)
374
358
  g_error_free(error);
375
359
  g_free(modified_string);
@@ -136,7 +136,7 @@ rg_inspect(VALUE self)
136
136
  {
137
137
  GParamSpec *pspec = rbgobj_get_param_spec(self);
138
138
 
139
- return rb_sprintf("#<%" PRIsVALUE "%" PRIsVALUE "#%s",
139
+ return rb_sprintf("#<%" PRIsVALUE "%" PRIsVALUE "#%s>",
140
140
  CLASS_OF(self),
141
141
  GTYPE2CLASS(pspec->owner_type),
142
142
  g_param_spec_get_name(pspec));
data/test/test-regex.rb CHANGED
@@ -280,10 +280,26 @@ class TestRegex < Test::Unit::TestCase
280
280
  assert_equal(" to to to to", modified_string)
281
281
  end
282
282
 
283
- test "break" do
283
+ test "nil" do
284
284
  regex = GLib::Regex.new("1|2|3|4")
285
285
  modified_string = regex.replace(" 4 3 2 1") do |match_info|
286
- break "to"
286
+ if match_info.fetch(0) == "4"
287
+ "to"
288
+ else
289
+ nil
290
+ end
291
+ end
292
+ assert_equal(" to 3 2 1", modified_string)
293
+ end
294
+
295
+ test "false" do
296
+ regex = GLib::Regex.new("1|2|3|4")
297
+ modified_string = regex.replace(" 4 3 2 1") do |match_info|
298
+ if match_info.fetch(0) == "4"
299
+ "to"
300
+ else
301
+ false
302
+ end
287
303
  end
288
304
  assert_equal(" to 3 2 1", modified_string)
289
305
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.6
4
+ version: 4.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
@@ -226,7 +226,7 @@ requirements:
226
226
  - 'system: gobject-2.0>=2.56.0: macports: glib2'
227
227
  - 'system: gobject-2.0>=2.56.0: msys2: glib2'
228
228
  - 'system: gobject-2.0>=2.56.0: rhel: pkgconfig(gobject-2.0)'
229
- rubygems_version: 4.0.6
229
+ rubygems_version: 4.0.10
230
230
  specification_version: 4
231
231
  summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
232
232
  test_files: []