1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-09 15:23:50 -05:00

Introduce a typedef for frontend handles.

This is another major source of unexplained 'void *' parameters
throughout the code.

In particular, the currently unused testback.c actually gave the wrong
pointer type to its internal store of the frontend handle - it cast
the input void * to a Terminal *, from which it got implicitly cast
back again when calling from_backend, and nobody noticed. Now it uses
the right type internally as well as externally.
This commit is contained in:
Simon Tatham
2018-09-12 09:10:51 +01:00
parent eefebaaa9e
commit 8dfb2a1186
40 changed files with 357 additions and 406 deletions

View File

@ -17,13 +17,13 @@ struct callback {
struct callback *cbcurr = NULL, *cbhead = NULL, *cbtail = NULL;
toplevel_callback_notify_fn_t notify_frontend = NULL;
void *frontend = NULL;
void *notify_ctx = NULL;
void request_callback_notifications(toplevel_callback_notify_fn_t fn,
void *fr)
void *ctx)
{
notify_frontend = fn;
frontend = fr;
notify_ctx = ctx;
}
static void run_idempotent_callback(void *ctx)
@ -87,7 +87,7 @@ void queue_toplevel_callback(toplevel_callback_fn_t fn, void *ctx)
* callback keeps re-scheduling itself.
*/
if (notify_frontend && !cbhead && !cbcurr)
notify_frontend(frontend);
notify_frontend(notify_ctx);
if (cbtail)
cbtail->next = cb;