Commit e05bbd45 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #504 from monaka/pr-remove-redundant-sizeof-char

Remove redundant sizeof(char).
parents b8c94be1 dd100480
......@@ -41,6 +41,7 @@ int mrb_bdump_irep(mrb_state *mrb, int n, FILE *f,const char *initname);
#define MRB_DUMP_SIZE_OF_LONG 4
#define MRB_DUMP_SIZE_OF_INT 4
#define MRB_DUMP_SIZE_OF_SHORT 2
#define MRB_DUMP_SIZE_OF_CHAR 1
/* null symbol length */
#define MRB_DUMP_NULL_SYM_LEN 0xFFFF
......
......@@ -84,7 +84,7 @@ uint8_dump(uint8_t bin, char *hex, int type)
*hex++ = bin2hex[(bin >> 4) & 0x0f];
*hex = bin2hex[bin & 0x0f];
}
return DUMP_SIZE(sizeof(char), type);
return DUMP_SIZE(MRB_DUMP_SIZE_OF_CHAR, type);
}
static inline int
......@@ -188,7 +188,7 @@ get_irep_header_size(mrb_state *mrb, mrb_irep *irep, int type)
{
uint32_t size = 0;
size += sizeof(char) * 2;
size += 2;
size += DUMP_SIZE(MRB_DUMP_SIZE_OF_SHORT, type) * 4;
return size;
......@@ -215,7 +215,7 @@ get_pool_block_size(mrb_state *mrb, mrb_irep *irep, int type)
char buf[32];
size += MRB_DUMP_SIZE_OF_LONG; /* plen */
size += irep->plen * sizeof(char); /* tt(n) */
size += irep->plen; /* tt(n) */
size += irep->plen * MRB_DUMP_SIZE_OF_SHORT; /* len(n) */
size += MRB_DUMP_SIZE_OF_SHORT; /* crc */
size = DUMP_SIZE(size, type);
......
......@@ -2494,7 +2494,7 @@ mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck)
if (badcheck) goto bad;
return mrb_fixnum_value(0);
}
len *= strlen(str)*sizeof(char);
len *= strlen(str);
val = strtoul((char*)str, &end, base);
......@@ -2546,7 +2546,7 @@ mrb_str_to_inum(mrb_state *mrb, mrb_value str, int base, int badcheck)
char *p = (char *)mrb_malloc(mrb, len+1);
//MEMCPY(p, s, char, len);
memcpy(p, s, sizeof(char)*len);
memcpy(p, s, len);
p[len] = '\0';
s = p;
}
......@@ -2682,7 +2682,7 @@ mrb_str_to_dbl(mrb_state *mrb, mrb_value str, int badcheck)
if (s[len]) { /* no sentinel somehow */
char *p = (char *)mrb_malloc(mrb, len+1);
memcpy(p, s, sizeof(char)*len);
memcpy(p, s, len);
p[len] = '\0';
s = p;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment