mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Use sizeof() instead of strlen().
This commit is contained in:
@@ -106,7 +106,7 @@ is_code_block_open(struct mrb_parser_state *parser)
|
||||
|
||||
/* check if parser error are available */
|
||||
if (0 < parser->nerr) {
|
||||
const char *unexpected_end = "syntax error, unexpected $end";
|
||||
const char unexpected_end[] = "syntax error, unexpected $end";
|
||||
const char *message = parser->error_buffer[0].message;
|
||||
|
||||
/* a parser error occur, we have to check if */
|
||||
@@ -114,7 +114,7 @@ is_code_block_open(struct mrb_parser_state *parser)
|
||||
/* a different issue which we have to show to */
|
||||
/* the user */
|
||||
|
||||
if (strncmp(message, unexpected_end, strlen(unexpected_end)) == 0) {
|
||||
if (strncmp(message, unexpected_end, sizeof(unexpected_end) - 1) == 0) {
|
||||
code_block_open = TRUE;
|
||||
}
|
||||
else if (strcmp(message, "syntax error, unexpected keyword_end") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user