mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix puts to print newline with empty strings; ref b184772
This commit is contained in:
@@ -76,7 +76,7 @@ mrb_puts(mrb_state *mrb, mrb_value self)
|
||||
mrb_value s = mrb_str_to_str(mrb, argv[i]);
|
||||
mrb_int len = RSTRING_LEN(s);
|
||||
printstr(mrb, RSTRING_PTR(s), len);
|
||||
if (len > 0 && RSTRING_PTR(s)[len-1] != '\n') {
|
||||
if (len == 0 || RSTRING_PTR(s)[len-1] != '\n') {
|
||||
printstr(mrb, "\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user