File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 22
33#define RBS_LOC_REQUIRED_P (loc , i ) ((loc)->children->required_p & (1 << (i)))
44#define RBS_LOC_OPTIONAL_P (loc , i ) (!RBS_LOC_REQUIRED_P((loc), (i)))
5- #define RBS_LOC_CHILDREN_SIZE (cap ) (sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * (cap))
5+ #define RBS_LOC_CHILDREN_SIZE (cap ) (sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * (( cap) - 1 ))
66
77VALUE RBS_Location ;
88
Original file line number Diff line number Diff line change @@ -16,17 +16,19 @@ typedef struct {
1616
1717typedef unsigned int rbs_loc_entry_bitmap ;
1818
19+ // The flexible array always allocates, but it's okay.
20+ // This struct is not allocated when the `rbs_loc` doesn't have children.
1921typedef struct {
2022 unsigned short len ;
2123 unsigned short cap ;
2224 rbs_loc_entry_bitmap required_p ;
23- rbs_loc_entry entries [0 ];
25+ rbs_loc_entry entries [1 ];
2426} rbs_loc_children ;
2527
2628typedef struct {
2729 VALUE buffer ;
2830 range rg ;
29- rbs_loc_children * children ;
31+ rbs_loc_children * children ; // NULL when no children is allocated
3032} rbs_loc ;
3133
3234/**
You can’t perform that action at this time.
0 commit comments