summaryrefslogtreecommitdiffhomepage
path: root/src/print.c
diff options
context:
space:
mode:
authorcremno <[email protected]>2015-06-13 14:59:57 +0200
committercremno <[email protected]>2015-06-13 14:59:57 +0200
commit5e8d2a4b841d59ceab9f6fcf3ae294d93b8332b5 (patch)
tree9cd23a021e266aaeb478899951384784d1540e2d /src/print.c
parentd2433a7723e958e33b07d7abe583215756bd8840 (diff)
downloadmruby-5e8d2a4b841d59ceab9f6fcf3ae294d93b8332b5.tar.gz
mruby-5e8d2a4b841d59ceab9f6fcf3ae294d93b8332b5.zip
refactor code to call mrb_inspect() instead
mrb_inspect() also calls mrb_obj_as_string() after #inspect to ensure the mrb_value is a string.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/print.c b/src/print.c
index b43936b13..c7c1ccd39 100644
--- a/src/print.c
+++ b/src/print.c
@@ -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