mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #2833 from cremno/call-mrb_inspect
refactor code to call mrb_inspect() instead
This commit is contained in:
@@ -11,12 +11,8 @@
|
||||
static void
|
||||
p(mrb_state *mrb, mrb_value obj)
|
||||
{
|
||||
mrb_value val;
|
||||
mrb_value val = mrb_inspect(mrb, obj);
|
||||
|
||||
val = mrb_funcall(mrb, obj, "inspect", 0);
|
||||
if (!mrb_string_p(val)) {
|
||||
val = mrb_obj_as_string(mrb, obj);
|
||||
}
|
||||
fwrite(RSTRING_PTR(val), RSTRING_LEN(val), 1, stdout);
|
||||
putc('\n', stdout);
|
||||
}
|
||||
|
||||
+1
-5
@@ -27,12 +27,8 @@ MRB_API void
|
||||
mrb_p(mrb_state *mrb, mrb_value obj)
|
||||
{
|
||||
#ifdef ENABLE_STDIO
|
||||
mrb_value val;
|
||||
mrb_value val = mrb_inspect(mrb, obj);
|
||||
|
||||
val = mrb_funcall(mrb, obj, "inspect", 0);
|
||||
if (!mrb_string_p(val)) {
|
||||
val = mrb_obj_as_string(mrb, obj);
|
||||
}
|
||||
printstr(mrb, val);
|
||||
putc('\n', stdout);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user