Unverified Commit 8eddcbf5 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4244 from shuujii/remove-redundant-null-check-for-mrb_malloc

Remove redundant `NULL` check for `mrb_malloc`
parents 5956f5b4 a4c5fcc0
...@@ -23,7 +23,6 @@ printstr(mrb_state *mrb, mrb_value obj) ...@@ -23,7 +23,6 @@ printstr(mrb_state *mrb, mrb_value obj)
char* utf8 = RSTRING_PTR(obj); char* utf8 = RSTRING_PTR(obj);
int wlen = MultiByteToWideChar(CP_UTF8, 0, utf8, mlen, NULL, 0); int wlen = MultiByteToWideChar(CP_UTF8, 0, utf8, mlen, NULL, 0);
wchar_t* utf16 = (wchar_t*)mrb_malloc(mrb, (wlen+1) * sizeof(wchar_t)); 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) { if (MultiByteToWideChar(CP_UTF8, 0, utf8, mlen, utf16, wlen) > 0) {
utf16[wlen] = 0; utf16[wlen] = 0;
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),
......
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