diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-11 03:25:26 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-11 03:25:26 +0000 |
commit | 412c5a96be804d33b322ffe6f55283b85c94b67e (patch) | |
tree | b036f4a05ec235272ef8c668a445104a53bf85c3 /nacl | |
parent | 64ef091a64d61dc0cef4508b70e64f91e4db865d (diff) |
* 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
Diffstat (limited to 'nacl')
-rw-r--r-- | nacl/pepper_main.c | 14 |
1 files changed, 4 insertions, 10 deletions
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) { |