ext/RMagick/rmagick.c in rmagick-2.14.0 vs ext/RMagick/rmagick.c in rmagick-2.15.0

- old
+ new

@@ -32,11 +32,11 @@ VALUE Magick_colors(VALUE class) { const ColorInfo **color_info_list; size_t number_colors, x; - volatile VALUE ary; + VALUE ary; ExceptionInfo *exception; exception = AcquireExceptionInfo(); color_info_list = GetColorInfoList("*", &number_colors, exception); @@ -60,10 +60,11 @@ { (void) rb_ary_push(ary, Import_ColorInfo(color_info_list[x])); } magick_free((void *)color_info_list); + RB_GC_GUARD(ary); return ary; } } @@ -81,11 +82,11 @@ VALUE Magick_fonts(VALUE class) { const TypeInfo **type_info; size_t number_types, x; - volatile VALUE ary; + VALUE ary; ExceptionInfo *exception; exception = AcquireExceptionInfo(); type_info = GetTypeInfoList("*", &number_types, exception); CHECK_EXCEPTION() @@ -106,10 +107,11 @@ for (x = 0; x < number_types; x++) { (void) rb_ary_push(ary, Import_TypeInfo((const TypeInfo *)type_info[x])); } magick_free((void *)type_info); + RB_GC_GUARD(ary); return ary; } } @@ -165,11 +167,11 @@ VALUE Magick_init_formats(VALUE class) { const MagickInfo **magick_info; size_t number_formats, x; - volatile VALUE formats; + VALUE formats; ExceptionInfo *exception; class = class; // defeat "never referenced" message from icc formats = rb_hash_new(); @@ -184,10 +186,11 @@ { (void) rb_hash_aset(formats , rb_str_new2(magick_info[x]->name) , MagickInfo_to_format((const MagickInfo *)magick_info[x])); } + RB_GC_GUARD(formats); return formats; } /** @@ -204,11 +207,11 @@ * @return the current/old limit. */ VALUE Magick_limit_resource(int argc, VALUE *argv, VALUE class) { - volatile VALUE resource, limit; + VALUE resource, limit; ResourceType res = UndefinedResource; char *str; ID id; unsigned long cur_limit; @@ -278,15 +281,19 @@ rb_raise(rb_eArgError, "unknown resource: `%s'", str); } break; } + RB_GC_GUARD(resource); + cur_limit = GetMagickResourceLimit(res); if (argc > 1) { (void) SetMagickResourceLimit(res, (MagickSizeType)NUM2ULONG(limit)); } + + RB_GC_GUARD(limit); return ULONG2NUM(cur_limit); }