ruby-changes:49688
From: mame <ko1@a...>
Date: Sat, 13 Jan 2018 21:09:30 +0900 (JST)
Subject: [ruby-changes:49688] mame:r61805 (trunk): node.c (node_buffer_elem_t): Use FLEX_ARY_LEN
mame 2018-01-13 21:09:24 +0900 (Sat, 13 Jan 2018) New Revision: 61805 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61805 Log: node.c (node_buffer_elem_t): Use FLEX_ARY_LEN Modified files: trunk/node.c Index: node.c =================================================================== --- node.c (revision 61804) +++ node.c (revision 61805) @@ -1034,7 +1034,7 @@ rb_node_init(NODE *n, enum node_type typ https://github.com/ruby/ruby/blob/trunk/node.c#L1034 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 { https://github.com/ruby/ruby/blob/trunk/node.c#L1046 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/