gettextpo 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8dc578aa39656a68a618fded31047596b0896d512e87c0a98fdc12414f0c58dd
4
- data.tar.gz: 2bc242b9a93c0ff16c06ee2ad3e00822c5d95c6c8719a1a031a4a7b8eef8a214
3
+ metadata.gz: 8d79bd8df87c28517df5511374532c5c6e152a48985eb43d98c6fd59b3a141c1
4
+ data.tar.gz: f5c9f7ebe85c9909fa1cdd34d244444010edeadb58669371c890071f157ff38d
5
5
  SHA512:
6
- metadata.gz: f0810544b3ab98f178611d2b93ba0b1bbc261ff1a61b8f6f42c90c04dc322c6740b827d78f68d31b4138bf8ca346320f8eb20bec6465830c8714b7d8e30e2ef8
7
- data.tar.gz: 9134f46ca9b0dec4e96c855dfd2ddc3441721dd5597330ba8212c86c47f4590a77e8cd89e84ea800dacd499e74b32b5f56ef82a6f9443f0591e719facdd77cfb
6
+ metadata.gz: ffd605d6798906828aa7941c1c2c29b6253bc1f92f27a9da4eb8f363d0d293aa380ec745590862c8a916785e1f6b9cbd405ea068b54fcdd966a9c6bb2f843149
7
+ data.tar.gz: 4f69a662f06e74cabd63142bf1891394cd735e30d27e313b28e144f8e422c56a006540c43a528a2d6a4d38e5e19e848431e85cb7a9914ed12f8ced33b36eb04a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## CRuby version 0.4.1 - 2026-11-30
6
+
7
+ No API change. Internal improvements only.
8
+
5
9
  ## CRuby and mruby version 0.4.0 - 2026-03-18
6
10
 
7
11
  - Add `GettextPO::Message#sticky_flags`,
data/Gemfile CHANGED
@@ -8,3 +8,7 @@ gem "irb"
8
8
  gem "rake", "~> 13.0"
9
9
  gem "rake-compiler"
10
10
  gem "test-unit", "~> 3.0"
11
+
12
+ group :memory do
13
+ gem "ruby_memcheck", "~> 3.0"
14
+ end
data/Rakefile CHANGED
@@ -18,12 +18,31 @@
18
18
  require "bundler/gem_tasks"
19
19
  require "rake/testtask"
20
20
 
21
- Rake::TestTask.new(:test) do |t|
21
+ skip_memcheck = false
22
+ begin
23
+ require "ruby_memcheck"
24
+ rescue LoadError
25
+ $stderr.puts "warn: Skip loading memcheck"
26
+ skip_memcheck = true
27
+ end
28
+
29
+ test_config = lambda do |t|
22
30
  t.libs << "test.cruby"
23
31
  t.libs << "lib"
24
32
  t.test_files = FileList["test.cruby/**/*_test.rb"]
25
33
  end
26
34
 
35
+ Rake::TestTask.new(:test, &test_config)
36
+ task test: :compile
37
+
38
+ unless skip_memcheck
39
+ namespace :test do
40
+ RubyMemcheck.config(binary_name: "gettextpo/gettextpo",
41
+ valgrind_generate_suppressions: true)
42
+ RubyMemcheck::TestTask.new(valgrind: :compile, &test_config)
43
+ end
44
+ end
45
+
27
46
  require "rake/extensiontask"
28
47
 
29
48
  task build: :compile
@@ -25,14 +25,6 @@
25
25
 
26
26
  #include "gettextpo.h"
27
27
  #include <gettext-po.h>
28
- #include <ruby/internal/core/rdata.h>
29
- #include <ruby/internal/core/rstring.h>
30
- #include <ruby/internal/error.h>
31
- #include <ruby/internal/globals.h>
32
- #include <ruby/internal/intern/string.h>
33
- #include <ruby/internal/module.h>
34
- #include <ruby/internal/scan_args.h>
35
- #include <ruby/internal/special_consts.h>
36
28
 
37
29
  #define ERROR \
38
30
  rb_const_get (rb_const_get (rb_cObject, rb_intern ("GettextPO")), \
@@ -77,7 +69,7 @@ gettextpo_xerror (const int severity, const po_message_t message,
77
69
  if (message)
78
70
  {
79
71
  VALUE message_value = rb_obj_alloc (rb_cMessage);
80
- DATA_PTR (message_value) = message;
72
+ RTYPEDDATA_DATA (message_value) = message;
81
73
  rb_ivar_set (message_value, rb_intern ("@file"),
82
74
  *gettextpo_xerror_context.file);
83
75
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("message")), message_value);
@@ -90,7 +82,7 @@ gettextpo_xerror (const int severity, const po_message_t message,
90
82
  if (filename && lineno != (size_t)(-1) && column != (size_t)(-1))
91
83
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("column")), INT2NUM (column));
92
84
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("multiline")),
93
- multiline_p ? Qtrue : Qfalse);
85
+ multiline_p ? RUBY_Qtrue : RUBY_Qfalse);
94
86
  if (message_text)
95
87
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("message_text")),
96
88
  rb_str_new_cstr (message_text));
@@ -120,7 +112,7 @@ gettextpo_xerror2 (const int severity, const po_message_t message1,
120
112
  if (message1)
121
113
  {
122
114
  VALUE message_value1 = rb_obj_alloc (rb_cMessage);
123
- DATA_PTR (message_value1) = message1;
115
+ RTYPEDDATA_DATA (message_value1) = message1;
124
116
  rb_ivar_set (message_value1, rb_intern ("@file"),
125
117
  *gettextpo_xerror_context.file);
126
118
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("message1")), message_value1);
@@ -133,14 +125,14 @@ gettextpo_xerror2 (const int severity, const po_message_t message1,
133
125
  if (filename1 && lineno1 != (size_t)(-1) && column1 != (size_t)(-1))
134
126
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("column1")), INT2NUM (column1));
135
127
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("multiline1")),
136
- multiline_p1 ? Qtrue : Qfalse);
128
+ multiline_p1 ? RUBY_Qtrue : RUBY_Qfalse);
137
129
  if (message_text1)
138
130
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("message_text1")),
139
131
  rb_str_new_cstr (message_text1));
140
132
  if (message2)
141
133
  {
142
134
  VALUE message_value2 = rb_obj_alloc (rb_cMessage);
143
- DATA_PTR (message_value2) = message2;
135
+ RTYPEDDATA_DATA (message_value2) = message2;
144
136
  rb_ivar_set (message_value2, rb_intern ("@file"),
145
137
  *gettextpo_xerror_context.file);
146
138
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("message2")), message_value2);
@@ -153,7 +145,7 @@ gettextpo_xerror2 (const int severity, const po_message_t message1,
153
145
  if (filename2 && lineno2 != (size_t)(-1) && column2 != (size_t)(-1))
154
146
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("column2")), INT2NUM (column2));
155
147
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("multiline2")),
156
- multiline_p2 ? Qtrue : Qfalse);
148
+ multiline_p2 ? RUBY_Qtrue : RUBY_Qfalse);
157
149
  if (message_text2)
158
150
  rb_hash_aset (kwargs, ID2SYM (rb_intern ("message_text2")),
159
151
  rb_str_new_cstr (message_text2));
@@ -199,7 +191,7 @@ gettextpo_po_flag_iterator_alloc (VALUE self)
199
191
  static VALUE
200
192
  gettextpo_po_flag_iterator_m_next (VALUE self)
201
193
  {
202
- const char *flag = po_flag_next (DATA_PTR (self));
194
+ const char *flag = po_flag_next (RTYPEDDATA_DATA (self));
203
195
  if (flag)
204
196
  return rb_str_new_cstr (flag);
205
197
  else
@@ -229,16 +221,17 @@ gettextpo_po_message_alloc (VALUE self)
229
221
  VALUE \
230
222
  gettextpo_po_message_m_##field (VALUE self) \
231
223
  { \
232
- const char *string = po_message_##field (DATA_PTR (self)); \
233
- return string ? rb_str_new_cstr (string) : Qnil; \
224
+ const char *string = po_message_##field (RTYPEDDATA_DATA (self)); \
225
+ return string ? rb_str_new_cstr (string) : RUBY_Qnil; \
234
226
  }
235
227
  #define OPTIONAL_STRING_SETTER(field) \
236
228
  VALUE \
237
229
  gettextpo_po_message_m_##field##_set (VALUE self, VALUE string) \
238
230
  { \
239
- po_message_set_##field ( \
240
- DATA_PTR (self), NIL_P (string) ? NULL : StringValueCStr (string)); \
241
- return Qnil; \
231
+ po_message_set_##field (RTYPEDDATA_DATA (self), \
232
+ NIL_P (string) ? NULL \
233
+ : StringValueCStr (string)); \
234
+ return RUBY_Qnil; \
242
235
  }
243
236
 
244
237
  /**
@@ -260,14 +253,15 @@ OPTIONAL_STRING_SETTER (msgctxt);
260
253
  VALUE \
261
254
  gettextpo_po_message_m_##field (VALUE self) \
262
255
  { \
263
- return rb_str_new_cstr (po_message_##field (DATA_PTR (self))); \
256
+ return rb_str_new_cstr (po_message_##field (RTYPEDDATA_DATA (self))); \
264
257
  }
265
258
  #define STRING_SETTER(field) \
266
259
  VALUE \
267
260
  gettextpo_po_message_m_##field##_set (VALUE self, VALUE string) \
268
261
  { \
269
- po_message_set_##field (DATA_PTR (self), StringValueCStr (string)); \
270
- return Qnil; \
262
+ po_message_set_##field (RTYPEDDATA_DATA (self), \
263
+ StringValueCStr (string)); \
264
+ return RUBY_Qnil; \
271
265
  }
272
266
 
273
267
  /**
@@ -316,8 +310,8 @@ VALUE
316
310
  gettextpo_po_message_m_msgstr_plural (VALUE self, VALUE index)
317
311
  {
318
312
  const char *msgstr_plural
319
- = po_message_msgstr_plural (DATA_PTR (self), NUM2INT (index));
320
- return msgstr_plural ? rb_str_new_cstr (msgstr_plural) : Qnil;
313
+ = po_message_msgstr_plural (RTYPEDDATA_DATA (self), NUM2INT (index));
314
+ return msgstr_plural ? rb_str_new_cstr (msgstr_plural) : RUBY_Qnil;
321
315
  }
322
316
 
323
317
  /**
@@ -330,9 +324,9 @@ gettextpo_po_message_m_msgstr_plural_set (VALUE self, VALUE index,
330
324
  VALUE msgstr_plural)
331
325
  {
332
326
  po_message_set_msgstr_plural (
333
- DATA_PTR (self), NUM2INT (index),
327
+ RTYPEDDATA_DATA (self), NUM2INT (index),
334
328
  NIL_P (msgstr_plural) ? NULL : StringValueCStr (msgstr_plural));
335
- return Qnil;
329
+ return RUBY_Qnil;
336
330
  }
337
331
 
338
332
  /**
@@ -406,14 +400,15 @@ OPTIONAL_STRING_SETTER (prev_msgid_plural);
406
400
  VALUE \
407
401
  gettextpo_po_message_m_##field (VALUE self) \
408
402
  { \
409
- return po_message_is_##field (DATA_PTR (self)) ? Qtrue : Qfalse; \
403
+ return po_message_is_##field (RTYPEDDATA_DATA (self)) ? RUBY_Qtrue \
404
+ : RUBY_Qfalse; \
410
405
  }
411
406
  #define BOOL_SETTER(field) \
412
407
  VALUE \
413
408
  gettextpo_po_message_m_##field##_set (VALUE self, VALUE boolean) \
414
409
  { \
415
- po_message_set_##field (DATA_PTR (self), RB_TEST (boolean)); \
416
- return Qnil; \
410
+ po_message_set_##field (RTYPEDDATA_DATA (self), RB_TEST (boolean)); \
411
+ return RUBY_Qnil; \
417
412
  }
418
413
 
419
414
  /**
@@ -443,10 +438,10 @@ BOOL_SETTER (fuzzy);
443
438
  static VALUE gettextpo_po_message_m_##name##_flag_q (VALUE self, \
444
439
  VALUE flag) \
445
440
  { \
446
- return po_message_has_##name##_flag (DATA_PTR (self), \
441
+ return po_message_has_##name##_flag (RTYPEDDATA_DATA (self), \
447
442
  StringValueCStr (flag)) \
448
- ? Qtrue \
449
- : Qfalse; \
443
+ ? RUBY_Qtrue \
444
+ : RUBY_Qfalse; \
450
445
  }
451
446
  #define UPDATE_FLAG(name) \
452
447
  static VALUE gettextpo_po_message_m_update_##name##_flag ( \
@@ -455,21 +450,22 @@ BOOL_SETTER (fuzzy);
455
450
  VALUE flag, kwargs; \
456
451
  rb_scan_args (argc, argv, "1:", &flag, &kwargs); \
457
452
  ID kwargs_ids[] = { rb_intern ("set") }; \
458
- VALUE kwargs_vals[] = { Qundef }; \
453
+ VALUE kwargs_vals[] = { RUBY_Qundef }; \
459
454
  rb_get_kwargs (kwargs, kwargs_ids, 0, \
460
455
  sizeof (kwargs_ids) / sizeof (kwargs_ids[0]), \
461
456
  kwargs_vals); \
462
457
  \
463
- po_message_set_##name##_flag (DATA_PTR (self), StringValueCStr (flag), \
464
- RB_UNDEF_P (kwargs_vals[0]) \
465
- && RB_TEST (kwargs_vals[0])); \
466
- return Qnil; \
458
+ po_message_set_##name##_flag ( \
459
+ RTYPEDDATA_DATA (self), StringValueCStr (flag), \
460
+ RB_UNDEF_P (kwargs_vals[0]) && RB_TEST (kwargs_vals[0])); \
461
+ return RUBY_Qnil; \
467
462
  }
468
463
  #define FLAG_ITER(name) \
469
464
  static VALUE gettextpo_po_message_m_##name##_flags_iterator (VALUE self) \
470
465
  { \
471
466
  VALUE iter = rb_obj_alloc (rb_cFlagIterator); \
472
- DATA_PTR (iter) = po_message_##name##_flags_iterator (DATA_PTR (self)); \
467
+ RTYPEDDATA_DATA (iter) \
468
+ = po_message_##name##_flags_iterator (RTYPEDDATA_DATA (self)); \
473
469
  return iter; \
474
470
  }
475
471
 
@@ -503,18 +499,18 @@ FLAG_ITER (workflow);
503
499
  static VALUE
504
500
  gettextpo_po_message_m_format (VALUE self, VALUE format)
505
501
  {
506
- int result
507
- = po_message_get_format (DATA_PTR (self), StringValueCStr (format));
502
+ int result = po_message_get_format (RTYPEDDATA_DATA (self),
503
+ StringValueCStr (format));
508
504
  switch (result)
509
505
  {
510
506
  case 1:
511
- return Qtrue;
507
+ return RUBY_Qtrue;
512
508
  break;
513
509
  case 0:
514
- return Qfalse;
510
+ return RUBY_Qfalse;
515
511
  break;
516
512
  case -1:
517
- return Qnil;
513
+ return RUBY_Qnil;
518
514
  break;
519
515
  default:
520
516
  rb_raise (ERROR, "unreachable");
@@ -528,9 +524,10 @@ gettextpo_po_message_m_format (VALUE self, VALUE format)
528
524
  VALUE
529
525
  gettextpo_po_message_m_format_q (VALUE self, VALUE format)
530
526
  {
531
- return po_message_is_format (DATA_PTR (self), StringValueCStr (format))
532
- ? Qtrue
533
- : Qfalse;
527
+ return po_message_is_format (RTYPEDDATA_DATA (self),
528
+ StringValueCStr (format))
529
+ ? RUBY_Qtrue
530
+ : RUBY_Qfalse;
534
531
  }
535
532
 
536
533
  /**
@@ -544,15 +541,15 @@ gettextpo_po_message_m_format_set (int argc, VALUE *argv, VALUE self)
544
541
  VALUE format, kwargs;
545
542
  rb_scan_args (argc, argv, "1:", &format, &kwargs);
546
543
  ID kwargs_ids[] = { rb_intern ("opposite"), rb_intern ("remove") };
547
- VALUE kwargs_vals[] = { Qundef, Qundef };
544
+ VALUE kwargs_vals[] = { RUBY_Qundef, RUBY_Qundef };
548
545
  rb_get_kwargs (kwargs, kwargs_ids, 0, 2, kwargs_vals);
549
546
  bool opposite = !RB_UNDEF_P (kwargs_vals[0]) && RB_TEST (kwargs_vals[0]);
550
547
  bool remove = !RB_UNDEF_P (kwargs_vals[1]) && RB_TEST (kwargs_vals[1]);
551
548
  if (opposite && remove)
552
549
  rb_raise (ERROR, "opposite and remove cannot be set at the same time");
553
- po_message_set_format (DATA_PTR (self), StringValueCStr (format),
550
+ po_message_set_format (RTYPEDDATA_DATA (self), StringValueCStr (format),
554
551
  opposite ? 0 : (remove ? -1 : 1));
555
- return Qnil;
552
+ return RUBY_Qnil;
556
553
  }
557
554
 
558
555
  #ifdef HAVE_PO_MESSAGE_GET_FORMAT
@@ -590,8 +587,9 @@ gettextpo_po_message_m_range (VALUE self, VALUE range)
590
587
  rb_range_values (range, &min, &max, &exclude);
591
588
  int min_int = NUM2INT (min);
592
589
  int max_int = NUM2INT (max);
593
- return po_message_is_range (DATA_PTR (self), &min_int, &max_int) ? Qtrue
594
- : Qfalse;
590
+ return po_message_is_range (RTYPEDDATA_DATA (self), &min_int, &max_int)
591
+ ? RUBY_Qtrue
592
+ : RUBY_Qfalse;
595
593
  }
596
594
 
597
595
  /**
@@ -603,8 +601,8 @@ gettextpo_po_message_m_range_set (VALUE self, VALUE range)
603
601
  VALUE min, max;
604
602
  int exclude;
605
603
  rb_range_values (range, &min, &max, &exclude);
606
- po_message_set_range (DATA_PTR (self), min, max);
607
- return Qnil;
604
+ po_message_set_range (RTYPEDDATA_DATA (self), min, max);
605
+ return RUBY_Qnil;
608
606
  }
609
607
 
610
608
  /**
@@ -615,17 +613,18 @@ gettextpo_po_message_m_range_set (VALUE self, VALUE range)
615
613
  VALUE
616
614
  gettextpo_po_message_m_filepos (VALUE self, VALUE index)
617
615
  {
618
- po_filepos_t pos = po_message_filepos (DATA_PTR (self), NUM2INT (index));
616
+ po_filepos_t pos
617
+ = po_message_filepos (RTYPEDDATA_DATA (self), NUM2INT (index));
619
618
  if (pos)
620
619
  {
621
620
  VALUE filepos = rb_obj_alloc (rb_cFilePos);
622
- DATA_PTR (filepos) = pos;
621
+ RTYPEDDATA_DATA (filepos) = pos;
623
622
  rb_ivar_set (filepos, rb_intern ("@file"),
624
623
  rb_ivar_get (self, rb_intern ("@file")));
625
624
  return filepos;
626
625
  }
627
626
  else
628
- return Qnil;
627
+ return RUBY_Qnil;
629
628
  }
630
629
 
631
630
  /**
@@ -634,8 +633,8 @@ gettextpo_po_message_m_filepos (VALUE self, VALUE index)
634
633
  VALUE
635
634
  gettextpo_po_message_m_remove_filepos (VALUE self, VALUE index)
636
635
  {
637
- po_message_remove_filepos (DATA_PTR (self), NUM2INT (index));
638
- return Qnil;
636
+ po_message_remove_filepos (RTYPEDDATA_DATA (self), NUM2INT (index));
637
+ return RUBY_Qnil;
639
638
  }
640
639
 
641
640
  /**
@@ -644,9 +643,9 @@ gettextpo_po_message_m_remove_filepos (VALUE self, VALUE index)
644
643
  VALUE
645
644
  gettextpo_po_message_m_add_filepos (VALUE self, VALUE file, VALUE start_line)
646
645
  {
647
- po_message_add_filepos (DATA_PTR (self), StringValueCStr (file),
646
+ po_message_add_filepos (RTYPEDDATA_DATA (self), StringValueCStr (file),
648
647
  NUM2INT (start_line));
649
- return Qnil;
648
+ return RUBY_Qnil;
650
649
  }
651
650
 
652
651
  /**
@@ -660,20 +659,20 @@ gettextpo_po_message_m_check_all (int argc, VALUE *argv, VALUE self)
660
659
  VALUE iterator, kwargs;
661
660
  rb_scan_args (argc, argv, "1:", &iterator, &kwargs);
662
661
  ID kwargs_ids[] = { rb_intern ("xerror"), rb_intern ("xerror2") };
663
- VALUE kwargs_vals[] = { Qundef, Qundef };
662
+ VALUE kwargs_vals[] = { RUBY_Qundef, RUBY_Qundef };
664
663
  rb_get_kwargs (kwargs, kwargs_ids, 0, 2, kwargs_vals);
665
664
  gettextpo_xerror_context_reset ();
666
665
  VALUE file = rb_ivar_get (self, rb_intern ("@file"));
667
666
  gettextpo_xerror_context.file = &file;
668
- if (kwargs_vals[0] != Qundef)
667
+ if (kwargs_vals[0] != RUBY_Qundef)
669
668
  gettextpo_xerror_context.user_xerror = &kwargs_vals[0];
670
- if (kwargs_vals[1] != Qundef)
669
+ if (kwargs_vals[1] != RUBY_Qundef)
671
670
  gettextpo_xerror_context.user_xerror2 = &kwargs_vals[1];
672
- po_message_check_all (DATA_PTR (self), DATA_PTR (iterator),
671
+ po_message_check_all (RTYPEDDATA_DATA (self), RTYPEDDATA_DATA (iterator),
673
672
  &gettextpo_xerror_handler);
674
673
  if (gettextpo_xerror_context.error)
675
674
  rb_raise (ERROR, "check all for message failed");
676
- return Qnil;
675
+ return RUBY_Qnil;
677
676
  }
678
677
 
679
678
  /**
@@ -687,19 +686,19 @@ gettextpo_po_message_m_check_format (int argc, VALUE *argv, VALUE self)
687
686
  VALUE kwargs;
688
687
  rb_scan_args (argc, argv, ":", &kwargs);
689
688
  ID kwargs_ids[] = { rb_intern ("xerror"), rb_intern ("xerror2") };
690
- VALUE kwargs_vals[] = { Qundef, Qundef };
689
+ VALUE kwargs_vals[] = { RUBY_Qundef, RUBY_Qundef };
691
690
  rb_get_kwargs (kwargs, kwargs_ids, 0, 2, kwargs_vals);
692
691
  gettextpo_xerror_context_reset ();
693
692
  VALUE file = rb_ivar_get (self, rb_intern ("@file"));
694
693
  gettextpo_xerror_context.file = &file;
695
- if (kwargs_vals[0] != Qundef)
694
+ if (kwargs_vals[0] != RUBY_Qundef)
696
695
  gettextpo_xerror_context.user_xerror = &kwargs_vals[0];
697
- if (kwargs_vals[1] != Qundef)
696
+ if (kwargs_vals[1] != RUBY_Qundef)
698
697
  gettextpo_xerror_context.user_xerror2 = &kwargs_vals[1];
699
- po_message_check_format (DATA_PTR (self), &gettextpo_xerror_handler);
698
+ po_message_check_format (RTYPEDDATA_DATA (self), &gettextpo_xerror_handler);
700
699
  if (gettextpo_xerror_context.error)
701
700
  rb_raise (ERROR, "check format for message failed");
702
- return Qnil;
701
+ return RUBY_Qnil;
703
702
  }
704
703
 
705
704
  /* ********** file ********** */
@@ -732,7 +731,7 @@ gettextpo_po_file_alloc (VALUE self)
732
731
  VALUE
733
732
  gettextpo_po_file_m_initialize (VALUE self)
734
733
  {
735
- DATA_PTR (self) = po_file_create ();
734
+ RTYPEDDATA_DATA (self) = po_file_create ();
736
735
  return self;
737
736
  }
738
737
 
@@ -753,20 +752,20 @@ gettextpo_po_file_m_read (int argc, VALUE *argv, VALUE klass)
753
752
  VALUE filename, kwargs;
754
753
  rb_scan_args (argc, argv, "1:", &filename, &kwargs);
755
754
  ID kwargs_ids[] = { rb_intern ("xerror"), rb_intern ("xerror2") };
756
- VALUE kwargs_vals[] = { Qundef, Qundef };
755
+ VALUE kwargs_vals[] = { RUBY_Qundef, RUBY_Qundef };
757
756
  rb_get_kwargs (kwargs, kwargs_ids, 0, 2, kwargs_vals);
758
757
  gettextpo_xerror_context_reset ();
759
758
  VALUE self = rb_obj_alloc (klass);
760
759
  gettextpo_xerror_context.file = &self;
761
- if (kwargs_vals[0] != Qundef)
760
+ if (kwargs_vals[0] != RUBY_Qundef)
762
761
  gettextpo_xerror_context.user_xerror = &kwargs_vals[0];
763
- if (kwargs_vals[1] != Qundef)
762
+ if (kwargs_vals[1] != RUBY_Qundef)
764
763
  gettextpo_xerror_context.user_xerror2 = &kwargs_vals[1];
765
764
  po_file_t file
766
765
  = po_file_read (StringValueCStr (filename), &gettextpo_xerror_handler);
767
766
  if (file)
768
767
  {
769
- DATA_PTR (self) = file;
768
+ RTYPEDDATA_DATA (self) = file;
770
769
  if (gettextpo_xerror_context.error)
771
770
  rb_raise (ERROR, "failed to read");
772
771
  return self;
@@ -786,25 +785,25 @@ gettextpo_po_file_m_write (int argc, VALUE *argv, VALUE self)
786
785
  VALUE filename, kwargs;
787
786
  rb_scan_args (argc, argv, "1:", &filename, &kwargs);
788
787
  ID kwargs_ids[] = { rb_intern ("xerror"), rb_intern ("xerror2") };
789
- VALUE kwargs_vals[] = { Qundef, Qundef };
788
+ VALUE kwargs_vals[] = { RUBY_Qundef, RUBY_Qundef };
790
789
  rb_get_kwargs (kwargs, kwargs_ids, 0, 2, kwargs_vals);
791
790
  gettextpo_xerror_context_reset ();
792
791
  gettextpo_xerror_context.file = &self;
793
- if (kwargs_vals[0] != Qundef)
792
+ if (kwargs_vals[0] != RUBY_Qundef)
794
793
  gettextpo_xerror_context.user_xerror = &kwargs_vals[0];
795
- if (kwargs_vals[1] != Qundef)
794
+ if (kwargs_vals[1] != RUBY_Qundef)
796
795
  gettextpo_xerror_context.user_xerror2 = &kwargs_vals[1];
797
- po_file_write (DATA_PTR (self), StringValueCStr (filename),
796
+ po_file_write (RTYPEDDATA_DATA (self), StringValueCStr (filename),
798
797
  &gettextpo_xerror_handler);
799
798
  if (gettextpo_xerror_context.error)
800
799
  rb_raise (ERROR, "failed to write");
801
- return Qnil;
800
+ return RUBY_Qnil;
802
801
  }
803
802
 
804
803
  VALUE
805
804
  gettextpo_po_file_m_domains (VALUE self)
806
805
  {
807
- const char *const *domains = po_file_domains (DATA_PTR (self));
806
+ const char *const *domains = po_file_domains (RTYPEDDATA_DATA (self));
808
807
  VALUE result = rb_ary_new ();
809
808
  for (size_t index = 0; domains[index]; index++)
810
809
  rb_ary_push (result, rb_str_new_cstr (domains[index]));
@@ -825,8 +824,9 @@ gettextpo_po_file_m_message_iterator (int argc, VALUE *argv, VALUE self)
825
824
  VALUE domain;
826
825
  rb_scan_args (argc, argv, "01", &domain);
827
826
  VALUE iterator = rb_obj_alloc (rb_cMessageIterator);
828
- DATA_PTR (iterator) = po_message_iterator (
829
- DATA_PTR (self), NIL_P (domain) ? NULL : StringValueCStr (domain));
827
+ RTYPEDDATA_DATA (iterator)
828
+ = po_message_iterator (RTYPEDDATA_DATA (self),
829
+ NIL_P (domain) ? NULL : StringValueCStr (domain));
830
830
  rb_ivar_set (iterator, rb_intern ("@file"), self);
831
831
  return iterator;
832
832
  }
@@ -844,8 +844,9 @@ gettextpo_po_file_m_domain_header (int argc, VALUE *argv, VALUE self)
844
844
  VALUE domain;
845
845
  rb_scan_args (argc, argv, "01", &domain);
846
846
  const char *header = po_file_domain_header (
847
- DATA_PTR (self), NIL_P (domain) ? NULL : StringValueCStr (domain));
848
- return header ? rb_str_new_cstr (header) : Qnil;
847
+ RTYPEDDATA_DATA (self),
848
+ NIL_P (domain) ? NULL : StringValueCStr (domain));
849
+ return header ? rb_str_new_cstr (header) : RUBY_Qnil;
849
850
  }
850
851
 
851
852
  /**
@@ -859,18 +860,18 @@ gettextpo_po_file_m_check_all (int argc, VALUE *argv, VALUE self)
859
860
  VALUE kwargs;
860
861
  rb_scan_args (argc, argv, ":", &kwargs);
861
862
  ID kwargs_ids[] = { rb_intern ("xerror"), rb_intern ("xerror2") };
862
- VALUE kwargs_vals[] = { Qundef, Qundef };
863
+ VALUE kwargs_vals[] = { RUBY_Qundef, RUBY_Qundef };
863
864
  rb_get_kwargs (kwargs, kwargs_ids, 0, 2, kwargs_vals);
864
865
  gettextpo_xerror_context_reset ();
865
866
  gettextpo_xerror_context.file = &self;
866
- if (kwargs_vals[0] != Qundef)
867
+ if (kwargs_vals[0] != RUBY_Qundef)
867
868
  gettextpo_xerror_context.user_xerror = &kwargs_vals[0];
868
- if (kwargs_vals[1] != Qundef)
869
+ if (kwargs_vals[1] != RUBY_Qundef)
869
870
  gettextpo_xerror_context.user_xerror2 = &kwargs_vals[1];
870
- po_file_check_all (DATA_PTR (self), &gettextpo_xerror_handler);
871
+ po_file_check_all (RTYPEDDATA_DATA (self), &gettextpo_xerror_handler);
871
872
  if (gettextpo_xerror_context.error)
872
873
  rb_raise (ERROR, "check all for file failed");
873
- return Qnil;
874
+ return RUBY_Qnil;
874
875
  }
875
876
 
876
877
  /* ********** iterator ********** */
@@ -896,11 +897,11 @@ gettextpo_po_message_iterator_alloc (VALUE self)
896
897
  VALUE
897
898
  gettextpo_po_message_iterator_m_next (VALUE self)
898
899
  {
899
- po_message_t message = po_next_message (DATA_PTR (self));
900
+ po_message_t message = po_next_message (RTYPEDDATA_DATA (self));
900
901
  if (message)
901
902
  {
902
903
  VALUE message_value = rb_obj_alloc (rb_cMessage);
903
- DATA_PTR (message_value) = message;
904
+ RTYPEDDATA_DATA (message_value) = message;
904
905
  rb_ivar_set (message_value, rb_intern ("@file"),
905
906
  rb_ivar_get (self, rb_intern ("@file")));
906
907
  return message_value;
@@ -918,9 +919,9 @@ gettextpo_po_message_iterator_m_insert (VALUE self, VALUE msgid, VALUE msgstr)
918
919
  po_message_t message = po_message_create ();
919
920
  po_message_set_msgid (message, StringValueCStr (msgid));
920
921
  po_message_set_msgstr (message, StringValueCStr (msgstr));
921
- po_message_insert (DATA_PTR (self), message);
922
+ po_message_insert (RTYPEDDATA_DATA (self), message);
922
923
  VALUE value = rb_obj_alloc (rb_cMessage);
923
- DATA_PTR (value) = message;
924
+ RTYPEDDATA_DATA (value) = message;
924
925
  rb_ivar_set (value, rb_intern ("@file"),
925
926
  rb_ivar_get (self, rb_intern ("@file")));
926
927
  return value;
@@ -951,8 +952,8 @@ gettextpo_po_filepos_alloc (VALUE self)
951
952
  VALUE
952
953
  gettextpo_po_filepos_m_file (VALUE self)
953
954
  {
954
- const char *file = po_filepos_file (DATA_PTR (self));
955
- return file ? rb_str_new_cstr (file) : Qnil;
955
+ const char *file = po_filepos_file (RTYPEDDATA_DATA (self));
956
+ return file ? rb_str_new_cstr (file) : RUBY_Qnil;
956
957
  }
957
958
 
958
959
  /**
@@ -961,8 +962,8 @@ gettextpo_po_filepos_m_file (VALUE self)
961
962
  VALUE
962
963
  gettextpo_po_filepos_m_start_line (VALUE self)
963
964
  {
964
- size_t start_line = po_filepos_start_line (DATA_PTR (self));
965
- return start_line == (size_t)(-1) ? Qnil : INT2NUM (start_line);
965
+ size_t start_line = po_filepos_start_line (RTYPEDDATA_DATA (self));
966
+ return start_line == (size_t)(-1) ? RUBY_Qnil : INT2NUM (start_line);
966
967
  }
967
968
 
968
969
  /* ********** others ********** */
@@ -975,6 +976,7 @@ gettextpo_po_filepos_m_start_line (VALUE self)
975
976
  VALUE
976
977
  gettextpo_m_header_entry_value (VALUE self, VALUE header, VALUE field)
977
978
  {
979
+ (void)self;
978
980
  char *string
979
981
  = po_header_field (StringValueCStr (header), StringValueCStr (field));
980
982
  if (string)
@@ -984,7 +986,7 @@ gettextpo_m_header_entry_value (VALUE self, VALUE header, VALUE field)
984
986
  return value;
985
987
  }
986
988
  else
987
- return Qnil;
989
+ return RUBY_Qnil;
988
990
  }
989
991
 
990
992
  /**
@@ -996,6 +998,7 @@ VALUE
996
998
  gettextpo_m_header_with_updated_entry_value (VALUE self, VALUE header,
997
999
  VALUE field, VALUE value)
998
1000
  {
1001
+ (void)self;
999
1002
  char *updated_header
1000
1003
  = po_header_set_field (StringValueCStr (header), StringValueCStr (field),
1001
1004
  StringValueCStr (value));
@@ -1007,6 +1010,7 @@ gettextpo_m_header_with_updated_entry_value (VALUE self, VALUE header,
1007
1010
  VALUE
1008
1011
  gettextpo_po_format_list (VALUE self)
1009
1012
  {
1013
+ (void)self;
1010
1014
  VALUE list = rb_ary_new ();
1011
1015
  const char *const *formats = po_format_list ();
1012
1016
  for (size_t index = 0; formats[index]; index++)
@@ -1024,8 +1028,9 @@ gettextpo_po_format_list (VALUE self)
1024
1028
  VALUE
1025
1029
  gettextpo_po_format_pretty_name (VALUE self, VALUE format)
1026
1030
  {
1031
+ (void)self;
1027
1032
  const char *name = po_format_pretty_name (StringValueCStr (format));
1028
- return name ? rb_str_new_cstr (name) : Qnil;
1033
+ return name ? rb_str_new_cstr (name) : RUBY_Qnil;
1029
1034
  }
1030
1035
 
1031
1036
  /* ********** init ********** */
@@ -19,5 +19,5 @@
19
19
 
20
20
  module GettextPO
21
21
  # Version of this gem.
22
- VERSION = "0.4.0"
22
+ VERSION = "0.4.1"
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettextpo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  version: '0'
56
56
  requirements:
57
57
  - libgettextpo
58
- rubygems_version: 4.0.6
58
+ rubygems_version: 3.6.9
59
59
  specification_version: 4
60
60
  summary: GNU gettext PO file parser library
61
61
  test_files: []