From fe77272c25f3b6d91506a51d0621275074542890 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 18 Aug 2018 22:40:44 +0900 Subject: `Kernel#p` should return an array of arguments; fix #4083 Although the return value is not defined in ISO, it is better to behave as CRuby does. --- mrbgems/mruby-print/mrblib/print.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mrbgems/mruby-print') diff --git a/mrbgems/mruby-print/mrblib/print.rb b/mrbgems/mruby-print/mrblib/print.rb index 38a10661b..fa83c47de 100644 --- a/mrbgems/mruby-print/mrblib/print.rb +++ b/mrbgems/mruby-print/mrblib/print.rb @@ -45,7 +45,7 @@ module Kernel __printstr__ "\n" i += 1 end - args[0] + args.__svalue end unless Kernel.respond_to?(:sprintf) -- cgit v1.2.3 From 1d6679e9d13078b279b81a1241e632540672524c Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Thu, 24 Jan 2019 20:44:55 +0900 Subject: Remove definition of `Kernel#sprintf` in `mruby-print` --- mrbgems/mruby-print/mrblib/print.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'mrbgems/mruby-print') diff --git a/mrbgems/mruby-print/mrblib/print.rb b/mrbgems/mruby-print/mrblib/print.rb index fa83c47de..27567d858 100644 --- a/mrbgems/mruby-print/mrblib/print.rb +++ b/mrbgems/mruby-print/mrblib/print.rb @@ -52,9 +52,6 @@ module Kernel def printf(*args) raise NotImplementedError.new('printf not available') end - def sprintf(*args) - raise NotImplementedError.new('sprintf not available') - end else def printf(*args) __printstr__(sprintf(*args)) -- cgit v1.2.3 From a4c5fcc0388c80f72f004ff719c7580a98e1e516 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Thu, 24 Jan 2019 20:53:40 +0900 Subject: Remove redundant `NULL` check for `mrb_malloc` --- mrbgems/mruby-print/src/print.c | 1 - 1 file changed, 1 deletion(-) (limited to 'mrbgems/mruby-print') diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c index e181b06e0..f7f99fc77 100644 --- a/mrbgems/mruby-print/src/print.c +++ b/mrbgems/mruby-print/src/print.c @@ -23,7 +23,6 @@ printstr(mrb_state *mrb, mrb_value obj) char* utf8 = RSTRING_PTR(obj); int wlen = MultiByteToWideChar(CP_UTF8, 0, utf8, mlen, NULL, 0); wchar_t* utf16 = (wchar_t*)mrb_malloc(mrb, (wlen+1) * sizeof(wchar_t)); - if (utf16 == NULL) return; if (MultiByteToWideChar(CP_UTF8, 0, utf8, mlen, utf16, wlen) > 0) { utf16[wlen] = 0; WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), -- cgit v1.2.3