[ruby/yarp] fix computation of memsize for node lists
https://github.com/ruby/yarp/commit/02aab8b026
This commit is contained in:
parent
5c5391f444
commit
18622403ac
@ -102,6 +102,10 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
||||
case <%= node.type %>: {
|
||||
yp_<%= node.human %>_t *cast = (yp_<%= node.human %>_t *) node;
|
||||
memsize->memsize += sizeof(*cast);
|
||||
<%- if node.fields.any? { |f| f.is_a?(YARP::NodeListField) } -%>
|
||||
// Node lists will add in their own sizes below.
|
||||
memsize->memsize -= sizeof(yp_node_list_t) * <%= node.fields.count { |f| f.is_a?(YARP::NodeListField) } %>;
|
||||
<%- end -%>
|
||||
<%- node.fields.each do |field| -%>
|
||||
<%- case field -%>
|
||||
<%- when YARP::ConstantField, YARP::OptionalConstantField, YARP::UInt32Field, YARP::FlagsField, YARP::LocationField, YARP::OptionalLocationField -%>
|
||||
@ -114,7 +118,7 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
||||
<%- when YARP::StringField -%>
|
||||
memsize->memsize += yp_string_memsize(&cast-><%= field.name %>);
|
||||
<%- when YARP::NodeListField -%>
|
||||
yp_node_list_memsize(&cast-><%= field.name %>, memsize);
|
||||
memsize->memsize += yp_node_list_memsize(&cast-><%= field.name %>, memsize);
|
||||
<%- when YARP::ConstantListField -%>
|
||||
memsize->memsize += yp_constant_id_list_memsize(&cast-><%= field.name %>);
|
||||
<%- else -%>
|
||||
|
Loading…
x
Reference in New Issue
Block a user