mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
3e2753ad2e
commit
8a677a6e80
1 changed files with 11 additions and 1 deletions
12
mjit.c
12
mjit.c
|
@ -700,6 +700,16 @@ start_worker(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There's no strndup on Windows
|
||||||
|
static char*
|
||||||
|
ruby_strndup(char *str, size_t n)
|
||||||
|
{
|
||||||
|
char *ret = xmalloc(n + 1);
|
||||||
|
memcpy(ret, str, n);
|
||||||
|
ret[n] = '\0';
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert "foo bar" to {"foo", "bar", NULL} array. Caller is responsible for
|
// Convert "foo bar" to {"foo", "bar", NULL} array. Caller is responsible for
|
||||||
// freeing a returned buffer and its elements.
|
// freeing a returned buffer and its elements.
|
||||||
static char **
|
static char **
|
||||||
|
@ -716,7 +726,7 @@ split_flags(char *flags)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (next > flags)
|
if (next > flags)
|
||||||
buf[i++] = strndup(flags, next - flags);
|
buf[i++] = ruby_strndup(flags, next - flags);
|
||||||
next++; // skip space
|
next++; // skip space
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue