mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 15:41:30 -07:00
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:
6
loopy.c
6
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user