[ruby/prism] Avoid warning for pm_token_buffer_t initialization

* This was causing this error on macOS Mojave:
  src/prism.c:8216:48: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
            pm_token_buffer_t token_buffer = { 0 };
                                               ^

https://github.com/ruby/prism/commit/5055fc04fd
This commit is contained in:
Benoit Daloze 2023-10-18 12:54:34 +02:00 committed by git
parent 6241cfab74
commit 9792be3610

View File

@ -8248,7 +8248,7 @@ parser_lex(pm_parser_t *parser) {
// If we haven't found an escape yet, then this buffer will be
// unallocated since we can refer directly to the source string.
pm_token_buffer_t token_buffer = { 0 };
pm_token_buffer_t token_buffer = { { 0 }, 0 };
while (breakpoint != NULL) {
// If we hit a null byte, skip directly past it.
@ -8424,7 +8424,7 @@ parser_lex(pm_parser_t *parser) {
// characters.
const uint8_t *breakpoints = lex_mode->as.regexp.breakpoints;
const uint8_t *breakpoint = pm_strpbrk(parser, parser->current.end, breakpoints, parser->end - parser->current.end);
pm_token_buffer_t token_buffer = { 0 };
pm_token_buffer_t token_buffer = { { 0 }, 0 };
while (breakpoint != NULL) {
// If we hit a null byte, skip directly past it.
@ -8613,7 +8613,7 @@ parser_lex(pm_parser_t *parser) {
// If we haven't found an escape yet, then this buffer will be
// unallocated since we can refer directly to the source string.
pm_token_buffer_t token_buffer = { 0 };
pm_token_buffer_t token_buffer = { { 0 }, 0 };
while (breakpoint != NULL) {
// If we hit the incrementor, then we'll increment then nesting and
@ -8874,7 +8874,7 @@ parser_lex(pm_parser_t *parser) {
}
const uint8_t *breakpoint = pm_strpbrk(parser, parser->current.end, breakpoints, parser->end - parser->current.end);
pm_token_buffer_t token_buffer = { 0 };
pm_token_buffer_t token_buffer = { { 0 }, 0 };
bool was_escaped_newline = false;
while (breakpoint != NULL) {