From 412c5a96be804d33b322ffe6f55283b85c94b67e Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 11 Jul 2012 03:25:26 +0000 Subject: * vm_eval.c (rb_eval_string_from_file, rb_eval_string_from_file_protect): new functions to replace rb_compile_main_from_string() and ruby_eval_main(). * nacl/pepper_ruby.c: Follows the change in vm_eval.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- nacl/pepper_main.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'nacl/pepper_main.c') diff --git a/nacl/pepper_main.c b/nacl/pepper_main.c index dc7b58ce69..25087e995a 100644 --- a/nacl/pepper_main.c +++ b/nacl/pepper_main.c @@ -374,7 +374,7 @@ init_libraries(void* data) volatile VALUE err = rb_errinfo(); err = rb_obj_as_string(err); } else { - instance->async_call_args = "rubyReady"; + instance->async_call_args = (void*)"rubyReady"; core_interface->CallOnMainThread( 0, PP_MakeCompletionCallback(pruby_post_cstr, instance), 0); } @@ -419,11 +419,10 @@ pruby_init(void) static void* pruby_eval(void* data) { + extern VALUE ruby_eval_string_from_file_protect(const char* src, const char* path, int* state); struct PepperInstance* const instance = (struct PepperInstance*)data; - volatile VALUE path; volatile VALUE src = (VALUE)instance->async_call_args; volatile VALUE result = Qnil; - ruby_opaque_t prog; volatile int state; RUBY_INIT_STACK; @@ -432,13 +431,8 @@ pruby_eval(void* data) perror("pepper-ruby:pthread_mutex_lock"); return 0; } - - path = rb_usascii_str_new_cstr("(pepper-ruby)"); - prog = ruby_compile_main_from_string(path, src, (VALUE*)&result); - if (prog) { - state = ruby_eval_main(prog, (VALUE*)&result); - } - + result = ruby_eval_string_from_file_protect( + RSTRING_PTR(src), "(pepper-ruby)", &state); pthread_mutex_unlock(&instance->mutex); if (!state) { -- cgit v1.2.3