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:
@@ -45,7 +45,7 @@ build_path(mrb_state *mrb, const char *dir, const char *base)
|
||||
len = strlen(base) + 1;
|
||||
|
||||
if (strcmp(dir, ".")) {
|
||||
len += strlen(dir) + strlen("/");
|
||||
len += strlen(dir) + sizeof("/") - 1;
|
||||
}
|
||||
|
||||
path = mrb_malloc(mrb, len);
|
||||
|
||||
@@ -275,7 +275,7 @@ get_command(mrb_state *mrb, mrdb_state *mrdb)
|
||||
if (i == 0 && feof(stdin)) {
|
||||
clearerr(stdin);
|
||||
strcpy(mrdb->command, "quit");
|
||||
i += strlen("quit");
|
||||
i += sizeof("quit") - 1;
|
||||
}
|
||||
|
||||
if (i == MAX_COMMAND_LINE) {
|
||||
|
||||
Reference in New Issue
Block a user