aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/term.c b/src/term.c
index fb69aefbe7a..aa61fde06ee 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2233,8 +2233,7 @@ get_named_tty (const char *name)
2233{ 2233{
2234 struct terminal *t; 2234 struct terminal *t;
2235 2235
2236 if (!name) 2236 eassert (name);
2237 emacs_abort ();
2238 2237
2239 for (t = terminal_list; t; t = t->next_terminal) 2238 for (t = terminal_list; t; t = t->next_terminal)
2240 { 2239 {
@@ -2786,8 +2785,7 @@ create_tty_output (struct frame *f)
2786{ 2785{
2787 struct tty_output *t = xzalloc (sizeof *t); 2786 struct tty_output *t = xzalloc (sizeof *t);
2788 2787
2789 if (! FRAME_TERMCAP_P (f)) 2788 eassert (FRAME_TERMCAP_P (f));
2790 emacs_abort ();
2791 2789
2792 t->display_info = FRAME_TERMINAL (f)->display_info.tty; 2790 t->display_info = FRAME_TERMINAL (f)->display_info.tty;
2793 2791
@@ -2799,8 +2797,7 @@ create_tty_output (struct frame *f)
2799static void 2797static void
2800tty_free_frame_resources (struct frame *f) 2798tty_free_frame_resources (struct frame *f)
2801{ 2799{
2802 if (! FRAME_TERMCAP_P (f)) 2800 eassert (FRAME_TERMCAP_P (f));
2803 emacs_abort ();
2804 2801
2805 if (FRAME_FACE_CACHE (f)) 2802 if (FRAME_FACE_CACHE (f))
2806 free_frame_faces (f); 2803 free_frame_faces (f);
@@ -2815,8 +2812,7 @@ tty_free_frame_resources (struct frame *f)
2815static void 2812static void
2816tty_free_frame_resources (struct frame *f) 2813tty_free_frame_resources (struct frame *f)
2817{ 2814{
2818 if (! FRAME_TERMCAP_P (f) && ! FRAME_MSDOS_P (f)) 2815 eassert (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f));
2819 emacs_abort ();
2820 2816
2821 if (FRAME_FACE_CACHE (f)) 2817 if (FRAME_FACE_CACHE (f))
2822 free_frame_faces (f); 2818 free_frame_faces (f);
@@ -2938,9 +2934,12 @@ dissociate_if_controlling_tty (int fd)
2938struct terminal * 2934struct terminal *
2939init_tty (const char *name, const char *terminal_type, bool must_succeed) 2935init_tty (const char *name, const char *terminal_type, bool must_succeed)
2940{ 2936{
2941 char *area = NULL; 2937#ifdef TERMINFO
2938 char **address = 0;
2939#else
2940 char *area;
2942 char **address = &area; 2941 char **address = &area;
2943 int buffer_size = 4096; 2942#endif
2944 int status; 2943 int status;
2945 struct tty_display_info *tty = NULL; 2944 struct tty_display_info *tty = NULL;
2946 struct terminal *terminal = NULL; 2945 struct terminal *terminal = NULL;
@@ -3028,12 +3027,16 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
3028 3027
3029 Wcm_clear (tty); 3028 Wcm_clear (tty);
3030 3029
3031 tty->termcap_term_buffer = xmalloc (buffer_size);
3032
3033 /* On some systems, tgetent tries to access the controlling 3030 /* On some systems, tgetent tries to access the controlling
3034 terminal. */ 3031 terminal. */
3035 block_tty_out_signal (); 3032 block_tty_out_signal ();
3033#ifdef TERMINFO
3034 status = tgetent (0, terminal_type);
3035#else
3036 status = tgetent (tty->termcap_term_buffer, terminal_type); 3036 status = tgetent (tty->termcap_term_buffer, terminal_type);
3037 if (tty->termcap_term_buffer[TERMCAP_BUFFER_SIZE - 1])
3038 emacs_abort ();
3039#endif
3037 unblock_tty_out_signal (); 3040 unblock_tty_out_signal ();
3038 3041
3039 if (status < 0) 3042 if (status < 0)
@@ -3065,11 +3068,8 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3065 } 3068 }
3066 3069
3067#ifndef TERMINFO 3070#ifndef TERMINFO
3068 if (strlen (tty->termcap_term_buffer) >= buffer_size) 3071 area = tty->termcap_strings_buffer;
3069 emacs_abort ();
3070 buffer_size = strlen (tty->termcap_term_buffer);
3071#endif 3072#endif
3072 tty->termcap_strings_buffer = area = xmalloc (buffer_size);
3073 tty->TS_ins_line = tgetstr ("al", address); 3073 tty->TS_ins_line = tgetstr ("al", address);
3074 tty->TS_ins_multi_lines = tgetstr ("AL", address); 3074 tty->TS_ins_multi_lines = tgetstr ("AL", address);
3075 tty->TS_bell = tgetstr ("bl", address); 3075 tty->TS_bell = tgetstr ("bl", address);
@@ -3443,8 +3443,7 @@ delete_tty (struct terminal *terminal)
3443 if (!terminal->name) 3443 if (!terminal->name)
3444 return; 3444 return;
3445 3445
3446 if (terminal->type != output_termcap) 3446 eassert (terminal->type == output_termcap);
3447 emacs_abort ();
3448 3447
3449 tty = terminal->display_info.tty; 3448 tty = terminal->display_info.tty;
3450 3449
@@ -3486,9 +3485,6 @@ delete_tty (struct terminal *terminal)
3486 3485
3487 xfree (tty->old_tty); 3486 xfree (tty->old_tty);
3488 xfree (tty->Wcm); 3487 xfree (tty->Wcm);
3489 xfree (tty->termcap_strings_buffer);
3490 xfree (tty->termcap_term_buffer);
3491
3492 xfree (tty); 3488 xfree (tty);
3493} 3489}
3494 3490