Blame ruby-1.8.5-hash-memory-leak.patch
|
|
25b45e3 |
diff -ruN ruby-1.8.5.orig/hash.c ruby-1.8.5/hash.c
|
|
|
25b45e3 |
--- ruby-1.8.5.orig/hash.c 2006-07-07 00:44:26.000000000 +0900
|
|
|
25b45e3 |
+++ ruby-1.8.5/hash.c 2006-08-30 15:50:31.000000000 +0900
|
|
|
25b45e3 |
@@ -223,20 +223,31 @@
|
|
|
25b45e3 |
rb_ensure(hash_foreach_call, (VALUE)&arg, hash_foreach_ensure, hash);
|
|
|
25b45e3 |
}
|
|
|
25b45e3 |
|
|
|
25b45e3 |
+static VALUE hash_alloc0 _((VALUE));
|
|
|
25b45e3 |
static VALUE hash_alloc _((VALUE));
|
|
|
25b45e3 |
static VALUE
|
|
|
25b45e3 |
-hash_alloc(klass)
|
|
|
25b45e3 |
+hash_alloc0(klass)
|
|
|
25b45e3 |
VALUE klass;
|
|
|
25b45e3 |
{
|
|
|
25b45e3 |
NEWOBJ(hash, struct RHash);
|
|
|
25b45e3 |
OBJSETUP(hash, klass, T_HASH);
|
|
|
25b45e3 |
|
|
|
25b45e3 |
hash->ifnone = Qnil;
|
|
|
25b45e3 |
- hash->tbl = st_init_table(&objhash);
|
|
|
25b45e3 |
|
|
|
25b45e3 |
return (VALUE)hash;
|
|
|
25b45e3 |
}
|
|
|
25b45e3 |
|
|
|
25b45e3 |
+static VALUE
|
|
|
25b45e3 |
+hash_alloc(klass)
|
|
|
25b45e3 |
+ VALUE klass;
|
|
|
25b45e3 |
+{
|
|
|
25b45e3 |
+ VALUE hash = hash_alloc0(klass);
|
|
|
25b45e3 |
+
|
|
|
25b45e3 |
+ RHASH(hash)->tbl = st_init_table(&objhash);
|
|
|
25b45e3 |
+
|
|
|
25b45e3 |
+ return hash;
|
|
|
25b45e3 |
+}
|
|
|
25b45e3 |
+
|
|
|
25b45e3 |
VALUE
|
|
|
25b45e3 |
rb_hash_new()
|
|
|
25b45e3 |
{
|
|
|
25b45e3 |
@@ -325,9 +336,7 @@
|
|
|
25b45e3 |
int i;
|
|
|
25b45e3 |
|
|
|
25b45e3 |
if (argc == 1 && TYPE(argv[0]) == T_HASH) {
|
|
|
25b45e3 |
- hash = hash_alloc(klass);
|
|
|
25b45e3 |
-
|
|
|
25b45e3 |
- RHASH(hash)->ifnone = Qnil;
|
|
|
25b45e3 |
+ hash = hash_alloc0(klass);
|
|
|
25b45e3 |
RHASH(hash)->tbl = st_copy(RHASH(argv[0])->tbl);
|
|
|
25b45e3 |
|
|
|
25b45e3 |
return hash;
|