summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-05 01:11:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-05 01:11:32 +0000
commite7fad40cf268db5b025eb50398b7861492953b16 (patch)
tree5988a049d7fc9fda8412670889b1c05369459a57
parent36f05c80b6b05d90349807ad5c8d444e66051862 (diff)
Build error method name at failure
So `struct nmin_data` size is reduced. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--enum.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/enum.c b/enum.c
index 6df2c24..f446403 100644
--- a/enum.c
+++ b/enum.c
@@ -1329,16 +1329,17 @@ struct nmin_data {
VALUE buf;
VALUE limit;
int (*cmpfunc)(const void *, const void *, void *);
- int rev; /* max if 1 */
- int by; /* min_by if 1 */
- const char *method;
+ int rev: 1; /* max if 1 */
+ int by: 1; /* min_by if 1 */
};
static VALUE
cmpint_reenter_check(struct nmin_data *data, VALUE val)
{
if (RBASIC(data->buf)->klass) {
- rb_raise(rb_eRuntimeError, "%s reentered", data->method);
+ rb_raise(rb_eRuntimeError, "%s%s reentered",
+ data->rev ? "max" : "min",
+ data->by ? "_by" : "");
}
return val;
}
@@ -1503,8 +1504,6 @@ rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary)
nmin_cmp;
data.rev = rev;
data.by = by;
- data.method = rev ? (by ? "max_by" : "max")
- : (by ? "min_by" : "min");
if (ary) {
long i;
for (i = 0; i < RARRAY_LEN(obj); i++) {