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
This commit is contained in:
parent
f2a1f32f48
commit
78b0d7ac1c
4
string.c
4
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user