mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-05 21:42:47 -05:00
Move echo/edit state change functionality out of ldisc_send.
I'm not actually sure why we've always had back ends notify ldisc of changes to echo/edit settings by giving ldisc_send(ldisc,NULL,0,0) a special meaning, instead of by having a separate dedicated notify function with its own prototype and parameter set. Coverity's recent observation that the two kinds of call don't even have the same requirements on the ldisc (particularly, whether ldisc->term can be NULL) makes me realise that it's really high time I separated the two conceptually different operations into actually different functions. While I'm here, I've renamed the confusing ldisc_update() function which that special operation ends up feeding to, because it's not actually a function applying to an ldisc - it applies to a front end. So ldisc_send(ldisc,NULL,0,0) is now ldisc_echoedit_update(ldisc), and that in turn figures out the current echo/edit settings before passing them on to frontend_echoedit_update(). I think that should be clearer.
This commit is contained in:
23
ldisc.c
23
ldisc.c
@ -128,28 +128,19 @@ void ldisc_free(void *handle)
|
||||
sfree(ldisc);
|
||||
}
|
||||
|
||||
void ldisc_echoedit_update(void *handle)
|
||||
{
|
||||
Ldisc ldisc = (Ldisc) handle;
|
||||
frontend_echoedit_update(ldisc->frontend, ECHOING, EDITING);
|
||||
}
|
||||
|
||||
void ldisc_send(void *handle, char *buf, int len, int interactive)
|
||||
{
|
||||
Ldisc ldisc = (Ldisc) handle;
|
||||
int keyflag = 0;
|
||||
/*
|
||||
* Called with len=0 when the options change. We must inform
|
||||
* the front end in case it needs to know.
|
||||
*/
|
||||
if (len == 0) {
|
||||
ldisc_update(ldisc->frontend, ECHOING, EDITING);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If that wasn't true, then we expect ldisc->term to be non-NULL
|
||||
* hereafter. (The only front ends which have an ldisc but no term
|
||||
* are those which do networking but no terminal emulation, in
|
||||
* which case they need the above if statement to handle
|
||||
* ldisc_updates passed from the back ends, but should never send
|
||||
* any actual input through this function.)
|
||||
*/
|
||||
assert(ldisc->term);
|
||||
assert(len);
|
||||
|
||||
/*
|
||||
* Notify the front end that something was pressed, in case
|
||||
|
Reference in New Issue
Block a user