ruby-changes:44842
From: nobu <ko1@a...>
Date: Mon, 28 Nov 2016 22:16:07 +0900 (JST)
Subject: [ruby-changes:44842] nobu:r56915 (trunk): string.c: fix zero-length array
nobu 2016-11-28 22:16:00 +0900 (Mon, 28 Nov 2016) New Revision: 56915 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56915 Log: string.c: fix zero-length array * string.c (mapping_buffer): get rid of zero-length array member, which is not a part of C90. Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 56914) +++ string.c (revision 56915) @@ -5897,7 +5897,7 @@ typedef struct mapping_buffer { https://github.com/ruby/ruby/blob/trunk/string.c#L5897 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, OnigCaseFol https://github.com/ruby/ruby/blob/trunk/string.c#L5923 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/