summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-30 14:53:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-30 14:53:25 +0000
commit935c9e98cbeac5d3cacd1857d42e5c98302c11a8 (patch)
treefa3a926b24d7fcab7c0ba8a89340b4462bcce261
parent4b20956c38c92b892a49644d4eee04ef99a4b6eb (diff)
downloadruby-935c9e98cbeac5d3cacd1857d42e5c98302c11a8.tar.gz
ruby-935c9e98cbeac5d3cacd1857d42e5c98302c11a8.tar.xz
ruby-935c9e98cbeac5d3cacd1857d42e5c98302c11a8.zip
* parse.y (NEWHEAP, ADD2HEAP): set count after pointer was set.
fixed: [ruby-dev:27896] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--parse.y22
2 files changed, 21 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index a15c93ef2..583367662 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov 30 23:52:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (NEWHEAP, ADD2HEAP): set count after pointer was set.
+ fixed: [ruby-dev:27896]
+
Mon Nov 28 18:55:43 2005 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/socket/socket.c (init_inetsock_internal): remove setting
@@ -19,7 +24,7 @@ Sun Nov 27 00:56:13 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/wsdl/xmlSchema/complexContent.rb: missing
ComplexContent#elementformdefault method.
-
+
Sat Nov 26 19:57:45 2005 WATANABE Hirofumi <eban@ruby-lang.org>
* dln.c (conv_to_posix_path): should initialize posix.
@@ -41,7 +46,7 @@ Wed Nov 23 20:59:01 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
[Tk8.5 feature].
* ext/tk/lib/tk/text.rb: supports new indices modifires on a Text
- widget [Tk8.5 feature].
+ widget [Tk8.5 feature].
* ext/tk/lib/tk/virtevent.rb: add TkNamedVirtualEvent.
diff --git a/parse.y b/parse.y
index aafc821a8..df89471e4 100644
--- a/parse.y
+++ b/parse.y
@@ -6235,25 +6235,30 @@ rb_lastline_set(val)
#ifdef YYMALLOC
#define HEAPCNT(n, size) ((n) * (size) / sizeof(YYSTYPE))
-#define NEWHEAP(cnt) rb_node_newnode(NODE_ALLOCA, 0, (VALUE)parser_heap, cnt)
-#define ADD2HEAP(n, ptr) ((parser_heap = (n))->u1.node = (ptr))
+#define NEWHEAP() rb_node_newnode(NODE_ALLOCA, 0, (VALUE)parserp->heap, 0)
+#define ADD2HEAP(n, c, p) ((parserp->heap = (n))->u1.node = (p), \
+ (n)->u3.cnt = (c), (p))
static void *
rb_parser_malloc(size)
size_t size;
{
- NODE *n = NEWHEAP(HEAPCNT(1, size));
+ size_t cnt = HEAPCNT(1, size);
+ NODE *n = NEWHEAP();
+ void *ptr = xmalloc(size);
- return ADD2HEAP(n, xmalloc(size));
+ return ADD2HEAP(n, cnt, ptr);
}
static void *
rb_parser_calloc(nelem, size)
size_t nelem, size;
{
- NODE *n = NEWHEAP(HEAPCNT(nelem, size));
+ size_t cnt = HEAPCNT(nelem, size);
+ NODE *n = NEWHEAP();
+ void *ptr = xcalloc(nelem, size);
- return ADD2HEAP(n, xcalloc(nelem, size));
+ return ADD2HEAP(n, cnt, ptr);
}
static void *
@@ -6273,8 +6278,9 @@ rb_parser_realloc(ptr, size)
}
} while ((n = n->u2.node) != NULL);
}
- n = NEWHEAP(cnt);
- return ADD2HEAP(n, xrealloc(ptr, size));
+ n = NEWHEAP();
+ ptr = xrealloc(ptr, size);
+ return ADD2HEAP(n, cnt, ptr);
}
static void