summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/src
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-08-05 12:41:15 +0900
committerKOBAYASHI Shuji <[email protected]>2019-08-05 13:18:50 +0900
commit334afb167c0a1fa478a53c3844f37c0f1fd866dd (patch)
treecf67a9759a8608edbe1cad3146c155852445bc1d /mrbgems/mruby-string-ext/src
parent0e2e8b79d327da9b2ba0ce42e02cf6653c3e3fae (diff)
downloadmruby-334afb167c0a1fa478a53c3844f37c0f1fd866dd.tar.gz
mruby-334afb167c0a1fa478a53c3844f37c0f1fd866dd.zip
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.
Diffstat (limited to 'mrbgems/mruby-string-ext/src')
-rw-r--r--mrbgems/mruby-string-ext/src/string.c11
1 files changed, 5 insertions, 6 deletions
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();