Unverified Commit 86f8edca authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5509 from dearblue/cast-c++

Avoid implicit casting from void pointers for C++
parents d4e22c2c c8750048
......@@ -9,7 +9,7 @@
static size_t
mrb_debug_strnlen(const char *s, size_t maxlen)
{
const char *p = memchr(s, '\0', maxlen);
const char *p = (const char*)memchr(s, '\0', maxlen);
return p != NULL ? (size_t)(p - s) : maxlen;
}
......@@ -17,7 +17,7 @@ char*
mrdb_strndup(mrb_state *mrb, const char *s, size_t size)
{
size_t l = mrb_debug_strnlen(s, size);
char *d = mrb_malloc_simple(mrb, l + 1);
char *d = (char*)mrb_malloc_simple(mrb, l + 1);
if (d != NULL) {
memcpy(d, s, l);
d[l] = '\0';
......@@ -29,6 +29,6 @@ char*
mrdb_strdup(mrb_state *mrb, const char *s)
{
size_t z = strlen(s) + 1;
char *d = mrb_malloc_simple(mrb, z);
return d != NULL ? memcpy(d, s, z) : NULL;
char *d = (char*)mrb_malloc_simple(mrb, z);
return d != NULL ? (char*)memcpy(d, s, z) : NULL;
}
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