summaryrefslogtreecommitdiff
path: root/node.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-13 12:09:24 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-13 12:09:24 +0000
commit2768bae806cd502a76d02b76b09f546296a10aa8 (patch)
treea46ac58ffffbc528c66b55b80a789e3e19cc7f4b /node.c
parent7da7716159f296e0175aad3a23452ef9710e80e5 (diff)
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
Diffstat (limited to 'node.c')
-rw-r--r--node.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/node.c b/node.c
index a5c04aa5fd..4770f7cfd2 100644
--- a/node.c
+++ b/node.c
@@ -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;