diff options
| author | Masaki Muranaka <[email protected]> | 2012-10-22 11:21:04 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2012-10-22 11:21:04 +0900 |
| commit | dd10048094b3fa9a53b1385bd16ffcc07d35e1a6 (patch) | |
| tree | c0c8355091dd95cc280ba9ebd345b77f5a6392e6 /src/string.c | |
| parent | fed285d1945d1fa3104b441cf51db2d7118a5d01 (diff) | |
| download | mruby-dd10048094b3fa9a53b1385bd16ffcc07d35e1a6.tar.gz mruby-dd10048094b3fa9a53b1385bd16ffcc07d35e1a6.zip | |
Remove redundant sizeof(char). "Always sizeof(char) == 1" is described in ISO C specs.
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 6 |
1 files changed, 3 insertions, 3 deletions
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; } |
