rmagick 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

data/ext/RMagick/rminfo.c CHANGED
@@ -12,6 +12,16 @@
12
12
 
13
13
  #include "rmagick.h"
14
14
 
15
+ static void Info_free(void *infoptr);
16
+ static size_t Info_memsize(const void *infoptr);
17
+
18
+ const rb_data_type_t rm_info_data_type = {
19
+ "Magick::Image::Info",
20
+ { NULL, Info_free, Info_memsize, },
21
+ 0, 0,
22
+ RUBY_TYPED_FROZEN_SHAREABLE,
23
+ };
24
+
15
25
 
16
26
  /**
17
27
  * Return the value of the specified option.
@@ -28,7 +38,7 @@ get_option(VALUE self, const char *key)
28
38
  Info *info;
29
39
  const char *value;
30
40
 
31
- Data_Get_Struct(self, Info, info);
41
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
32
42
 
33
43
  value = GetImageOption(info, key);
34
44
  if (value)
@@ -54,7 +64,7 @@ set_option(VALUE self, const char *key, VALUE string)
54
64
  {
55
65
  Info *info;
56
66
 
57
- Data_Get_Struct(self, Info, info);
67
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
58
68
 
59
69
  if (NIL_P(string))
60
70
  {
@@ -90,7 +100,7 @@ static VALUE set_color_option(VALUE self, const char *option, VALUE color)
90
100
  PixelColor pp;
91
101
  MagickBooleanType okay;
92
102
 
93
- Data_Get_Struct(self, Info, info);
103
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
94
104
 
95
105
  if (NIL_P(color))
96
106
  {
@@ -136,7 +146,7 @@ static VALUE get_dbl_option(VALUE self, const char *option)
136
146
  double d;
137
147
  long n;
138
148
 
139
- Data_Get_Struct(self, Info, info);
149
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
140
150
 
141
151
  value = GetImageOption(info, option);
142
152
  if (!value)
@@ -167,7 +177,7 @@ static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
167
177
  {
168
178
  Info *info;
169
179
 
170
- Data_Get_Struct(self, Info, info);
180
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
171
181
 
172
182
  if (NIL_P(value))
173
183
  {
@@ -206,7 +216,7 @@ static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
206
216
  VALUE
207
217
  Info_antialias(VALUE self)
208
218
  {
209
- IMPLEMENT_ATTR_READER(Info, antialias, boolean);
219
+ IMPLEMENT_TYPED_ATTR_READER(Info, antialias, boolean, &rm_info_data_type);
210
220
  }
211
221
 
212
222
  /**
@@ -218,7 +228,7 @@ Info_antialias(VALUE self)
218
228
  VALUE
219
229
  Info_antialias_eq(VALUE self, VALUE val)
220
230
  {
221
- IMPLEMENT_ATTR_WRITER(Info, antialias, boolean);
231
+ IMPLEMENT_TYPED_ATTR_WRITER(Info, antialias, boolean, &rm_info_data_type);
222
232
  }
223
233
 
224
234
  /** Maximum length of a format (@see Info_aref) */
@@ -272,7 +282,7 @@ Info_aref(int argc, VALUE *argv, VALUE self)
272
282
 
273
283
  }
274
284
 
275
- Data_Get_Struct(self, Info, info);
285
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
276
286
  value = GetImageOption(info, fkey);
277
287
  if (!value)
278
288
  {
@@ -311,7 +321,7 @@ Info_aset(int argc, VALUE *argv, VALUE self)
311
321
  long format_l, key_l;
312
322
  char ckey[MaxTextExtent];
313
323
 
314
- Data_Get_Struct(self, Info, info);
324
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
315
325
 
316
326
  switch (argc)
317
327
  {
@@ -401,7 +411,7 @@ Info_authenticate(VALUE self)
401
411
  {
402
412
  Info *info;
403
413
 
404
- Data_Get_Struct(self, Info, info);
414
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
405
415
  #if defined(IMAGEMAGICK_7)
406
416
  return C_str_to_R_str(GetImageOption(info, "authenticate"));
407
417
  #else
@@ -422,7 +432,7 @@ Info_authenticate_eq(VALUE self, VALUE passwd_arg)
422
432
  Info *info;
423
433
  char *passwd = NULL;
424
434
 
425
- Data_Get_Struct(self, Info, info);
435
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
426
436
 
427
437
  if (!NIL_P(passwd_arg))
428
438
  {
@@ -465,7 +475,7 @@ Info_background_color(VALUE self)
465
475
  {
466
476
  Info *info;
467
477
 
468
- Data_Get_Struct(self, Info, info);
478
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
469
479
  return rm_pixelcolor_to_color_name_info(info, &info->background_color);
470
480
  }
471
481
 
@@ -481,7 +491,7 @@ Info_background_color_eq(VALUE self, VALUE bc_arg)
481
491
  {
482
492
  Info *info;
483
493
 
484
- Data_Get_Struct(self, Info, info);
494
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
485
495
  Color_to_PixelColor(&info->background_color, bc_arg);
486
496
 
487
497
  return bc_arg;
@@ -498,7 +508,7 @@ Info_border_color(VALUE self)
498
508
  {
499
509
  Info *info;
500
510
 
501
- Data_Get_Struct(self, Info, info);
511
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
502
512
  return rm_pixelcolor_to_color_name_info(info, &info->border_color);
503
513
  }
504
514
 
@@ -513,7 +523,7 @@ Info_border_color_eq(VALUE self, VALUE bc_arg)
513
523
  {
514
524
  Info *info;
515
525
 
516
- Data_Get_Struct(self, Info, info);
526
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
517
527
  Color_to_PixelColor(&info->border_color, bc_arg);
518
528
 
519
529
  return bc_arg;
@@ -572,7 +582,7 @@ Info_channel(int argc, VALUE *argv, VALUE self)
572
582
  raise_ChannelType_error(argv[argc-1]);
573
583
  }
574
584
 
575
- Data_Get_Struct(self, Info, info);
585
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
576
586
 
577
587
  info->channel = channels;
578
588
  return self;
@@ -589,7 +599,7 @@ Info_colorspace(VALUE self)
589
599
  {
590
600
  Info *info;
591
601
 
592
- Data_Get_Struct(self, Info, info);
602
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
593
603
  return ColorspaceType_find(info->colorspace);
594
604
  }
595
605
 
@@ -604,7 +614,7 @@ Info_colorspace_eq(VALUE self, VALUE colorspace)
604
614
  {
605
615
  Info *info;
606
616
 
607
- Data_Get_Struct(self, Info, info);
617
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
608
618
  VALUE_TO_ENUM(colorspace, info->colorspace, ColorspaceType);
609
619
  return colorspace;
610
620
  }
@@ -640,7 +650,7 @@ Info_compression(VALUE self)
640
650
  {
641
651
  Info *info;
642
652
 
643
- Data_Get_Struct(self, Info, info);
653
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
644
654
  return CompressionType_find(info->compression);
645
655
  }
646
656
 
@@ -655,7 +665,7 @@ Info_compression_eq(VALUE self, VALUE type)
655
665
  {
656
666
  Info *info;
657
667
 
658
- Data_Get_Struct(self, Info, info);
668
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
659
669
  VALUE_TO_ENUM(type, info->compression, CompressionType);
660
670
  return type;
661
671
  }
@@ -681,7 +691,7 @@ Info_define(int argc, VALUE *argv, VALUE self)
681
691
  unsigned int okay;
682
692
  VALUE fmt_arg;
683
693
 
684
- Data_Get_Struct(self, Info, info);
694
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
685
695
 
686
696
  switch (argc)
687
697
  {
@@ -728,7 +738,7 @@ Info_delay(VALUE self)
728
738
  const char *delay;
729
739
  char *p;
730
740
 
731
- Data_Get_Struct(self, Info, info);
741
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
732
742
 
733
743
  delay = GetImageOption(info, "delay");
734
744
  if (delay)
@@ -771,7 +781,7 @@ Info_delay_eq(VALUE self, VALUE string)
771
781
  Info *info;
772
782
  int not_num;
773
783
 
774
- Data_Get_Struct(self, Info, info);
784
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
775
785
 
776
786
  if (NIL_P(string))
777
787
  {
@@ -803,7 +813,7 @@ Info_delay_eq(VALUE self, VALUE string)
803
813
  VALUE
804
814
  Info_density(VALUE self)
805
815
  {
806
- IMPLEMENT_ATTR_READER(Info, density, str);
816
+ IMPLEMENT_TYPED_ATTR_READER(Info, density, str, &rm_info_data_type);
807
817
  }
808
818
 
809
819
  /**
@@ -820,7 +830,7 @@ Info_density_eq(VALUE self, VALUE density_arg)
820
830
  VALUE density;
821
831
  char *dens;
822
832
 
823
- Data_Get_Struct(self, Info, info);
833
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
824
834
 
825
835
  if (NIL_P(density_arg))
826
836
  {
@@ -851,7 +861,7 @@ Info_density_eq(VALUE self, VALUE density_arg)
851
861
  VALUE
852
862
  Info_depth(VALUE self)
853
863
  {
854
- IMPLEMENT_ATTR_READER(Info, depth, int);
864
+ IMPLEMENT_TYPED_ATTR_READER(Info, depth, int, &rm_info_data_type);
855
865
  }
856
866
 
857
867
  /**
@@ -866,7 +876,7 @@ Info_depth_eq(VALUE self, VALUE depth)
866
876
  Info *info;
867
877
  unsigned long d;
868
878
 
869
- Data_Get_Struct(self, Info, info);
879
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
870
880
  d = NUM2ULONG(depth);
871
881
  switch (d)
872
882
  {
@@ -950,7 +960,7 @@ Info_dispose(VALUE self)
950
960
  ID dispose_id;
951
961
  const char *dispose;
952
962
 
953
- Data_Get_Struct(self, Info, info);
963
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
954
964
 
955
965
  dispose_id = rb_intern("UndefinedDispose");
956
966
 
@@ -985,7 +995,7 @@ Info_dispose_eq(VALUE self, VALUE disp)
985
995
  const char *option;
986
996
  int x;
987
997
 
988
- Data_Get_Struct(self, Info, info);
998
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
989
999
 
990
1000
  if (NIL_P(disp))
991
1001
  {
@@ -1017,7 +1027,7 @@ Info_dispose_eq(VALUE self, VALUE disp)
1017
1027
  VALUE
1018
1028
  Info_dither(VALUE self)
1019
1029
  {
1020
- IMPLEMENT_ATTR_READER(Info, dither, boolean);
1030
+ IMPLEMENT_TYPED_ATTR_READER(Info, dither, boolean, &rm_info_data_type);
1021
1031
  }
1022
1032
 
1023
1033
  /**
@@ -1029,7 +1039,7 @@ Info_dither(VALUE self)
1029
1039
  VALUE
1030
1040
  Info_dither_eq(VALUE self, VALUE val)
1031
1041
  {
1032
- IMPLEMENT_ATTR_WRITER(Info, dither, boolean);
1042
+ IMPLEMENT_TYPED_ATTR_WRITER(Info, dither, boolean, &rm_info_data_type);
1033
1043
  }
1034
1044
 
1035
1045
 
@@ -1043,7 +1053,7 @@ Info_endian(VALUE self)
1043
1053
  {
1044
1054
  Info *info;
1045
1055
 
1046
- Data_Get_Struct(self, Info, info);
1056
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1047
1057
  return EndianType_find(info->endian);
1048
1058
  }
1049
1059
 
@@ -1065,7 +1075,7 @@ Info_endian_eq(VALUE self, VALUE endian)
1065
1075
  VALUE_TO_ENUM(endian, type, EndianType);
1066
1076
  }
1067
1077
 
1068
- Data_Get_Struct(self, Info, info);
1078
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1069
1079
  info->endian = type;
1070
1080
  return endian;
1071
1081
  }
@@ -1080,7 +1090,7 @@ Info_endian_eq(VALUE self, VALUE endian)
1080
1090
  VALUE
1081
1091
  Info_extract(VALUE self)
1082
1092
  {
1083
- IMPLEMENT_ATTR_READER(Info, extract, str);
1093
+ IMPLEMENT_TYPED_ATTR_READER(Info, extract, str, &rm_info_data_type);
1084
1094
  }
1085
1095
 
1086
1096
  /**
@@ -1097,7 +1107,7 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
1097
1107
  char *extr;
1098
1108
  VALUE extract;
1099
1109
 
1100
- Data_Get_Struct(self, Info, info);
1110
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1101
1111
 
1102
1112
  if (NIL_P(extract_arg))
1103
1113
  {
@@ -1133,7 +1143,7 @@ Info_filename(VALUE self)
1133
1143
  {
1134
1144
  Info *info;
1135
1145
 
1136
- Data_Get_Struct(self, Info, info);
1146
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1137
1147
  return rb_str_new2(info->filename);
1138
1148
  }
1139
1149
 
@@ -1150,7 +1160,7 @@ Info_filename_eq(VALUE self, VALUE filename)
1150
1160
  {
1151
1161
  Info *info;
1152
1162
 
1153
- Data_Get_Struct(self, Info, info);
1163
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1154
1164
 
1155
1165
  // Allow "nil" - remove current filename
1156
1166
  if (NIL_P(filename) || StringValueCStr(filename) == NULL)
@@ -1201,7 +1211,7 @@ Info_fill_eq(VALUE self, VALUE color)
1201
1211
  VALUE
1202
1212
  Info_font(VALUE self)
1203
1213
  {
1204
- IMPLEMENT_ATTR_READER(Info, font, str);
1214
+ IMPLEMENT_TYPED_ATTR_READER(Info, font, str, &rm_info_data_type);
1205
1215
  }
1206
1216
 
1207
1217
  /**
@@ -1215,7 +1225,7 @@ Info_font_eq(VALUE self, VALUE font_arg)
1215
1225
  {
1216
1226
  Info *info;
1217
1227
 
1218
- Data_Get_Struct(self, Info, info);
1228
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1219
1229
  if (NIL_P(font_arg) || StringValueCStr(font_arg) == NULL)
1220
1230
  {
1221
1231
  magick_free(info->font);
@@ -1240,7 +1250,7 @@ VALUE Info_format(VALUE self)
1240
1250
  {
1241
1251
  Info *info;
1242
1252
 
1243
- Data_Get_Struct(self, Info, info);
1253
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1244
1254
  if (*info->magick)
1245
1255
  {
1246
1256
  const MagickInfo *magick_info;
@@ -1270,7 +1280,7 @@ Info_format_eq(VALUE self, VALUE magick)
1270
1280
  char *mgk;
1271
1281
  ExceptionInfo *exception;
1272
1282
 
1273
- Data_Get_Struct(self, Info, info);
1283
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1274
1284
 
1275
1285
  mgk = StringValueCStr(magick);
1276
1286
 
@@ -1297,7 +1307,7 @@ Info_format_eq(VALUE self, VALUE magick)
1297
1307
  VALUE
1298
1308
  Info_fuzz(VALUE self)
1299
1309
  {
1300
- IMPLEMENT_ATTR_READER(Info, fuzz, dbl);
1310
+ IMPLEMENT_TYPED_ATTR_READER(Info, fuzz, dbl, &rm_info_data_type);
1301
1311
  }
1302
1312
 
1303
1313
  /**
@@ -1313,7 +1323,7 @@ Info_fuzz_eq(VALUE self, VALUE fuzz)
1313
1323
  {
1314
1324
  Info *info;
1315
1325
 
1316
- Data_Get_Struct(self, Info, info);
1326
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1317
1327
  info->fuzz = rm_fuzz_to_dbl(fuzz);
1318
1328
  return fuzz;
1319
1329
  }
@@ -1380,7 +1390,7 @@ VALUE Info_gravity(VALUE self)
1380
1390
  const char *gravity;
1381
1391
  ID gravity_id;
1382
1392
 
1383
- Data_Get_Struct(self, Info, info);
1393
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1384
1394
 
1385
1395
  gravity_id = rb_intern("UndefinedGravity");
1386
1396
 
@@ -1416,7 +1426,7 @@ Info_gravity_eq(VALUE self, VALUE grav)
1416
1426
  const char *option;
1417
1427
  int x;
1418
1428
 
1419
- Data_Get_Struct(self, Info, info);
1429
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1420
1430
 
1421
1431
  if (NIL_P(grav))
1422
1432
  {
@@ -1451,7 +1461,7 @@ Info_image_type(VALUE self)
1451
1461
  {
1452
1462
  Info *info;
1453
1463
 
1454
- Data_Get_Struct(self, Info, info);
1464
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1455
1465
  return ImageType_find(info->type);
1456
1466
  }
1457
1467
 
@@ -1466,7 +1476,7 @@ Info_image_type_eq(VALUE self, VALUE type)
1466
1476
  {
1467
1477
  Info *info;
1468
1478
 
1469
- Data_Get_Struct(self, Info, info);
1479
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1470
1480
  VALUE_TO_ENUM(type, info->type, ImageType);
1471
1481
  return type;
1472
1482
  }
@@ -1481,7 +1491,7 @@ Info_interlace(VALUE self)
1481
1491
  {
1482
1492
  Info *info;
1483
1493
 
1484
- Data_Get_Struct(self, Info, info);
1494
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1485
1495
  return InterlaceType_find(info->interlace);
1486
1496
  }
1487
1497
 
@@ -1496,7 +1506,7 @@ Info_interlace_eq(VALUE self, VALUE inter)
1496
1506
  {
1497
1507
  Info *info;
1498
1508
 
1499
- Data_Get_Struct(self, Info, info);
1509
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1500
1510
  VALUE_TO_ENUM(inter, info->interlace, InterlaceType);
1501
1511
  return inter;
1502
1512
  }
@@ -1533,7 +1543,7 @@ Info_matte_color(VALUE self)
1533
1543
  {
1534
1544
  Info *info;
1535
1545
 
1536
- Data_Get_Struct(self, Info, info);
1546
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1537
1547
  return rm_pixelcolor_to_color_name_info(info, &info->matte_color);
1538
1548
  }
1539
1549
 
@@ -1548,7 +1558,7 @@ Info_matte_color_eq(VALUE self, VALUE matte_arg)
1548
1558
  {
1549
1559
  Info *info;
1550
1560
 
1551
- Data_Get_Struct(self, Info, info);
1561
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1552
1562
  Color_to_PixelColor(&info->matte_color, matte_arg);
1553
1563
 
1554
1564
  return matte_arg;
@@ -1562,7 +1572,7 @@ Info_matte_color_eq(VALUE self, VALUE matte_arg)
1562
1572
  VALUE
1563
1573
  Info_monochrome(VALUE self)
1564
1574
  {
1565
- IMPLEMENT_ATTR_READER(Info, monochrome, boolean);
1575
+ IMPLEMENT_TYPED_ATTR_READER(Info, monochrome, boolean, &rm_info_data_type);
1566
1576
  }
1567
1577
 
1568
1578
  /**
@@ -1574,7 +1584,7 @@ Info_monochrome(VALUE self)
1574
1584
  VALUE
1575
1585
  Info_monochrome_eq(VALUE self, VALUE val)
1576
1586
  {
1577
- IMPLEMENT_ATTR_WRITER(Info, monochrome, boolean);
1587
+ IMPLEMENT_TYPED_ATTR_WRITER(Info, monochrome, boolean, &rm_info_data_type);
1578
1588
  }
1579
1589
 
1580
1590
  /**
@@ -1585,7 +1595,7 @@ Info_monochrome_eq(VALUE self, VALUE val)
1585
1595
  VALUE
1586
1596
  Info_number_scenes(VALUE self)
1587
1597
  {
1588
- IMPLEMENT_ATTR_READER(Info, number_scenes, ulong);
1598
+ IMPLEMENT_TYPED_ATTR_READER(Info, number_scenes, ulong, &rm_info_data_type);
1589
1599
  }
1590
1600
 
1591
1601
  /**
@@ -1597,7 +1607,7 @@ Info_number_scenes(VALUE self)
1597
1607
  VALUE
1598
1608
  Info_number_scenes_eq(VALUE self, VALUE val)
1599
1609
  {
1600
- IMPLEMENT_ATTR_WRITER(Info, number_scenes, ulong);
1610
+ IMPLEMENT_TYPED_ATTR_WRITER(Info, number_scenes, ulong, &rm_info_data_type);
1601
1611
  }
1602
1612
 
1603
1613
  /**
@@ -1610,7 +1620,7 @@ Info_orientation(VALUE self)
1610
1620
  {
1611
1621
  Info *info;
1612
1622
 
1613
- Data_Get_Struct(self, Info, info);
1623
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1614
1624
  return OrientationType_find(info->orientation);
1615
1625
  }
1616
1626
 
@@ -1626,7 +1636,7 @@ Info_orientation_eq(VALUE self, VALUE inter)
1626
1636
  {
1627
1637
  Info *info;
1628
1638
 
1629
- Data_Get_Struct(self, Info, info);
1639
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1630
1640
  VALUE_TO_ENUM(inter, info->orientation, OrientationType);
1631
1641
  return inter;
1632
1642
  }
@@ -1644,7 +1654,7 @@ Info_origin(VALUE self)
1644
1654
  Info *info;
1645
1655
  const char *origin;
1646
1656
 
1647
- Data_Get_Struct(self, Info, info);
1657
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1648
1658
 
1649
1659
  origin = GetImageOption(info, "origin");
1650
1660
  return origin ? rb_str_new2(origin) : Qnil;
@@ -1669,7 +1679,7 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
1669
1679
  VALUE origin_str;
1670
1680
  char *origin;
1671
1681
 
1672
- Data_Get_Struct(self, Info, info);
1682
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1673
1683
 
1674
1684
  if (NIL_P(origin_arg))
1675
1685
  {
@@ -1705,7 +1715,7 @@ Info_page(VALUE self)
1705
1715
  {
1706
1716
  Info *info;
1707
1717
 
1708
- Data_Get_Struct(self, Info, info);
1718
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1709
1719
  return info->page ? rb_str_new2(info->page) : Qnil;
1710
1720
 
1711
1721
  }
@@ -1725,7 +1735,7 @@ Info_page_eq(VALUE self, VALUE page_arg)
1725
1735
  VALUE geom_str;
1726
1736
  char *geometry;
1727
1737
 
1728
- Data_Get_Struct(self, Info, info);
1738
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1729
1739
  if (NIL_P(page_arg))
1730
1740
  {
1731
1741
  magick_free(info->page);
@@ -1755,7 +1765,7 @@ Info_page_eq(VALUE self, VALUE page_arg)
1755
1765
  VALUE
1756
1766
  Info_pointsize(VALUE self)
1757
1767
  {
1758
- IMPLEMENT_ATTR_READER(Info, pointsize, dbl);
1768
+ IMPLEMENT_TYPED_ATTR_READER(Info, pointsize, dbl, &rm_info_data_type);
1759
1769
  }
1760
1770
 
1761
1771
  /**
@@ -1767,7 +1777,7 @@ Info_pointsize(VALUE self)
1767
1777
  VALUE
1768
1778
  Info_pointsize_eq(VALUE self, VALUE val)
1769
1779
  {
1770
- IMPLEMENT_ATTR_WRITER(Info, pointsize, dbl);
1780
+ IMPLEMENT_TYPED_ATTR_WRITER(Info, pointsize, dbl, &rm_info_data_type);
1771
1781
  }
1772
1782
 
1773
1783
  /**
@@ -1778,7 +1788,7 @@ Info_pointsize_eq(VALUE self, VALUE val)
1778
1788
  VALUE
1779
1789
  Info_quality(VALUE self)
1780
1790
  {
1781
- IMPLEMENT_ATTR_READER(Info, quality, ulong);
1791
+ IMPLEMENT_TYPED_ATTR_READER(Info, quality, ulong, &rm_info_data_type);
1782
1792
  }
1783
1793
 
1784
1794
  /**
@@ -1790,7 +1800,7 @@ Info_quality(VALUE self)
1790
1800
  VALUE
1791
1801
  Info_quality_eq(VALUE self, VALUE val)
1792
1802
  {
1793
- IMPLEMENT_ATTR_WRITER(Info, quality, ulong);
1803
+ IMPLEMENT_TYPED_ATTR_WRITER(Info, quality, ulong, &rm_info_data_type);
1794
1804
  }
1795
1805
 
1796
1806
  /**
@@ -1803,7 +1813,7 @@ Info_sampling_factor(VALUE self)
1803
1813
  {
1804
1814
  Info *info;
1805
1815
 
1806
- Data_Get_Struct(self, Info, info);
1816
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1807
1817
  if (info->sampling_factor)
1808
1818
  {
1809
1819
  return rb_str_new2(info->sampling_factor);
@@ -1827,7 +1837,7 @@ Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
1827
1837
  char *sampling_factor_p = NULL;
1828
1838
  long sampling_factor_len = 0;
1829
1839
 
1830
- Data_Get_Struct(self, Info, info);
1840
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1831
1841
 
1832
1842
  if (!NIL_P(sampling_factor))
1833
1843
  {
@@ -1858,7 +1868,7 @@ Info_scene(VALUE self)
1858
1868
  {
1859
1869
  Info *info;
1860
1870
 
1861
- Data_Get_Struct(self, Info, info);
1871
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1862
1872
  return ULONG2NUM(info->scene);
1863
1873
  }
1864
1874
 
@@ -1875,7 +1885,7 @@ Info_scene_eq(VALUE self, VALUE scene)
1875
1885
  Info *info;
1876
1886
  char buf[25];
1877
1887
 
1878
- Data_Get_Struct(self, Info, info);
1888
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1879
1889
  info->scene = NUM2ULONG(scene);
1880
1890
 
1881
1891
  snprintf(buf, sizeof(buf), "%"RMIuSIZE"", info->scene);
@@ -1893,7 +1903,7 @@ Info_scene_eq(VALUE self, VALUE scene)
1893
1903
  VALUE
1894
1904
  Info_server_name(VALUE self)
1895
1905
  {
1896
- IMPLEMENT_ATTR_READER(Info, server_name, str);
1906
+ IMPLEMENT_TYPED_ATTR_READER(Info, server_name, str, &rm_info_data_type);
1897
1907
  }
1898
1908
 
1899
1909
 
@@ -1908,7 +1918,7 @@ Info_server_name_eq(VALUE self, VALUE server_arg)
1908
1918
  {
1909
1919
  Info *info;
1910
1920
 
1911
- Data_Get_Struct(self, Info, info);
1921
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1912
1922
  if (NIL_P(server_arg) || StringValueCStr(server_arg) == NULL)
1913
1923
  {
1914
1924
  magick_free(info->server_name);
@@ -1933,7 +1943,7 @@ Info_server_name_eq(VALUE self, VALUE server_arg)
1933
1943
  VALUE
1934
1944
  Info_size(VALUE self)
1935
1945
  {
1936
- IMPLEMENT_ATTR_READER(Info, size, str);
1946
+ IMPLEMENT_TYPED_ATTR_READER(Info, size, str, &rm_info_data_type);
1937
1947
  }
1938
1948
 
1939
1949
  /**
@@ -1950,7 +1960,7 @@ Info_size_eq(VALUE self, VALUE size_arg)
1950
1960
  VALUE size;
1951
1961
  char *sz;
1952
1962
 
1953
- Data_Get_Struct(self, Info, info);
1963
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
1954
1964
 
1955
1965
  if (NIL_P(size_arg))
1956
1966
  {
@@ -2036,7 +2046,7 @@ Info_texture_eq(VALUE self, VALUE texture)
2036
2046
  Image *image;
2037
2047
  char name[MaxTextExtent];
2038
2048
 
2039
- Data_Get_Struct(self, Info, info);
2049
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2040
2050
 
2041
2051
  // Delete any existing texture file
2042
2052
  if (info->texture)
@@ -2074,7 +2084,7 @@ Info_tile_offset(VALUE self)
2074
2084
  Info *info;
2075
2085
  const char *tile_offset;
2076
2086
 
2077
- Data_Get_Struct(self, Info, info);
2087
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2078
2088
 
2079
2089
  tile_offset = GetImageOption(info, "tile-offset");
2080
2090
 
@@ -2108,7 +2118,7 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
2108
2118
  rb_raise(rb_eArgError, "invalid tile offset geometry: %s", tile_offset);
2109
2119
  }
2110
2120
 
2111
- Data_Get_Struct(self, Info, info);
2121
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2112
2122
 
2113
2123
  DeleteImageOption(info, "tile-offset");
2114
2124
  SetImageOption(info, "tile-offset", tile_offset);
@@ -2130,7 +2140,7 @@ Info_transparent_color(VALUE self)
2130
2140
  {
2131
2141
  Info *info;
2132
2142
 
2133
- Data_Get_Struct(self, Info, info);
2143
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2134
2144
  return rm_pixelcolor_to_color_name_info(info, &info->transparent_color);
2135
2145
  }
2136
2146
 
@@ -2146,7 +2156,7 @@ Info_transparent_color_eq(VALUE self, VALUE tc_arg)
2146
2156
  {
2147
2157
  Info *info;
2148
2158
 
2149
- Data_Get_Struct(self, Info, info);
2159
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2150
2160
  Color_to_PixelColor(&info->transparent_color, tc_arg);
2151
2161
 
2152
2162
  return tc_arg;
@@ -2178,7 +2188,7 @@ Info_undefine(VALUE self, VALUE format, VALUE key)
2178
2188
 
2179
2189
  snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
2180
2190
 
2181
- Data_Get_Struct(self, Info, info);
2191
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2182
2192
  DeleteImageOption(info, fkey);
2183
2193
 
2184
2194
  return self;
@@ -2218,7 +2228,7 @@ Info_units(VALUE self)
2218
2228
  {
2219
2229
  Info *info;
2220
2230
 
2221
- Data_Get_Struct(self, Info, info);
2231
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2222
2232
  return ResolutionType_find(info->units);
2223
2233
  }
2224
2234
 
@@ -2233,7 +2243,7 @@ Info_units_eq(VALUE self, VALUE units)
2233
2243
  {
2234
2244
  Info *info;
2235
2245
 
2236
- Data_Get_Struct(self, Info, info);
2246
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2237
2247
  VALUE_TO_ENUM(units, info->units, ResolutionType);
2238
2248
  return units;
2239
2249
  }
@@ -2248,7 +2258,7 @@ Info_view(VALUE self)
2248
2258
  {
2249
2259
  Info *info;
2250
2260
 
2251
- Data_Get_Struct(self, Info, info);
2261
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2252
2262
  #if defined(IMAGEMAGICK_7)
2253
2263
  return C_str_to_R_str(GetImageOption(info, "fpx:view"));
2254
2264
  #else
@@ -2268,7 +2278,7 @@ Info_view_eq(VALUE self, VALUE view_arg)
2268
2278
  Info *info;
2269
2279
  char *view = NULL;
2270
2280
 
2271
- Data_Get_Struct(self, Info, info);
2281
+ TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
2272
2282
 
2273
2283
  if (!NIL_P(view_arg))
2274
2284
  {
@@ -2308,7 +2318,7 @@ Info_view_eq(VALUE self, VALUE view_arg)
2308
2318
  * @param infoptr pointer to the Info object
2309
2319
  */
2310
2320
  static void
2311
- destroy_Info(void *infoptr)
2321
+ Info_free(void *infoptr)
2312
2322
  {
2313
2323
  Info *info = (Info *)infoptr;
2314
2324
 
@@ -2322,6 +2332,18 @@ destroy_Info(void *infoptr)
2322
2332
  DestroyImageInfo(info);
2323
2333
  }
2324
2334
 
2335
+ /**
2336
+ * Get Info object size.
2337
+ *
2338
+ * No Ruby usage (internal function)
2339
+ *
2340
+ * @param infoptr pointer to the Info object
2341
+ */
2342
+ static size_t
2343
+ Info_memsize(const void *infoptr)
2344
+ {
2345
+ return sizeof(Info);
2346
+ }
2325
2347
 
2326
2348
  /**
2327
2349
  * Create an Image::Info object.
@@ -2342,7 +2364,7 @@ Info_alloc(VALUE class)
2342
2364
  {
2343
2365
  rb_raise(rb_eNoMemError, "not enough memory to initialize Info object");
2344
2366
  }
2345
- info_obj = Data_Wrap_Struct(class, NULL, destroy_Info, info);
2367
+ info_obj = TypedData_Wrap_Struct(class, &rm_info_data_type, info);
2346
2368
 
2347
2369
  RB_GC_GUARD(info_obj);
2348
2370