From 2282f51b5e886d744ce9d9a538e11df0c3aa4b59 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Thu, 6 Jun 2024 18:01:17 +0900 Subject: [PATCH] Make c99, c23 compatible --- ext/rbs_extension/location.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/rbs_extension/location.h b/ext/rbs_extension/location.h index 63b926e55..b8d1ddf14 100644 --- a/ext/rbs_extension/location.h +++ b/ext/rbs_extension/location.h @@ -16,17 +16,19 @@ typedef struct { typedef unsigned int rbs_loc_entry_bitmap; +// The flexible array always allocates, but it's okay. +// This struct is not allocated when the `rbs_loc` doesn't have children. typedef struct { unsigned short len; unsigned short cap; rbs_loc_entry_bitmap required_p; - rbs_loc_entry entries[0]; + rbs_loc_entry entries[1]; } rbs_loc_children; typedef struct { VALUE buffer; range rg; - rbs_loc_children *children; + rbs_loc_children *children; // NULL when no children is allocated } rbs_loc; /**