diff options
| author | Masaki Muranaka <[email protected]> | 2012-06-27 13:01:22 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2012-06-27 13:01:22 +0900 |
| commit | 2042684b6ed163ca1ebfdaaffe5bd7e98b19abc6 (patch) | |
| tree | 4a68ccdafa027f2679acdd0e34e6f571d30241b8 | |
| parent | d534f26f16ba94c2182a44e4201352d1fb277af0 (diff) | |
| download | mruby-2042684b6ed163ca1ebfdaaffe5bd7e98b19abc6.tar.gz mruby-2042684b6ed163ca1ebfdaaffe5bd7e98b19abc6.zip | |
Use sizeof to get char array sizes.
| -rw-r--r-- | src/parse.y | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parse.y b/src/parse.y index 4c9f88889..1c2e13de9 100644 --- a/src/parse.y +++ b/src/parse.y @@ -2587,7 +2587,7 @@ var_ref : variable { char buf[16]; - snprintf(buf, 16, "%d", p->lineno); + snprintf(buf, sizeof(buf), "%d", p->lineno); $$ = new_int(p, buf, 10); } ; @@ -2955,7 +2955,7 @@ yyerror_i(parser_state *p, const char *fmt, int i) { char buf[256]; - snprintf(buf, 256, fmt, i); + snprintf(buf, sizeof(buf), fmt, i); yyerror(p, buf); } @@ -2995,7 +2995,7 @@ yywarning_s(parser_state *p, const char *fmt, const char *s) { char buf[256]; - snprintf(buf, 256, fmt, s); + snprintf(buf, sizeof(buf), fmt, s); yywarning(p, buf); } @@ -3702,7 +3702,7 @@ parser_yylex(parser_state *p) } if (c2) { char buf[256]; - snprintf(buf, 256, "invalid character syntax; use ?\\%c", c2); + snprintf(buf, sizeof(buf), "invalid character syntax; use ?\\%c", c2); yyerror(p, buf); } } |
