diff options
| author | Tatsuhiko Kubo <[email protected]> | 2014-08-22 20:37:34 +0900 |
|---|---|---|
| committer | Tatsuhiko Kubo <[email protected]> | 2014-08-22 20:37:34 +0900 |
| commit | 6c7ba826dd8b8725e1db75e2d4a60a3f0bf8470c (patch) | |
| tree | 281421fc34abd6f79bccb1b4d3ce1ce2e2d0b652 | |
| parent | 84b245066e247128a1a129294f0176e8d16992b4 (diff) | |
| download | mruby-6c7ba826dd8b8725e1db75e2d4a60a3f0bf8470c.tar.gz mruby-6c7ba826dd8b8725e1db75e2d4a60a3f0bf8470c.zip | |
Use sizeof() instead of strlen().
| -rw-r--r-- | mrbgems/mruby-bin-mirb/tools/mirb/mirb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c index 8ba73f4b0..b0a94e6c5 100644 --- a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +++ b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c @@ -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) { |
