ruby-changes:53987
From: nobu <ko1@a...>
Date: Wed, 5 Dec 2018 10:11:39 +0900 (JST)
Subject: [ruby-changes:53987] nobu:r66207 (trunk): Build error method name at failure
nobu 2018-12-05 10:11:32 +0900 (Wed, 05 Dec 2018) New Revision: 66207 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66207 Log: Build error method name at failure So `struct nmin_data` size is reduced. Modified files: trunk/enum.c Index: enum.c =================================================================== --- enum.c (revision 66206) +++ enum.c (revision 66207) @@ -1329,16 +1329,17 @@ struct nmin_data { https://github.com/ruby/ruby/blob/trunk/enum.c#L1329 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 https://github.com/ruby/ruby/blob/trunk/enum.c#L1504 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++) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/