~lattis/muon

24c401f1ec7b0086002f8333e5d008b00544c96e — Stone Tickle a month ago efe5ac1
fix strip() with a string full of stripchars
2 files changed, 5 insertions(+), 1 deletions(-)

M src/functions/string.c
M src/lang/string.c
M src/functions/string.c => src/functions/string.c +5 -0
@@ 45,12 45,17 @@ func_strip(struct workspace *wk, uint32_t rcvr, uint32_t args_node, uint32_t *ob
	}

	for (len = ss->len - 1; len >= 0; --len) {
		if (len < (int64_t)i) {
			break;
		}

		if (!chr_in_str(ss->s[len], strip)) {
			break;
		}
	}
	++len;

	assert((int64_t)len >= (int64_t)i);
	make_obj(wk, obj, obj_string)->dat.str = wk_str_pushn(wk, &ss->s[i], len - i);
	return true;
}

M src/lang/string.c => src/lang/string.c +0 -1
@@ 166,7 166,6 @@ _make_str(struct workspace *wk, const char *p, uint32_t len)
	}

	memcpy((void *)reserve_str(wk, &s, len)->s, p, len);

	return s;
}