From 78b0d7ac1c12fc2b561f8dfa1f89c81e8c493809 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 28 Nov 2016 13:16:00 +0000 Subject: string.c: fix zero-length array * string.c (mapping_buffer): get rid of zero-length array member, which is not a part of C90. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/string.c b/string.c index 9b6961c392..96115e0ce0 100644 --- a/string.c +++ b/string.c @@ -5897,7 +5897,7 @@ typedef struct mapping_buffer { size_t capa; size_t used; struct mapping_buffer *next; - OnigUChar space[0]; + OnigUChar space[1]; } mapping_buffer; static VALUE @@ -5923,7 +5923,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 = (mapping_buffer*)ALLOC_N(char, sizeof(mapping_buffer)+capa); + current_buffer->next = (mapping_buffer*)ALLOC_N(char, offsetof(mapping_buffer, space)+capa); current_buffer = current_buffer->next; current_buffer->next = NULL; current_buffer->capa = capa; -- cgit v1.2.3