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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc51525cc3880511b635e26bf96e54159785ecabc95af81dda6f374f073074f5
4
- data.tar.gz: 0f51ed92105011c4d7854946f2cf81c86a6fc5c0fcb48b0bd620e0e6b1f92d01
3
+ metadata.gz: b776ce3e793e02f14844cce0300aaef504783bdb1c190247cdc00b20e1fbc041
4
+ data.tar.gz: 312ff6d1311a59ac2f90b3cf44742698fcacadc39c2d39ec4c5bfedc7ece3103
5
5
  SHA512:
6
- metadata.gz: 9aaca50c60d675aae5e868bf882ad14a544d92586ec02844b4be1a754acac6bac81f4729cf64c14cfe9cb1cfcf0d57b7eaecf179b8ab4097dee94ce44def05c8
7
- data.tar.gz: 7279013b8d46a66dae34870f7f2918043a8e0305c0e7b79623b8dd66e3409a7707baf3dfd551c17927fce8718de57be2d170cfb0b7a2d156ee5420e9bcd9a814
6
+ metadata.gz: 6f826ecaf2f6cc471285dab84981d8513c79a18381d08c5e8e0f09a023da3eedce5cf223f495c3aa73efbc82828fd2b915c5b401548e041d8440b204288045d1
7
+ data.tar.gz: 5758a2256f5cad91968046be67d220dce46de3d9644f925275e2b33fcb37b486a44d5ec06bef0e2644d0108798398798b05cb605b7514af004536cd02edba635
data/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project are documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## RMagick 5.1.0
7
+
8
+ Improvements
9
+ - Improve multi-thread performance by releasing GVL (#1352)
10
+ - Add Ractor support (#1349)
11
+ - Avoid overriding compilation variables (#1365)
12
+ - Remove pkg-config command dependency (#1366)
13
+
6
14
  ## RMagick 5.0.0
7
15
 
8
16
  Improvements
data/README.md CHANGED
@@ -71,33 +71,33 @@ sudo yum install gcc ImageMagick-devel make which
71
71
  On Arch Linux, you can run:
72
72
 
73
73
  ```sh
74
- pacman -Syy pkg-config imagemagick
74
+ pacman -Syy imagemagick
75
75
  ```
76
76
 
77
77
  #### Alpine Linux
78
78
  On Alpine Linux, you can run:
79
79
 
80
80
  ```
81
- apk add pkgconfig imagemagick imagemagick-dev imagemagick-libs
81
+ apk add imagemagick imagemagick-dev imagemagick-libs
82
82
  ```
83
83
 
84
84
  or you can run if you would like to use ImageMagick 6:
85
85
 
86
86
  ```
87
- apk add pkgconfig imagemagick6 imagemagick6-dev imagemagick6-libs
87
+ apk add imagemagick6 imagemagick6-dev imagemagick6-libs
88
88
  ```
89
89
 
90
90
  ### macOS
91
91
  On macOS, you can run:
92
92
 
93
93
  ```sh
94
- brew install pkg-config imagemagick
94
+ brew install imagemagick
95
95
  ```
96
96
 
97
97
  or you can run if you would like to use ImageMagick 6:
98
98
 
99
99
  ```sh
100
- brew install pkg-config imagemagick@6
100
+ brew install imagemagick@6
101
101
  ```
102
102
 
103
103
  ### Windows
@@ -164,15 +164,6 @@ subdirectory of the installation directory for any error messages. These
164
164
  messages typically contain enough additional information for you to be able to
165
165
  diagnose the problem. Also see [this FAQ][libmagick-faq].
166
166
 
167
- On OS X with Homebrew, try (re)installing pkg-config:
168
-
169
- ```sh
170
- brew uninstall pkg-config
171
- brew install pkg-config
172
- brew unlink pkg-config
173
- brew link pkg-config
174
- ```
175
-
176
167
  ### Cannot open shared object file
177
168
 
178
169
  If you get a message like this:
@@ -16,7 +16,8 @@ if [ ! -v IMAGEMAGICK_VERSION ]; then
16
16
  fi
17
17
 
18
18
  export HOMEBREW_NO_AUTO_UPDATE=true
19
- brew install wget pkg-config ghostscript freetype jpeg little-cms2 libomp libpng libtiff liblqr libtool zlib webp
19
+ brew uninstall --force imagemagick imagemagick@6
20
+ brew install wget ghostscript freetype jpeg little-cms2 libomp libpng libtiff liblqr libtool zlib webp
20
21
 
21
22
  export LDFLAGS="-L/usr/local/opt/libxml2/lib -L/usr/local/opt/zlib/lib"
22
23
  export CPPFLAGS="-I/usr/local/opt/libxml2/include -I/usr/local/opt/zlib/include"
@@ -2,6 +2,7 @@ lib_dir = File.expand_path('../../lib', File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
3
3
  require 'rubygems'
4
4
  require 'mkmf'
5
+ require 'pkg-config'
5
6
 
6
7
  module RMagick
7
8
  class Extconf
@@ -94,18 +95,20 @@ module RMagick
94
95
  check_multiple_imagemagick_versions
95
96
  check_partial_imagemagick_versions
96
97
 
97
- libdir = `pkg-config --libs-only-L #{$magick_package}`.chomp.sub('-L', '')
98
- ldflags = "#{ENV['LDFLAGS']} " + `pkg-config --libs #{$magick_package}`.chomp
98
+ original_ldflags = $LDFLAGS.dup
99
+
100
+ libdir = PKGConfig.libs_only_L($magick_package).chomp.sub('-L', '')
101
+ ldflags = "#{ENV['LDFLAGS']} " + PKGConfig.libs($magick_package).chomp
99
102
  rpath = libdir.empty? ? '' : "-Wl,-rpath,#{libdir}"
100
103
 
101
104
  # Save flags
102
- $CPPFLAGS = "#{ENV['CPPFLAGS']} " + `pkg-config --cflags #{$magick_package}`.chomp
103
- $LOCAL_LIBS = "#{ENV['LIBS']} " + `pkg-config --libs #{$magick_package}`.chomp
104
- $LDFLAGS = "#{ldflags} #{rpath}"
105
+ $CPPFLAGS += " #{ENV['CPPFLAGS']} " + PKGConfig.cflags($magick_package).chomp
106
+ $LOCAL_LIBS += " #{ENV['LIBS']} " + PKGConfig.libs($magick_package).chomp
107
+ $LDFLAGS += " #{ldflags} #{rpath}"
105
108
 
106
109
  unless try_link("int main() { }")
107
110
  # if linker does not recognizes '-Wl,-rpath,somewhere' option, it revert to original option
108
- $LDFLAGS = ldflags
111
+ $LDFLAGS = "#{original_ldflags} #{ldflags}"
109
112
  end
110
113
 
111
114
  configure_archflags_for_osx($magick_package) if RUBY_PLATFORM =~ /darwin/ # osx
@@ -113,8 +116,8 @@ module RMagick
113
116
  elsif RUBY_PLATFORM =~ /mingw/ # mingw
114
117
 
115
118
  dir_paths = search_paths_for_library_for_windows
116
- $CPPFLAGS = %(-I"#{dir_paths[:include]}")
117
- $LDFLAGS = %(-L"#{dir_paths[:lib]}")
119
+ $CPPFLAGS += %( -I"#{dir_paths[:include]}")
120
+ $LDFLAGS += %( -L"#{dir_paths[:lib]}")
118
121
  $LDFLAGS << ' -lucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
119
122
 
120
123
  have_library(im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_' : 'CORE_RL_magick_')
@@ -126,11 +129,15 @@ module RMagick
126
129
  $LDFLAGS << %( -libpath:"#{dir_paths[:lib]}")
127
130
  $LDFLAGS << ' -libpath:ucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
128
131
 
129
- $LOCAL_LIBS = im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib'
132
+ $LOCAL_LIBS += ' ' + (im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib')
130
133
 
131
134
  end
132
135
 
133
- $CPPFLAGS << (have_macro('__GNUC__') ? ' -std=gnu99' : ' -std=c99')
136
+ $CPPFLAGS << if have_macro('__GNUC__')
137
+ ' -std=gnu99 -Wno-void-pointer-to-int-cast -Wno-void-pointer-to-enum-cast -Wno-pointer-to-int-cast'
138
+ else
139
+ ' -std=c99'
140
+ end
134
141
  end
135
142
 
136
143
  def exit_failure(msg)
@@ -152,7 +159,7 @@ module RMagick
152
159
 
153
160
  def detect_imagemagick_packages(packages)
154
161
  packages.select do |package|
155
- system "pkg-config --exists #{package}"
162
+ PKGConfig.exist?(package)
156
163
  end
157
164
  end
158
165
 
@@ -255,7 +262,7 @@ module RMagick
255
262
  # issue #169
256
263
  # set ARCHFLAGS appropriately for OSX
257
264
  def configure_archflags_for_osx(magick_package)
258
- return unless `pkg-config #{magick_package} --libs-only-L`.match(%r{-L(.+)/lib})
265
+ return unless PKGConfig.libs_only_L(magick_package).match(%r{-L(.+)/lib})
259
266
 
260
267
  imagemagick_dir = Regexp.last_match(1)
261
268
  command = Dir.glob(File.join(imagemagick_dir, "bin/*")).select { |file| File.executable? file }.first
@@ -330,16 +337,12 @@ module RMagick
330
337
  END_FAILURE
331
338
 
332
339
  if RUBY_PLATFORM !~ /mswin|mingw/
333
- unless find_executable('pkg-config')
334
- exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find pkg-config in #{ENV['PATH']}\n"
335
- end
336
-
337
- unless `pkg-config --libs MagickCore`[/\bl\s*(MagickCore|Magick)6?\b/]
340
+ unless PKGConfig.libs('MagickCore')[/\bl\s*(MagickCore|Magick)6?\b/]
338
341
  exit_failure failure_message
339
342
  end
340
343
 
341
344
  $magick_package = determine_imagemagick_package
342
- $magick_version = `pkg-config #{$magick_package} --modversion`[/^(\d+\.\d+\.\d+)/]
345
+ $magick_version = PKGConfig.modversion($magick_package)[/^(\d+\.\d+\.\d+)/]
343
346
  else
344
347
  `#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
345
348
  $magick_version = Regexp.last_match(1)
@@ -396,9 +399,6 @@ module RMagick
396
399
 
397
400
  def create_makefile_file
398
401
  create_header_file
399
- # Prior to 1.8.5 mkmf duplicated the symbols on the command line and in the
400
- # extconf.h header. Suppress that behavior by removing the symbol array.
401
- $defs = []
402
402
 
403
403
  # Force re-compilation if the generated Makefile changed.
404
404
  $config_h = 'Makefile'
@@ -24,6 +24,7 @@
24
24
  #include <sys/types.h>
25
25
  #include "ruby.h"
26
26
  #include "ruby/io.h"
27
+ #include "rmagick_gvl.h"
27
28
 
28
29
  #if defined(__MINGW32__)
29
30
  // Ruby defines wrong format specifiers for MinGW. So this defines original macro in here.
@@ -61,6 +62,11 @@
61
62
  #undef PACKAGE_TARNAME
62
63
  #undef WORDS_BIGENDIAN
63
64
 
65
+ #ifndef HAVE_RB_EXT_RACTOR_SAFE
66
+ #undef RUBY_TYPED_FROZEN_SHAREABLE
67
+ #define RUBY_TYPED_FROZEN_SHAREABLE 0
68
+ #endif
69
+
64
70
  #include "extconf.h"
65
71
 
66
72
  #if defined(IMAGEMAGICK_7)
@@ -410,6 +416,14 @@ EXTERN ID rm_ID_push; /**< "push" */
410
416
  EXTERN ID rm_ID_values; /**< "values" */
411
417
  EXTERN ID rm_ID_width; /**< "width" */
412
418
 
419
+ extern const rb_data_type_t rm_enum_data_type;
420
+ extern const rb_data_type_t rm_info_data_type;
421
+ extern const rb_data_type_t rm_image_data_type;
422
+ extern const rb_data_type_t rm_draw_data_type;
423
+ extern const rb_data_type_t rm_pixel_data_type;
424
+ extern const rb_data_type_t rm_montage_data_type;
425
+ extern const rb_data_type_t rm_kernel_info_data_type;
426
+
413
427
  #if !defined(min)
414
428
  #define min(a, b) ((a)<(b)?(a):(b)) /**< min of two values */
415
429
  #endif
@@ -440,47 +454,47 @@ EXTERN ID rm_ID_width; /**< "width" */
440
454
  #define R_dbl_to_C_dbl(attr) NUM2DBL(attr) /**< C double <- Ruby double */
441
455
 
442
456
  //! define attribute reader
443
- #define IMPLEMENT_ATTR_READER(class, attr, type) \
457
+ #define IMPLEMENT_TYPED_ATTR_READER(class, attr, type, data_type) \
444
458
  {\
445
459
  class *ptr;\
446
460
  if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
447
461
  rm_check_destroyed(self); \
448
462
  }\
449
- Data_Get_Struct(self, class, ptr);\
463
+ TypedData_Get_Struct(self, class, data_type, ptr);\
450
464
  return C_##type##_to_R_##type(ptr->attr);\
451
465
  }
452
466
 
453
467
  //! define attribute reader when attribute name is different from the field name
454
- #define IMPLEMENT_ATTR_READERF(class, attr, field, type) \
468
+ #define IMPLEMENT_TYPED_ATTR_READERF(class, attr, field, type, data_type) \
455
469
  {\
456
470
  class *ptr;\
457
471
  rm_check_destroyed(self); \
458
- Data_Get_Struct(self, class, ptr);\
472
+ TypedData_Get_Struct(self, class, data_type, ptr);\
459
473
  return C_##type##_to_R_##type(ptr->field);\
460
474
  }
461
475
 
462
476
  //! define attribute writer
463
- #define IMPLEMENT_ATTR_WRITER(class, attr, type) \
477
+ #define IMPLEMENT_TYPED_ATTR_WRITER(class, attr, type, data_type) \
464
478
  {\
465
479
  class *ptr;\
466
480
  if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
467
481
  rm_check_destroyed(self); \
468
482
  }\
469
483
  rb_check_frozen(self);\
470
- Data_Get_Struct(self, class, ptr);\
484
+ TypedData_Get_Struct(self, class, data_type, ptr);\
471
485
  ptr->attr = R_##type##_to_C_##type(val);\
472
486
  return val;\
473
487
  }
474
488
 
475
489
  //! define attribute writer when attribute name is different from the field name
476
- #define IMPLEMENT_ATTR_WRITERF(class, attr, field, type) \
490
+ #define IMPLEMENT_TYPED_ATTR_WRITERF(class, attr, field, type, data_type) \
477
491
  {\
478
492
  class *ptr;\
479
493
  if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
480
494
  rm_check_destroyed(self); \
481
495
  }\
482
496
  rb_check_frozen(self);\
483
- Data_Get_Struct(self, class, ptr);\
497
+ TypedData_Get_Struct(self, class, data_type, ptr);\
484
498
  ptr->field = R_##type##_to_C_##type(val);\
485
499
  return self;\
486
500
  }
@@ -510,7 +524,6 @@ EXTERN ID rm_ID_width; /**< "width" */
510
524
  #define DEF_CONSTV(constant, val) rb_define_const(Module_Magick, #constant, UINT2NUM(val))
511
525
  #endif
512
526
 
513
-
514
527
  //! Convert a Ruby enum constant back to a C enum member.
515
528
  #define VALUE_TO_ENUM(value, e, type) \
516
529
  do {\
@@ -518,7 +531,7 @@ EXTERN ID rm_ID_width; /**< "width" */
518
531
  if (CLASS_OF(value) != Class_##type)\
519
532
  rb_raise(rb_eTypeError, "wrong enumeration type - expected %s, got %s", \
520
533
  rb_class2name(Class_##type), rb_class2name(CLASS_OF(value)));\
521
- Data_Get_Struct(value, MagickEnum, magick_enum);\
534
+ TypedData_Get_Struct(value, MagickEnum, &rm_enum_data_type, magick_enum);\
522
535
  e = (type)(magick_enum->val);\
523
536
  } while(0)
524
537
 
@@ -1039,7 +1052,6 @@ ATTR_ACCESSOR(Pixel, cyan)
1039
1052
  ATTR_ACCESSOR(Pixel, magenta)
1040
1053
  ATTR_ACCESSOR(Pixel, yellow)
1041
1054
  ATTR_ACCESSOR(Pixel, black)
1042
- extern void destroy_Pixel(Pixel *);
1043
1055
  extern VALUE Pixel_alloc(VALUE);
1044
1056
  extern VALUE Pixel_case_eq(VALUE, VALUE);
1045
1057
  extern VALUE Pixel_clone(VALUE);
@@ -0,0 +1,224 @@
1
+ #ifndef _RMAGICK_GVL_H_
2
+ #define _RMAGICK_GVL_H_
3
+
4
+ #include "ruby/thread.h"
5
+
6
+ typedef void *(gvl_function_t)(void *);
7
+
8
+ #define GVL_FUNC(name) name##_gvl
9
+ #define GVL_STRUCT_TYPE(name) name##_args_t
10
+ #define CALL_FUNC_WITHOUT_GVL(fp, args) \
11
+ rb_thread_call_without_gvl(fp, args, RUBY_UBF_PROCESS, NULL)
12
+
13
+
14
+ #define DEFINE_GVL_STRUCT1(name, type1) \
15
+ typedef struct { \
16
+ type1 arg1; \
17
+ } GVL_STRUCT_TYPE(name)
18
+ #define DEFINE_GVL_FUNC1(func_name, struct_name) \
19
+ static void *func_name##_gvl(void *p) \
20
+ { \
21
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
22
+ return (void *)func_name(args->arg1); \
23
+ }
24
+
25
+ #define DEFINE_GVL_STUB1(name, type1) \
26
+ DEFINE_GVL_STRUCT1(name, type1); \
27
+ DEFINE_GVL_FUNC1(name, name)
28
+
29
+
30
+ #define DEFINE_GVL_STRUCT2(name, type1, type2) \
31
+ typedef struct { \
32
+ type1 arg1; \
33
+ type2 arg2; \
34
+ } GVL_STRUCT_TYPE(name)
35
+ #define DEFINE_GVL_FUNC2(func_name, struct_name) \
36
+ static void *func_name##_gvl(void *p) \
37
+ { \
38
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
39
+ return (void *)func_name(args->arg1, args->arg2); \
40
+ }
41
+
42
+ #define DEFINE_GVL_STUB2(name, type1, type2) \
43
+ DEFINE_GVL_STRUCT2(name, type1, type2); \
44
+ DEFINE_GVL_FUNC2(name, name)
45
+
46
+
47
+ #define DEFINE_GVL_STRUCT3(name, type1, type2, type3) \
48
+ typedef struct { \
49
+ type1 arg1; \
50
+ type2 arg2; \
51
+ type3 arg3; \
52
+ } GVL_STRUCT_TYPE(name)
53
+ #define DEFINE_GVL_FUNC3(func_name, struct_name) \
54
+ static void *func_name##_gvl(void *p) \
55
+ { \
56
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
57
+ return (void *)func_name(args->arg1, args->arg2, args->arg3); \
58
+ }
59
+
60
+ #define DEFINE_GVL_STUB3(name, type1, type2, type3) \
61
+ DEFINE_GVL_STRUCT3(name, type1, type2, type3); \
62
+ DEFINE_GVL_FUNC3(name, name)
63
+
64
+
65
+ #define DEFINE_GVL_STRUCT4(name, type1, type2, type3, type4) \
66
+ typedef struct { \
67
+ type1 arg1; \
68
+ type2 arg2; \
69
+ type3 arg3; \
70
+ type4 arg4; \
71
+ } GVL_STRUCT_TYPE(name)
72
+ #define DEFINE_GVL_FUNC4(func_name, struct_name) \
73
+ static void *func_name##_gvl(void *p) \
74
+ { \
75
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
76
+ return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4); \
77
+ }
78
+
79
+ #define DEFINE_GVL_STUB4(name, type1, type2, type3, type4) \
80
+ DEFINE_GVL_STRUCT4(name, type1, type2, type3, type4); \
81
+ DEFINE_GVL_FUNC4(name, name)
82
+
83
+
84
+ #define DEFINE_GVL_STRUCT5(name, type1, type2, type3, type4, type5) \
85
+ typedef struct { \
86
+ type1 arg1; \
87
+ type2 arg2; \
88
+ type3 arg3; \
89
+ type4 arg4; \
90
+ type5 arg5; \
91
+ } GVL_STRUCT_TYPE(name)
92
+ #define DEFINE_GVL_FUNC5(func_name, struct_name) \
93
+ static void *func_name##_gvl(void *p) \
94
+ { \
95
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
96
+ return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5); \
97
+ }
98
+ #define DEFINE_GVL_STUB5(name, type1, type2, type3, type4, type5) \
99
+ DEFINE_GVL_STRUCT5(name, type1, type2, type3, type4, type5); \
100
+ DEFINE_GVL_FUNC5(name, name)
101
+
102
+
103
+ #define DEFINE_GVL_STRUCT6(name, type1, type2, type3, type4, type5, type6) \
104
+ typedef struct { \
105
+ type1 arg1; \
106
+ type2 arg2; \
107
+ type3 arg3; \
108
+ type4 arg4; \
109
+ type5 arg5; \
110
+ type6 arg6; \
111
+ } GVL_STRUCT_TYPE(name)
112
+ #define DEFINE_GVL_FUNC6(func_name, struct_name) \
113
+ static void *func_name##_gvl(void *p) \
114
+ { \
115
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
116
+ return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6); \
117
+ }
118
+ #define DEFINE_GVL_STUB6(name, type1, type2, type3, type4, type5, type6) \
119
+ DEFINE_GVL_STRUCT6(name, type1, type2, type3, type4, type5, type6); \
120
+ DEFINE_GVL_FUNC6(name, name)
121
+
122
+
123
+ #define DEFINE_GVL_STRUCT7(name, type1, type2, type3, type4, type5, type6, type7) \
124
+ typedef struct { \
125
+ type1 arg1; \
126
+ type2 arg2; \
127
+ type3 arg3; \
128
+ type4 arg4; \
129
+ type5 arg5; \
130
+ type6 arg6; \
131
+ type7 arg7; \
132
+ } GVL_STRUCT_TYPE(name)
133
+ #define DEFINE_GVL_FUNC7(func_name, struct_name) \
134
+ static void *func_name##_gvl(void *p) \
135
+ { \
136
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
137
+ return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6, args->arg7); \
138
+ }
139
+ #define DEFINE_GVL_STUB7(name, type1, type2, type3, type4, type5, type6, type7) \
140
+ DEFINE_GVL_STRUCT7(name, type1, type2, type3, type4, type5, type6, type7); \
141
+ DEFINE_GVL_FUNC7(name, name)
142
+
143
+
144
+ #define DEFINE_GVL_STRUCT8(name, type1, type2, type3, type4, type5, type6, type7, type8) \
145
+ typedef struct { \
146
+ type1 arg1; \
147
+ type2 arg2; \
148
+ type3 arg3; \
149
+ type4 arg4; \
150
+ type5 arg5; \
151
+ type6 arg6; \
152
+ type7 arg7; \
153
+ type8 arg8; \
154
+ } GVL_STRUCT_TYPE(name)
155
+ #define DEFINE_GVL_FUNC8(func_name, struct_name) \
156
+ static void *func_name##_gvl(void *p) \
157
+ { \
158
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
159
+ return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6, args->arg7, args->arg8); \
160
+ }
161
+ #define DEFINE_GVL_STUB8(name, type1, type2, type3, type4, type5, type6, type7, type8) \
162
+ DEFINE_GVL_STRUCT8(name, type1, type2, type3, type4, type5, type6, type7, type8); \
163
+ DEFINE_GVL_FUNC8(name, name)
164
+
165
+
166
+ #define DEFINE_GVL_STRUCT9(name, type1, type2, type3, type4, type5, type6, type7, type8, type9) \
167
+ typedef struct { \
168
+ type1 arg1; \
169
+ type2 arg2; \
170
+ type3 arg3; \
171
+ type4 arg4; \
172
+ type5 arg5; \
173
+ type6 arg6; \
174
+ type7 arg7; \
175
+ type8 arg8; \
176
+ type9 arg9; \
177
+ } GVL_STRUCT_TYPE(name)
178
+ #define DEFINE_GVL_FUNC9(func_name, struct_name) \
179
+ static void *func_name##_gvl(void *p) \
180
+ { \
181
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
182
+ return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6, args->arg7, args->arg8, args->arg9); \
183
+ }
184
+ #define DEFINE_GVL_STUB9(name, type1, type2, type3, type4, type5, type6, type7, type8, type9) \
185
+ DEFINE_GVL_STRUCT9(name, type1, type2, type3, type4, type5, type6, type7, type8, type9); \
186
+ DEFINE_GVL_FUNC9(name, name)
187
+
188
+
189
+ #define DEFINE_GVL_VOID_FUNC2(func_name, struct_name) \
190
+ static void *func_name##_gvl(void *p) \
191
+ { \
192
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
193
+ func_name(args->arg1, args->arg2); \
194
+ return NULL; \
195
+ }
196
+ #define DEFINE_GVL_VOID_STUB2(name, type1, type2) \
197
+ DEFINE_GVL_STRUCT2(name, type1, type2); \
198
+ DEFINE_GVL_VOID_FUNC2(name, name)
199
+
200
+
201
+ #define DEFINE_GVL_VOID_FUNC3(func_name, struct_name) \
202
+ static void *func_name##_gvl(void *p) \
203
+ { \
204
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
205
+ func_name(args->arg1, args->arg2, args->arg3); \
206
+ return NULL; \
207
+ }
208
+ #define DEFINE_GVL_VOID_STUB3(name, type1, type2, type3) \
209
+ DEFINE_GVL_STRUCT3(name, type1, type2, type3); \
210
+ DEFINE_GVL_VOID_FUNC3(name, name)
211
+
212
+
213
+ #define DEFINE_GVL_VOID_FUNC6(func_name, struct_name) \
214
+ static void *func_name##_gvl(void *p) \
215
+ { \
216
+ GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
217
+ func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6); \
218
+ return NULL; \
219
+ }
220
+ #define DEFINE_GVL_VOID_STUB6(name, type1, type2, type3, type4, type5, type6) \
221
+ DEFINE_GVL_STRUCT6(name, type1, type2, type3, type4, type5, type6); \
222
+ DEFINE_GVL_VOID_FUNC6(name, name)
223
+
224
+ #endif