Skip to content

Commit

Permalink
* array.c (rb_ary_become): should not free ptr if it's shared.
Browse files Browse the repository at this point in the history
* eval.c (rb_alias): prohibit making an alias named "allocate" if
  klass is a metaclass.

* string.c (rb_string_value_ptr): StringValuePtr() should never
  return NULL pointer.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Aug 29, 2002
1 parent 3bf9729 commit 40bc4f5
Show file tree
Hide file tree
Showing 14 changed files with 203 additions and 164 deletions.
14 changes: 13 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Thu Aug 29 00:55:55 2002 Nobuyoshi Nakada <[email protected]>
* marshal.c (r_object): yield loaded objects, not intermediates.
(ruby-bugs-ja:PR#296)

Thu Aug 29 00:06:54 2002 Yukihiro Matsumoto <[email protected]>

* array.c (rb_ary_become): should not free ptr if it's shared.

* eval.c (rb_alias): prohibit making an alias named "allocate" if
klass is a metaclass.

Wed Aug 28 23:59:15 2002 Michal Rokos <[email protected]>

* signal.c: remove #ifdef SIGINT for struct signals.
Expand All @@ -17,6 +24,11 @@ Wed Aug 28 23:34:32 2002 Nobuyoshi Nakada <[email protected]>

* io.c (appendline): data was lost when raw mode.

Wed Aug 28 22:57:34 2002 Yukihiro Matsumoto <[email protected]>

* string.c (rb_string_value_ptr): StringValuePtr() should never
return NULL pointer.

Wed Aug 28 19:12:46 2002 Nobuyoshi Nakada <[email protected]>

* ext/stringio/stringio.c (strio_initialize): RSTRING(mode)->ptr
Expand All @@ -34,7 +46,7 @@ Wed Aug 28 17:45:03 2002 Nobuyoshi Nakada <[email protected]>

Wed Aug 28 16:36:40 2002 WATANABE Hirofumi <[email protected]>

* configure.in (ar): don't check twice for ar.
* configure.in (ar): don't check ar twice.

Wed Aug 28 15:00:29 2002 Yukihiro Matsumoto <[email protected]>

Expand Down
5 changes: 3 additions & 2 deletions ToDo
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ Language Spec.
* .. or something like defadvice in Emacs.
* property - for methods, or for objects in general.
* "in" modifier, to annotate, or to encourage assertion.
* selector namespace - something like generic-flet in CLOS, to help RubyBehevior
* selector namespace - something like generic-flet in CLOS, to help RubyBehavior
* private instance variable (as in Python?) @_foo in class Foo => @_Foo_foo
* warn/error "bare word" method, like "foo", you should type "foo()"
* clarify evaluation order of operator argument (=~, .., ...)
* :symbol => value hash in the form of {symbol: value, ...} ??

Hacking Interpreter

Expand Down Expand Up @@ -115,7 +116,7 @@ Extension Libraries

Ruby Libraries

* add uri.rb
- add uri.rb
* urllib.rb, nttplib.rb, etc.
* format like perl's

Expand Down
3 changes: 2 additions & 1 deletion array.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ rb_ary_become(copy, orig)
{
orig = to_ary(orig);
ary_make_shared(orig);
if (RARRAY(copy)->ptr) free(RARRAY(copy)->ptr);
if (RARRAY(copy)->ptr && !FL_TEST(copy, ELTS_SHARED))
free(RARRAY(copy)->ptr);
RARRAY(copy)->ptr = RARRAY(orig)->ptr;
RARRAY(copy)->len = RARRAY(orig)->len;
RARRAY(copy)->aux.shared = RARRAY(orig)->aux.shared;
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ case "$target_os" in
CFLAGS="$CFLAGS -pipe -no-precomp"
;;
darwin*)
CFLAGS="$CFLAGS -pipe -no-precomp"
CFLAGS="$CFLAGS -pipe"
;;
os2_emx)
CFLAGS="$CFLAGS -DOS2"
Expand Down
12 changes: 9 additions & 3 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,7 @@ rb_alias(klass, name, def)
{
VALUE origin;
NODE *orig, *body;
VALUE singleton = 0;

rb_frozen_class_p(klass);
if (name == def) return;
Expand All @@ -1715,6 +1716,12 @@ rb_alias(klass, name, def)
if (!orig || !orig->nd_body) {
print_undef(klass, def);
}
if (FL_TEST(klass, FL_SINGLETON)) {
singleton = rb_iv_get(klass, "__attached__");
if (name == alloc && TYPE(singleton) == T_CLASS) {
rb_raise(rb_eNameError, "cannot make alias named `allocate'");
}
}
body = orig->nd_body;
orig->nd_cnt++;
if (nd_type(body) == NODE_FBODY) { /* was alias */
Expand All @@ -1726,9 +1733,8 @@ rb_alias(klass, name, def)
rb_clear_cache_by_id(name);
st_insert(RCLASS(klass)->m_tbl, name,
NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
if (FL_TEST(klass, FL_SINGLETON)) {
rb_funcall(rb_iv_get(klass, "__attached__"),
singleton_added, 1, ID2SYM(name));
if (singleton) {
rb_funcall(singleton, singleton_added, 1, ID2SYM(name));
}
else {
rb_funcall(klass, added, 1, ID2SYM(name));
Expand Down
8 changes: 6 additions & 2 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2027,8 +2027,12 @@ rb_stat_become(obj, orig)
struct stat *nst;

/* need better argument type check */
if (!rb_obj_is_kind_of(orig, rb_obj_class(obj))) {
rb_raise(rb_eTypeError, "wrong argument type");
if (!rb_obj_is_instance_of(orig, rb_obj_class(obj))) {
rb_raise(rb_eTypeError, "wrong argument class");
}
if (DATA_PTR(obj)) {
free(DATA_PTR(obj));
DATA_PTR(obj) = 0;
}
if (DATA_PTR(orig)) {
nst = ALLOC(struct stat);
Expand Down
2 changes: 1 addition & 1 deletion gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ static VALUE
call_final(os, obj)
VALUE os, obj;
{
rb_warn("ObjectSpace::call_final is deprecated; use define_finalizer");
rb_warn("ObjectSpace::call_finalizer is deprecated; use define_finalizer");
need_call_final = 1;
FL_SET(obj, FL_FINALIZE);
return obj;
Expand Down
6 changes: 6 additions & 0 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,15 @@ rb_hash_become(copy, orig)
if (FL_TEST(orig, HASH_PROC_DEFAULT)) {
FL_SET(copy, HASH_PROC_DEFAULT);
}
else {
FL_UNSET(copy, HASH_PROC_DEFAULT);
}
if (FL_TEST(orig, HASH_DELETED)) {
FL_SET(copy, HASH_DELETED);
}
else {
FL_UNSET(copy, HASH_DELETED);
}

return copy;
}
Expand Down
Loading

0 comments on commit 40bc4f5

Please sign in to comment.