summaryrefslogtreecommitdiff
path: root/iseq.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-14 11:19:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-14 11:19:18 +0000
commit6b5e0bd98c3a807ab7708e775ac9b60a4f59e427 (patch)
tree5e86e7f6ac8258b53aaef567a416e7caac4fdd66 /iseq.h
parentbbea0270272720d6b97fa74cf59d20eee9519aa8 (diff)
exclude flexible array size with old compilers
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.h')
-rw-r--r--iseq.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/iseq.h b/iseq.h
index daeac0c..283f5dc 100644
--- a/iseq.h
+++ b/iseq.h
@@ -256,11 +256,12 @@ static inline int
iseq_catch_table_bytes(int n)
{
enum {
- catch_table_entries_max = (INT_MAX - sizeof(struct iseq_catch_table)) / sizeof(struct iseq_catch_table_entry)
+ catch_table_entry_size = sizeof(struct iseq_catch_table_entry),
+ catch_table_entries_max = (INT_MAX - offsetof(struct iseq_catch_table, entries)) / catch_table_entry_size
};
if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
- return (int)(sizeof(struct iseq_catch_table) +
- n * sizeof(struct iseq_catch_table_entry));
+ return (int)(offsetof(struct iseq_catch_table, entries) +
+ n * catch_table_entry_size);
}
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)