Remove all `enum'-typed variables from the Config structure.
[u/mdw/putty] / ldisc.c
diff --git a/ldisc.c b/ldisc.c
index c77b5c8..d569f11 100644 (file)
--- a/ldisc.c
+++ b/ldisc.c
 #include "terminal.h"
 #include "ldisc.h"
 
-#define ECHOING (ldisc->cfg->localecho == LD_YES || \
-                 (ldisc->cfg->localecho == LD_BACKEND && \
+#define ECHOING (ldisc->cfg->localecho == FORCE_ON || \
+                 (ldisc->cfg->localecho == AUTO && \
                       (ldisc->back->ldisc(ldisc->backhandle, LD_ECHO) || \
                           term_ldisc(ldisc->term, LD_ECHO))))
-#define EDITING (ldisc->cfg->localedit == LD_YES || \
-                 (ldisc->cfg->localedit == LD_BACKEND && \
+#define EDITING (ldisc->cfg->localedit == FORCE_ON || \
+                 (ldisc->cfg->localedit == AUTO && \
                       (ldisc->back->ldisc(ldisc->backhandle, LD_EDIT) || \
                           term_ldisc(ldisc->term, LD_EDIT))))
 
@@ -87,6 +87,19 @@ void *ldisc_create(Config *mycfg, Terminal *term,
     return ldisc;
 }
 
+void ldisc_free(void *handle)
+{
+    Ldisc ldisc = (Ldisc) handle;
+
+    if (ldisc->term)
+       ldisc->term->ldisc = NULL;
+    if (ldisc->back)
+       ldisc->back->provide_ldisc(ldisc->backhandle, NULL);
+    if (ldisc->buf)
+       sfree(ldisc->buf);
+    sfree(ldisc);
+}
+
 void ldisc_send(void *handle, char *buf, int len, int interactive)
 {
     Ldisc ldisc = (Ldisc) handle;