diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-07-22 17:50:01 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-07-22 17:50:01 +0900 |
| commit | 0e9bd248271b9f3d8de42e0fbc932c3148d91787 (patch) | |
| tree | 8d763cab6e038260ba261fbfc2014509dc00f4dd | |
| parent | b920270508f22b219cdcd20a374dfaf9cc8cc123 (diff) | |
| download | mruby-0e9bd248271b9f3d8de42e0fbc932c3148d91787.tar.gz mruby-0e9bd248271b9f3d8de42e0fbc932c3148d91787.zip | |
Fix `puts` to print newline with empty strings; ref b184772
| -rw-r--r-- | mrbgems/mruby-print/src/print.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c index 1ee2e63aa..851aee25e 100644 --- a/mrbgems/mruby-print/src/print.c +++ b/mrbgems/mruby-print/src/print.c @@ -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); } } |
