summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-13 13:08:05 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-13 13:08:05 +0000
commit982e9e623501dc1c6655ca37fef505c3ec7af8d1 (patch)
tree092e257ca4c0e3ddec258d7805a7478c7dfb431a /string.c
parentc33ba4a67ee0aa5b905000d872951268861eb546 (diff)
string.c (struct mapping_buffer): Use FLEX_ARY_LEN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string.c b/string.c
index 798fd52e3c..22734e0e1b 100644
--- a/string.c
+++ b/string.c
@@ -6384,7 +6384,7 @@ typedef struct mapping_buffer {
size_t capa;
size_t used;
struct mapping_buffer *next;
- OnigUChar space[1];
+ OnigUChar space[FLEX_ARY_LEN];
} mapping_buffer;
static VALUE
@@ -6410,7 +6410,7 @@ rb_str_casemap(VALUE source, OnigCaseFoldType *flags, rb_encoding *enc)
if (CASEMAP_DEBUG) {
fprintf(stderr, "Buffer allocation, capa is %"PRIuSIZE"\n", capa); /* for tuning */
}
- current_buffer->next = xmalloc(offsetof(mapping_buffer, space) + capa);
+ current_buffer->next = xmalloc(sizeof(mapping_buffer) + capa);
current_buffer = current_buffer->next;
current_buffer->next = NULL;
current_buffer->capa = capa;