From 334afb167c0a1fa478a53c3844f37c0f1fd866dd Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Mon, 5 Aug 2019 12:41:15 +0900 Subject: Use new specifiers/modifiers of `mrb_vfromat()` The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back. --- mrbgems/mruby-string-ext/src/string.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mrbgems/mruby-string-ext/src/string.c') diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c index 80b277444..a946140dd 100644 --- a/mrbgems/mruby-string-ext/src/string.c +++ b/mrbgems/mruby-string-ext/src/string.c @@ -40,7 +40,7 @@ int_chr_binary(mrb_state *mrb, mrb_value num) mrb_value str; if (cp < 0 || 0xff < cp) { - mrb_raisef(mrb, E_RANGE_ERROR, "%S out of char range", num); + mrb_raisef(mrb, E_RANGE_ERROR, "%v out of char range", num); } c = (char)cp; str = mrb_str_new(mrb, &c, 1); @@ -59,7 +59,7 @@ int_chr_utf8(mrb_state *mrb, mrb_value num) uint32_t ascii_flag = 0; if (cp < 0 || 0x10FFFF < cp) { - mrb_raisef(mrb, E_RANGE_ERROR, "%S out of char range", num); + mrb_raisef(mrb, E_RANGE_ERROR, "%v out of char range", num); } if (cp < 0x80) { utf8[0] = (char)cp; @@ -114,7 +114,7 @@ mrb_str_setbyte(mrb_state *mrb, mrb_value str) len = RSTRING_LEN(str); if (pos < -len || len <= pos) - mrb_raisef(mrb, E_INDEX_ERROR, "index %S out of string", mrb_fixnum_value(pos)); + mrb_raisef(mrb, E_INDEX_ERROR, "index %i out of string", pos); if (pos < 0) pos += len; @@ -583,8 +583,7 @@ str_tr(mrb_state *mrb, mrb_value str, mrb_value p1, mrb_value p2, mrb_bool squee continue; } if (c > 0x80) { - mrb_raisef(mrb, E_ARGUMENT_ERROR, "character (%S) out of range", - mrb_fixnum_value((mrb_int)c)); + mrb_raisef(mrb, E_ARGUMENT_ERROR, "character (%i) out of range", c); } lastch = c; s[i] = (char)c; @@ -956,7 +955,7 @@ mrb_int_chr(mrb_state *mrb, mrb_value num) } #endif else { - mrb_raisef(mrb, E_ARGUMENT_ERROR, "unknown encoding name - %S", enc); + mrb_raisef(mrb, E_ARGUMENT_ERROR, "unknown encoding name - %v", enc); } /* not reached */ return mrb_nil_value(); -- cgit v1.2.3