ext/RMagick/rmutil.c in rmagick-5.0.0 vs ext/RMagick/rmutil.c in rmagick-5.1.0
- old
+ new
@@ -20,10 +20,13 @@
static VALUE rescue_not_str(VALUE, VALUE ATTRIBUTE_UNUSED) ATTRIBUTE_NORETURN;
static void handle_exception(ExceptionInfo *, Image *, ErrorRetention);
+DEFINE_GVL_STUB5(CloneImage, const Image *, const size_t, const size_t, const MagickBooleanType, ExceptionInfo *);
+
+
/**
* ImageMagick safe version of malloc.
*
* No Ruby usage (internal function)
*
@@ -267,11 +270,11 @@
Image *
rm_check_destroyed(VALUE obj)
{
Image *image;
- Data_Get_Struct(obj, Image, image);
+ TypedData_Get_Struct(obj, Image, &rm_image_data_type, image);
if (!image)
{
rb_raise(Class_DestroyedImageError, "destroyed image");
}
@@ -778,11 +781,11 @@
id += 1;
rb_cv_set(Module_Magick, TMPNAM_CLASS_VAR, INT2FIX(id));
snprintf(temp_name, temp_name_l, "mpri:%d", id);
// Omit "mpri:" from filename to form the key
- okay = SetImageRegistry(ImageRegistryType, temp_name+5, image, exception);
+ okay = (MagickBooleanType)SetImageRegistry(ImageRegistryType, temp_name+5, image, exception);
CHECK_EXCEPTION();
DestroyExceptionInfo(exception);
if (!okay)
{
rb_raise(rb_eRuntimeError, "SetImageRegistry failed.");
@@ -1516,10 +1519,11 @@
{
Image *clone;
ExceptionInfo *exception;
exception = AcquireExceptionInfo();
- clone = CloneImage(image, 0, 0, MagickTrue, exception);
+ GVL_STRUCT_TYPE(CloneImage) args = { image, 0, 0, MagickTrue, exception };
+ clone = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CloneImage), &args);
if (!clone)
{
rb_raise(rb_eNoMemError, "not enough memory to continue");
}
rm_check_exception(exception, clone, DestroyOnError);