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.
This commit is contained in:
Simon Tatham
2023-04-20 13:52:13 +01:00
parent bb561ee3b1
commit 11a8149d67
5 changed files with 14 additions and 9 deletions

5
dsf.c
View File

@ -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;