isomorfeus-iodine 0.7.45 → 0.7.46

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@
10
10
  static pthread_key_t iodine_GVL_state_key;
11
11
  static pthread_once_t iodine_GVL_state_once = PTHREAD_ONCE_INIT;
12
12
  static void init_iodine_GVL_state_key(void) {
13
- pthread_key_create(&iodine_GVL_state_key, NULL);
13
+ pthread_key_create(&iodine_GVL_state_key, NULL);
14
14
  }
15
15
  static void init_iodine_GVL_state_init(void) {
16
16
  uint8_t *gvl = malloc(sizeof(uint8_t));
@@ -31,7 +31,7 @@ typedef struct {
31
31
  ID method;
32
32
  int exception;
33
33
  VALUE (*protected_task)(VALUE tsk_);
34
- VALUE (*each_func)(VALUE block_arg, VALUE data, int argc, VALUE *argv);
34
+ rb_block_call_func_t each_func;
35
35
  VALUE each_udata;
36
36
  } iodine_rb_task_s;
37
37
 
@@ -158,9 +158,7 @@ static VALUE iodine_call2(VALUE obj, ID method, int argc, VALUE *argv) {
158
158
 
159
159
  /** Calls a Ruby method on a given object, protecting against exceptions. */
160
160
  static VALUE iodine_call_block(VALUE obj, ID method, int argc, VALUE *argv,
161
- VALUE udata,
162
- VALUE(each_func)(VALUE block_arg, VALUE udata,
163
- int argc, VALUE *argv)) {
161
+ VALUE udata, rb_block_call_func_t each_func) {
164
162
  iodine_rb_task_s task = {
165
163
  .obj = obj,
166
164
  .argc = argc,
@@ -186,7 +184,7 @@ static uint8_t iodine_in_GVL(void) {
186
184
  }
187
185
 
188
186
  /** Forces the GVL state flag. */
189
- static void iodine_set_GVL(uint8_t state) {
187
+ static void iodine_set_GVL(uint8_t state) {
190
188
  pthread_once(&iodine_GVL_state_once, init_iodine_GVL_state_key);
191
189
  uint8_t *iodine_GVL_state = pthread_getspecific(iodine_GVL_state_key);
192
190
  if (!iodine_GVL_state) {
@@ -1,27 +1,26 @@
1
- #ifndef H_IODINE_CALLER_H
2
- #define H_IODINE_CALLER_H
3
-
4
- #include "ruby.h"
5
-
6
- #include <stdint.h>
7
-
8
- extern struct IodineCaller_s {
9
- /** Calls a C function within the GVL (unprotected). */
10
- void *(*enterGVL)(void *(*func)(void *), void *arg);
11
- /** Calls a C function outside the GVL (no Ruby API calls allowed). */
12
- void *(*leaveGVL)(void *(*func)(void *), void *arg);
13
- /** Calls a Ruby method on a given object, protecting against exceptions. */
14
- VALUE (*call)(VALUE obj, ID method);
15
- /** Calls a Ruby method on a given object, protecting against exceptions. */
16
- VALUE (*call2)(VALUE obj, ID method, int argc, VALUE *argv);
17
- /** Calls a Ruby method on a given object, protecting against exceptions. */
18
- VALUE(*call_with_block)
19
- (VALUE obj, ID method, int argc, VALUE *argv, VALUE udata,
20
- VALUE (*block_func)(VALUE block_argv1, VALUE udata, int argc, VALUE *argv));
21
- /** Returns the GVL state flag. */
22
- uint8_t (*in_GVL)(void);
23
- /** Forces the GVL state flag. */
24
- void (*set_GVL)(uint8_t state);
25
- } IodineCaller;
26
-
27
- #endif
1
+ #ifndef H_IODINE_CALLER_H
2
+ #define H_IODINE_CALLER_H
3
+
4
+ #include "ruby.h"
5
+
6
+ #include <stdint.h>
7
+
8
+ extern struct IodineCaller_s {
9
+ /** Calls a C function within the GVL (unprotected). */
10
+ void *(*enterGVL)(void *(*func)(void *), void *arg);
11
+ /** Calls a C function outside the GVL (no Ruby API calls allowed). */
12
+ void *(*leaveGVL)(void *(*func)(void *), void *arg);
13
+ /** Calls a Ruby method on a given object, protecting against exceptions. */
14
+ VALUE (*call)(VALUE obj, ID method);
15
+ /** Calls a Ruby method on a given object, protecting against exceptions. */
16
+ VALUE (*call2)(VALUE obj, ID method, int argc, VALUE *argv);
17
+ /** Calls a Ruby method on a given object, protecting against exceptions. */
18
+ VALUE(*call_with_block)
19
+ (VALUE obj, ID method, int argc, VALUE *argv, VALUE udata, rb_block_call_func_t block_func);
20
+ /** Returns the GVL state flag. */
21
+ uint8_t (*in_GVL)(void);
22
+ /** Forces the GVL state flag. */
23
+ void (*set_GVL)(uint8_t state);
24
+ } IodineCaller;
25
+
26
+ #endif
@@ -900,7 +900,7 @@ void iodine_connection_init(void) {
900
900
  IodineStore.add(RAWSymbol);
901
901
 
902
902
  // define the Connection Class and it's methods
903
- ConnectionKlass = rb_define_class_under(IodineModule, "Connection", rb_cData);
903
+ ConnectionKlass = rb_define_class_under(IodineModule, "Connection", rb_cObject);
904
904
  rb_define_alloc_func(ConnectionKlass, iodine_connection_data_alloc_c);
905
905
  rb_define_method(ConnectionKlass, "write", iodine_connection_write, 1);
906
906
  rb_define_method(ConnectionKlass, "close", iodine_connection_close, 0);
@@ -520,7 +520,7 @@ static int for_each_header_data(VALUE key, VALUE val, VALUE h_) {
520
520
 
521
521
  // writes the body to the response object
522
522
  static VALUE for_each_body_string(VALUE str, VALUE body_, int argc,
523
- VALUE *argv) {
523
+ const VALUE *argv, VALUE unused) {
524
524
  // fprintf(stderr, "For_each - body\n");
525
525
  // write body
526
526
  if (TYPE(str) != T_STRING) {
@@ -533,6 +533,7 @@ static VALUE for_each_body_string(VALUE str, VALUE body_, int argc,
533
533
  return Qtrue;
534
534
  (void)argc;
535
535
  (void)argv;
536
+ (void)unused;
536
537
  }
537
538
 
538
539
  static inline int ruby2c_response_send(iodine_http_request_handle_s *handle,
@@ -558,7 +558,7 @@ void iodine_init_mustache(void) {
558
558
  rb_global_variable(&filename_id);
559
559
  rb_global_variable(&data_id);
560
560
  rb_global_variable(&template_id);
561
- VALUE tmp = rb_define_class_under(IodineModule, "Mustache", rb_cData);
561
+ VALUE tmp = rb_define_class_under(IodineModule, "Mustache", rb_cObject);
562
562
  rb_define_alloc_func(tmp, iodine_mustache_data_alloc_c);
563
563
  rb_define_method(tmp, "initialize", iodine_mustache_new, -1);
564
564
  rb_define_method(tmp, "render", iodine_mustache_render, 1);