mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Fix a memory management bug in Filling: in some situations its
solve_game() was returning its aux parameter un-dupstr()ed, which is wrong. Also clarified the developer docs on that function to make it clearer that the returned string should be dynamic. [originally from svn r9831]
This commit is contained in:
@ -1020,9 +1020,11 @@ it may return \cw{NULL}. If it does this, it must also set
|
|||||||
\q{Solution not known for this puzzle}); that error message is not
|
\q{Solution not known for this puzzle}); that error message is not
|
||||||
expected to be dynamically allocated.
|
expected to be dynamically allocated.
|
||||||
|
|
||||||
If this function \e{does} produce a solution, it returns a move
|
If this function \e{does} produce a solution, it returns a move string
|
||||||
string suitable for feeding to \cw{execute_move()}
|
suitable for feeding to \cw{execute_move()}
|
||||||
(\k{backend-execute-move}).
|
(\k{backend-execute-move}). Like a (non-empty) string returned from
|
||||||
|
\cw{interpret_move()}, the returned string should be dynamically
|
||||||
|
allocated.
|
||||||
|
|
||||||
\H{backend-drawing} Drawing the game graphics
|
\H{backend-drawing} Drawing the game graphics
|
||||||
|
|
||||||
|
@ -975,7 +975,7 @@ static char *solve_game(game_state *state, game_state *currstate,
|
|||||||
if (!solver(state->board, w, h, &aux))
|
if (!solver(state->board, w, h, &aux))
|
||||||
*error = "Sorry, I couldn't find a solution";
|
*error = "Sorry, I couldn't find a solution";
|
||||||
}
|
}
|
||||||
return aux;
|
return dupstr(aux);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
Reference in New Issue
Block a user