aboutsummaryrefslogtreecommitdiff
path: root/loopy.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-04-20 13:52:13 +0100
committerSimon Tatham <anakin@pobox.com>2023-04-20 17:21:54 +0100
commit11a8149d673d96bec17d6487b5fa95b5bf5ffd6b (patch)
tree8087f57805f3cc7f981bffcee9fecebd9e806610 /loopy.c
parentbb561ee3b18be69e52b17cedde50eac96ea409da (diff)
downloadpuzzles-11a8149d673d96bec17d6487b5fa95b5bf5ffd6b.zip
puzzles-11a8149d673d96bec17d6487b5fa95b5bf5ffd6b.tar.gz
puzzles-11a8149d673d96bec17d6487b5fa95b5bf5ffd6b.tar.bz2
puzzles-11a8149d673d96bec17d6487b5fa95b5bf5ffd6b.tar.xz
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.
Diffstat (limited to 'loopy.c')
-rw-r--r--loopy.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/loopy.c b/loopy.c
index 70e1106..f06596e 100644
--- a/loopy.c
+++ b/loopy.c
@@ -457,8 +457,7 @@ static solver_state *dup_solver_state(const solver_state *sstate) {
ret->dotdsf = snewn(num_dots, int);
ret->looplen = snewn(num_dots, int);
- memcpy(ret->dotdsf, sstate->dotdsf,
- num_dots * sizeof(int));
+ dsf_copy(ret->dotdsf, sstate->dotdsf, num_dots);
memcpy(ret->looplen, sstate->looplen,
num_dots * sizeof(int));
@@ -487,8 +486,7 @@ static solver_state *dup_solver_state(const solver_state *sstate) {
if (sstate->linedsf) {
ret->linedsf = snewn(num_edges, int);
- memcpy(ret->linedsf, sstate->linedsf,
- num_edges * sizeof(int));
+ dsf_copy(ret->linedsf, sstate->linedsf, num_edges);
} else {
ret->linedsf = NULL;
}