From c7875340be63201adde698405d0c8a81a313d5bf Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Mon, 18 Sep 2023 13:35:58 -0400 Subject: [PATCH] [ruby/yarp] fix computation of memsize for constant id lists https://github.com/ruby/yarp/commit/df72517fd1 --- yarp/templates/src/node.c.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yarp/templates/src/node.c.erb b/yarp/templates/src/node.c.erb index 7ce54f2011..f21144f169 100644 --- a/yarp/templates/src/node.c.erb +++ b/yarp/templates/src/node.c.erb @@ -106,6 +106,10 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) { // 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 -%> + <%- if node.fields.any? { |f| f.is_a?(YARP::ConstantListField) } -%> + // Constant id lists will add in their own sizes below. + memsize->memsize -= sizeof(yp_constant_id_list_t) * <%= node.fields.count { |f| f.is_a?(YARP::ConstantListField) } %>; + <%- end -%> <%- node.fields.each do |field| -%> <%- case field -%> <%- when YARP::ConstantField, YARP::OptionalConstantField, YARP::UInt32Field, YARP::FlagsField, YARP::LocationField, YARP::OptionalLocationField -%>