Permalink
Browse files

* 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.

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


git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent ec446f9 commit e9a7798217735e3613b27cc16e0881b4c6875ad5 matz committed Aug 29, 2002
Showing with 203 additions and 164 deletions.
  1. +13 −1 ChangeLog
  2. +3 −2 ToDo
  3. +2 −1 array.c
  4. +1 −1 configure.in
  5. +9 −3 eval.c
  6. +6 −2 file.c
  7. +1 −1 gc.c
  8. +6 −0 hash.c
  9. +119 −134 lib/finalize.rb
  10. +17 −8 marshal.c
  11. +1 −1 re.c
  12. +2 −1 ruby.h
  13. +21 −7 string.c
  14. +2 −2 struct.c
View
@@ -7,6 +7,13 @@ Thu Aug 29 00:55:55 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* marshal.c (r_object): yield loaded objects, not intermediates.
(ruby-bugs-ja:PR#296)
+Thu Aug 29 00:06:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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 <michal@ruby-lang.org>
* signal.c: remove #ifdef SIGINT for struct signals.
@@ -17,6 +24,11 @@ Wed Aug 28 23:34:32 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* io.c (appendline): data was lost when raw mode.
+Wed Aug 28 22:57:34 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_string_value_ptr): StringValuePtr() should never
+ return NULL pointer.
+
Wed Aug 28 19:12:46 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* ext/stringio/stringio.c (strio_initialize): RSTRING(mode)->ptr
@@ -34,7 +46,7 @@ Wed Aug 28 17:45:03 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
Wed Aug 28 16:36:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
- * 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 <matz@ruby-lang.org>
View
5 ToDo
@@ -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
@@ -115,7 +116,7 @@ Extension Libraries
Ruby Libraries
-* add uri.rb
+- add uri.rb
* urllib.rb, nttplib.rb, etc.
* format like perl's
View
@@ -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;
View
@@ -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"
View
12 eval.c
@@ -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;
@@ -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 */
@@ -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));
View
8 file.c
@@ -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);
View
2 gc.c
@@ -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;
View
6 hash.c
@@ -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;
}
Oops, something went wrong.

0 comments on commit e9a7798

Please sign in to comment.