aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.h
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-13 12:44:17 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-13 12:44:17 +0000
commit0a1511dc0013370572822cac359086b1bcf4fcc1 (patch)
tree673600ac2e387fb3164c8480164d5a4a70f776a0 /iseq.h
parentd4cf291ff5288e7d9823d2e732415e839dfe88d9 (diff)
downloadruby-0a1511dc0013370572822cac359086b1bcf4fcc1.tar.gz
iseq.h (struct iseq_catch_table_entry, iseq_compile_data_storage): Use FLEX_ARY_LEN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.h')
-rw-r--r--iseq.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/iseq.h b/iseq.h
index 639d12bf24..daeac0c889 100644
--- a/iseq.h
+++ b/iseq.h
@@ -249,7 +249,7 @@ struct iseq_catch_table_entry {
PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
unsigned int size;
- struct iseq_catch_table_entry entries[1]; /* flexible array */
+ struct iseq_catch_table_entry entries[FLEX_ARY_LEN];
});
static inline int
@@ -260,7 +260,7 @@ iseq_catch_table_bytes(int n)
};
if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
return (int)(sizeof(struct iseq_catch_table) +
- (n - 1) * sizeof(struct iseq_catch_table_entry));
+ n * sizeof(struct iseq_catch_table_entry));
}
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
@@ -269,13 +269,9 @@ struct iseq_compile_data_storage {
struct iseq_compile_data_storage *next;
unsigned int pos;
unsigned int size;
- char buff[1]; /* flexible array */
+ char buff[FLEX_ARY_LEN];
};
-/* account for flexible array */
-#define SIZEOF_ISEQ_COMPILE_DATA_STORAGE \
- (sizeof(struct iseq_compile_data_storage) - 1)
-
/* defined? */
enum defined_type {