[PATCH harec] gen_expr_delete: use memcpy instead of memmove
Export this patch
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.
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
harec/patches: SUCCESS in 53s
[gen_expr_delete: use memcpy instead of memmove][0] from [Bor Grošelj Simić][1]
[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/44960
[1]: mailto:bgs@turminal.net
✓ #1061654 SUCCESS harec/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/1061654
✓ #1061655 SUCCESS harec/patches/netbsd.yml https://builds.sr.ht/~sircmpwn/job/1061655
✓ #1061653 SUCCESS harec/patches/alpine.yml https://builds.sr.ht/~sircmpwn/job/1061653