Skip to content

Commit

Permalink
fix computation of memsize for constant id lists
Browse files Browse the repository at this point in the history
  • Loading branch information
froydnj committed Sep 18, 2023
1 parent 02aab8b commit df72517
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/src/node.c.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>
Expand Down

0 comments on commit df72517

Please sign in to comment.