ruby-changes:49694
From: mame <ko1@a...>
Date: Sat, 13 Jan 2018 22:08:10 +0900 (JST)
Subject: [ruby-changes:49694] mame:r61811 (trunk): string.c (struct mapping_buffer): Use FLEX_ARY_LEN
mame 2018-01-13 22:08:05 +0900 (Sat, 13 Jan 2018) New Revision: 61811 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61811 Log: string.c (struct mapping_buffer): Use FLEX_ARY_LEN Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 61810) +++ string.c (revision 61811) @@ -6384,7 +6384,7 @@ typedef struct mapping_buffer { https://github.com/ruby/ruby/blob/trunk/string.c#L6384 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, OnigCaseFol https://github.com/ruby/ruby/blob/trunk/string.c#L6410 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/