summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-10-22 07:09:46 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-10-22 07:09:46 -0700
commite05bbd45bb328b6ce3af0056a3d314ce5068abd6 (patch)
treeaccff43e489f950f0d9ed3c277412977f3ac37c6 /src
parentb8c94be107fa00f981d0e9259fab398ee4f7f4b4 (diff)
parentdd10048094b3fa9a53b1385bd16ffcc07d35e1a6 (diff)
downloadmruby-e05bbd45bb328b6ce3af0056a3d314ce5068abd6.tar.gz
mruby-e05bbd45bb328b6ce3af0056a3d314ce5068abd6.zip
Merge pull request #504 from monaka/pr-remove-redundant-sizeof-char
Remove redundant sizeof(char).
Diffstat (limited to 'src')
-rw-r--r--src/dump.c6
-rw-r--r--src/string.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/dump.c b/src/dump.c
index 4f672e188..15e11153e 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -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);
diff --git a/src/string.c b/src/string.c
index 57bbbc831..11e760ca1 100644
--- a/src/string.c
+++ b/src/string.c
@@ -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;
}