~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH harec] gen_expr_delete: use memcpy instead of memmove

Details
Message ID
<20230923015757.31941-1-bgs@turminal.net>
DKIM signature
missing
Download raw message
Patch: +1 -1
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

[harec/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CVPX2YHQFG6E.FK48MPUSUQDO@cirno2>
In-Reply-To
<20230923015757.31941-1-bgs@turminal.net> (view parent)
DKIM signature
missing
Download raw message
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]: 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
Details
Message ID
<CVPXKY51VF9P.28WVVKXURMTZ5@notmylaptop>
In-Reply-To
<20230923015757.31941-1-bgs@turminal.net> (view parent)
DKIM signature
missing
Download raw message
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.
Reply to thread Export thread (mbox)