Skip to content

Commit 8d3084c

Browse files
committed
Improve load method, still failing with nginx.
1 parent 43734b2 commit 8d3084c

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

source/loaders/rb_loader/source/rb_loader_impl.c

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ typedef struct loader_impl_rb_function_type
5858

5959
} * loader_impl_rb_function;
6060

61-
typedef struct loader_impl_rb_protect_type
62-
{
63-
VALUE obj;
64-
ID method_id;
65-
size_t args_size;
66-
VALUE args[LOADER_IMPL_RB_PROTECT_ARGS_SIZE];
67-
68-
} * loader_impl_rb_protect;
69-
7061
int function_rb_interface_create(function func, function_impl impl)
7162
{
7263
signature s = function_signature(func);
@@ -524,34 +515,21 @@ VALUE rb_loader_impl_load_data(loader_impl impl, const loader_naming_path path)
524515
return Qnil;
525516
}
526517

527-
VALUE rb_loader_impl_module_eval_callback(VALUE rdata)
528-
{
529-
/* TODO: Too tricky */
530-
loader_impl_rb_protect data = (loader_impl_rb_protect)rdata;
531-
532-
return rb_funcall2(data->obj, data->method_id, data->args_size, data->args);
533-
}
534-
535518
VALUE rb_loader_impl_module_eval(VALUE module, VALUE module_data)
536519
{
537-
int error = 0;
538-
539-
struct loader_impl_rb_protect_type data;
540-
520+
const int argc = 1;
541521
VALUE result;
522+
VALUE args[argc];
542523

543-
data.obj = module;
544-
data.method_id = rb_intern("module_eval");
545-
data.args_size = 1;
546-
data.args[0] = module_data;
524+
args[0] = module_data;
547525

548-
result = rb_protect(rb_loader_impl_module_eval_callback, (VALUE)(&data), &error);
526+
result = rb_mod_module_eval(1, args, module);
549527

550-
if (error != 0)
528+
if (result == Qnil)
551529
{
552530
VALUE exception;
553531

554-
log_write("metacall", LOG_LEVEL_ERROR, "Ruby module evaluation failed (status: %d)", error);
532+
log_write("metacall", LOG_LEVEL_ERROR, "Ruby module evaluation failed");
555533

556534
exception = rb_gv_get("$!");
557535

0 commit comments

Comments
 (0)