It is guaranteed that dest < src, so we can safely use memcpy
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
---
src/gen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
index 73cda32..c6e7d3e 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -2186,7 +2186,7 @@ gen_expr_delete(struct gen_context *ctx, const struct expression *expr)
pushi(ctx->current, &qlen, Q_SUB, &qlen, &qend, NULL);
pushi(ctx->current, &mlen, Q_MUL, &qlen, &membsz, NULL);
- pushi(ctx->current, NULL, Q_CALL, &ctx->rt.memmove, &startptr, &endptr, &mlen,
+ pushi(ctx->current, NULL, Q_CALL, &ctx->rt.memcpy, &startptr, &endptr, &mlen,
NULL);
pushi(ctx->current, &qlen, Q_ADD, &qlen, &qstart, NULL);
--
2.38.4
On Fri Sep 22, 2023 at 9:57 PM EDT, Bor Grošelj Simić wrote:
> It is guaranteed that dest < src, so we can safely use memcpy
-1. The fact that this happens to work with our current memcpy
implementation doesn't mean we should rely on it. docs/runtime.txt also
explicitly says "the memory areas shall not overlap", and I think this
is correct.