mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 11:09:54 +00:00
Fix parse insert bug.
This commit is contained in:
parent
4ded5e10a2
commit
4e6193b67e
@ -712,7 +712,7 @@ static Janet cfun_parse_insert(int32_t argc, Janet *argv) {
|
|||||||
const uint8_t *str = janet_to_string(argv[1]);
|
const uint8_t *str = janet_to_string(argv[1]);
|
||||||
int32_t slen = janet_string_length(str);
|
int32_t slen = janet_string_length(str);
|
||||||
size_t newcount = p->bufcount + slen;
|
size_t newcount = p->bufcount + slen;
|
||||||
if (p->bufcap > p->bufcount + slen) {
|
if (p->bufcap < newcount) {
|
||||||
size_t newcap = 2 * newcount;
|
size_t newcap = 2 * newcount;
|
||||||
p->buf = realloc(p->buf, newcap);
|
p->buf = realloc(p->buf, newcap);
|
||||||
if (p->buf == NULL) {
|
if (p->buf == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user