* eval.c (method_eq): new method Method#==. [new]

* gc.c (STR_NO_ORIG): STR_NO_ORIG value was different between
  string.c and gc.c

* eval.c (rb_eval): should convert *non-array at the end of
  arguments by using Array().

* hash.c (ruby_setenv): readline library leaves their environment
  strings uncopied.  "free" check revised.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-06-12 05:31:47 +00:00
Родитель 83b2db9ea7
Коммит 39fb2a27ab
5 изменённых файлов: 54 добавлений и 9 удалений

Просмотреть файл

@ -3,10 +3,29 @@ Tue Jun 12 14:21:28 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* lib/mkmf.rb: target_prefix is only for installation, not for
build.
Tue Jun 12 00:41:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (method_eq): new method Method#==. [new]
Mon Jun 11 14:29:41 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* confgure.in: add RUBY_CANONICAL_BUILD.
Sun Jun 10 17:31:47 2001 Guy Decoux <decoux@moulon.inra.fr>
* gc.c (STR_NO_ORIG): STR_NO_ORIG value was different between
string.c and gc.c
Sat Jun 9 22:10:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_eval): should convert *non-array at the end of
arguments by using Array().
Sat Jun 9 17:04:30 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* hash.c (ruby_setenv): readline library leaves their environment
strings uncopied. "free" check revised.
Sat Jun 9 16:31:03 2001 Usaku Nakamura <usa@osb.att.ne.jp>
* ext/extmk.rb.in: Use -F and -T for mswin32 because cl.exe doesn't

30
eval.c
Просмотреть файл

@ -2520,7 +2520,7 @@ rb_eval(self, n)
case NODE_ARGSCAT:
result = rb_ary_concat(rb_eval(self, node->nd_head),
rb_eval(self, node->nd_body));
rb_Array(rb_eval(self, node->nd_body)));
break;
case NODE_ARGSPUSH:
@ -6598,6 +6598,27 @@ mnew(klass, obj, id, mklass)
return method;
}
static VALUE
method_eq(method, other)
VALUE method, other;
{
struct METHOD *m1, *m2;
if (TYPE(other) != T_DATA || RDATA(other)->dmark != (RUBY_DATA_FUNC)bm_mark)
return Qfalse;
if (CLASS_OF(method) != CLASS_OF(other))
return Qfalse;
Data_Get_Struct(method, struct METHOD, m1);
Data_Get_Struct(other, struct METHOD, m2);
if (m1->klass != m2->klass || m1->oklass != m2->oklass ||
m1->recv != m2->recv || m1->body != m2->body)
return Qfalse;
return Qtrue;
}
static VALUE
method_unbind(obj)
VALUE obj;
@ -6608,7 +6629,7 @@ method_unbind(obj)
Data_Get_Struct(obj, struct METHOD, orig);
method = Data_Make_Struct(rb_cUnboundMethod, struct METHOD, bm_mark, free, data);
data->klass = orig->klass;
data->recv = obj;
data->recv = 0;
data->id = orig->id;
data->body = orig->body;
data->oklass = orig->oklass;
@ -6649,7 +6670,7 @@ method_clone(self)
struct METHOD *orig, *data;
Data_Get_Struct(self, struct METHOD, orig);
clone = Data_Make_Struct(CLASS_OF(self),struct METHOD,bm_mark,free,data);
clone = Data_Make_Struct(CLASS_OF(self),struct METHOD, bm_mark, free, data);
CLONESETUP(clone, self);
*data = *orig;
@ -6709,7 +6730,7 @@ umethod_bind(method, recv)
rb_raise(rb_eTypeError, "method `%s' overridden", rb_id2name(data->oid));
}
if (!rb_obj_is_instance_of(recv, data->oklass)) {
rb_raise(rb_eTypeError, "first argument must be an instance of %s",
rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
rb_class2name(data->oklass));
}
}
@ -6891,6 +6912,7 @@ Init_Proc()
rb_cMethod = rb_define_class("Method", rb_cObject);
rb_undef_method(CLASS_OF(rb_cMethod), "new");
rb_define_method(rb_cMethod, "==", method_eq, 1);
rb_define_method(rb_cMethod, "clone", method_clone, 0);
rb_define_method(rb_cMethod, "call", method_call, -1);
rb_define_method(rb_cMethod, "[]", method_call, -1);

2
gc.c
Просмотреть файл

@ -785,7 +785,7 @@ obj_free(obj)
}
break;
case T_STRING:
#define STR_NO_ORIG FL_USER0 /* copied from string.c */
#define STR_NO_ORIG FL_USER2 /* copied from string.c */
if (!RANY(obj)->as.string.orig || FL_TEST(obj, STR_NO_ORIG)) {
RUBY_CRITICAL(free(RANY(obj)->as.string.ptr));
}

8
hash.c
Просмотреть файл

@ -1066,8 +1066,12 @@ ruby_setenv(name, value)
environ = tmpenv; /* tell exec where it is now */
}
if (!value) {
if (environ[i] != origenviron[i])
free(environ[i]);
if (environ != origenviron) {
char **envp = origenviron;
while (*envp && *envp != environ[i]) envp++;
if (!*envp)
free(environ[i]);
}
while (environ[i]) {
environ[i] = environ[i+1];
i++;

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.1"
#define RUBY_RELEASE_DATE "2001-06-07"
#define RUBY_RELEASE_DATE "2001-06-12"
#define RUBY_VERSION_CODE 171
#define RUBY_RELEASE_CODE 20010607
#define RUBY_RELEASE_CODE 20010612