Commit c9a4091b authored by Tomoyuki Sahara's avatar Tomoyuki Sahara

arguments can be shared strings.

parent 1f4bd9fd
...@@ -298,14 +298,16 @@ mrb_file_s_symlink(mrb_state *mrb, mrb_value klass) ...@@ -298,14 +298,16 @@ mrb_file_s_symlink(mrb_state *mrb, mrb_value klass)
#else #else
mrb_value from, to; mrb_value from, to;
const char *src, *dst; const char *src, *dst;
int ai = mrb_gc_arena_save(mrb);
mrb_get_args(mrb, "SS", &from, &to); mrb_get_args(mrb, "SS", &from, &to);
src = mrb_string_value_cstr(mrb, &from); src = mrb_str_to_cstr(mrb, from);
dst = mrb_string_value_cstr(mrb, &to); dst = mrb_str_to_cstr(mrb, to);
if (symlink(src, dst) < 0) { if (symlink(src, dst) < 0) {
mrb_sys_fail(mrb, mrb_str_to_cstr(mrb, mrb_format(mrb, "(%S, %S)", from, to))); mrb_sys_fail(mrb, mrb_str_to_cstr(mrb, mrb_format(mrb, "(%S, %S)", from, to)));
} }
mrb_gc_arena_restore(mrb, ai);
#endif #endif
return mrb_fixnum_value(0); return mrb_fixnum_value(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment