1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

node.c (node_buffer_elem_t): Use FLEX_ARY_LEN

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-01-13 12:09:24 +00:00
parent 7da7716159
commit 2768bae806

4
node.c
View file

@ -1034,7 +1034,7 @@ rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2)
typedef struct node_buffer_elem_struct {
struct node_buffer_elem_struct *next;
NODE buf[1]; /* flexible array */
NODE buf[FLEX_ARY_LEN];
} node_buffer_elem_t;
struct node_buffer_struct {
@ -1046,7 +1046,7 @@ struct node_buffer_struct {
static node_buffer_t *
rb_node_buffer_new(void)
{
node_buffer_t *nb = xmalloc(offsetof(node_buffer_t, body) + offsetof(node_buffer_elem_t, buf) + 16 * sizeof(NODE));
node_buffer_t *nb = xmalloc(sizeof(node_buffer_t) + 16 * sizeof(NODE));
nb->idx = 0;
nb->len = 16;
nb->head = &nb->body;