don't use VLA
This commit is contained in:
parent
9f3fefd606
commit
072a32601f
|
@ -452,19 +452,18 @@ pic_str_make_string(pic_state *pic)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char c = ' ';
|
char c = ' ';
|
||||||
|
char *buf;
|
||||||
|
pic_value ret;
|
||||||
|
|
||||||
pic_get_args(pic, "k|c", &len, &c);
|
pic_get_args(pic, "k|c", &len, &c);
|
||||||
|
|
||||||
{
|
buf = pic_malloc(pic, len);
|
||||||
size_t i;
|
memset(buf, c, len);
|
||||||
char buf[len];
|
|
||||||
|
|
||||||
for (i = 0; i < len; ++i) {
|
ret = pic_obj_value(pic_make_str(pic, buf, len));
|
||||||
buf[i] = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pic_obj_value(pic_make_str(pic, buf, len));
|
pic_free(pic, buf);
|
||||||
}
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
|
|
Loading…
Reference in New Issue