From 11a8149d673d96bec17d6487b5fa95b5bf5ffd6b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 20 Apr 2023 13:52:13 +0100 Subject: Use a dedicated copy function to copy dsfs. Previously we were duplicating the contents of a dsf using straight-up memcpy. Now there's a dsf_copy function wrapping the same memcpy. For the moment, this still has to take a size parameter, because the size isn't stored inside the dsf itself. But once we make a proper data type, it will be. --- dsf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dsf.c') diff --git a/dsf.c b/dsf.c index f967ffb..06c4f9c 100644 --- a/dsf.c +++ b/dsf.c @@ -74,6 +74,11 @@ void dsf_init(int *dsf, int size) * bits are the number of elements in the tree. */ } +void dsf_copy(int *to, int *from, int size) +{ + memcpy(to, from, size * sizeof(int)); +} + int *snew_dsf(int size) { int *ret; -- cgit v1.1