mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Remove strlen(). We can use sizeof() of char array because sizeof(char) is always 1 (ISO C99).
This commit is contained in:
+6
-6
@@ -880,9 +880,9 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
|
||||
{
|
||||
int i;
|
||||
mrb_value s, arystr;
|
||||
char *head = "[";
|
||||
char *sep = ", ";
|
||||
char *tail = "]";
|
||||
char head[] = { '[' };
|
||||
char sep[] = { ',', ' ' };
|
||||
char tail[] = { ']' };
|
||||
|
||||
/* check recursive */
|
||||
for(i=0; i<RARRAY_LEN(list); i++) {
|
||||
@@ -894,13 +894,13 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
|
||||
mrb_ary_push(mrb, list, ary);
|
||||
|
||||
arystr = mrb_str_buf_new(mrb, 64);
|
||||
mrb_str_buf_cat(mrb, arystr, head, strlen(head));
|
||||
mrb_str_buf_cat(mrb, arystr, head, sizeof(head));
|
||||
|
||||
for(i=0; i<RARRAY_LEN(ary); i++) {
|
||||
int ai = mrb_gc_arena_save(mrb);
|
||||
|
||||
if (i > 0) {
|
||||
mrb_str_buf_cat(mrb, arystr, sep, strlen(sep));
|
||||
mrb_str_buf_cat(mrb, arystr, sep, sizeof(sep));
|
||||
}
|
||||
if (mrb_type(RARRAY_PTR(ary)[i]) == MRB_TT_ARRAY) {
|
||||
s = inspect_ary(mrb, RARRAY_PTR(ary)[i], list);
|
||||
@@ -911,7 +911,7 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
|
||||
mrb_gc_arena_restore(mrb, ai);
|
||||
}
|
||||
|
||||
mrb_str_buf_cat(mrb, arystr, tail, strlen(tail));
|
||||
mrb_str_buf_cat(mrb, arystr, tail, sizeof(tail));
|
||||
mrb_ary_pop(mrb, list);
|
||||
|
||||
return arystr;
|
||||
|
||||
Reference in New Issue
Block a user