aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-05 10:32:41 +0400
committerDmitry Antipov2012-07-05 10:32:41 +0400
commit23f86fce48e1cc8118f0ea5cce49d1acfd4364c4 (patch)
tree837ae05f1ad4ad92936f804d580d95751779befe /src/term.c
parent0497dc44b44f148425ff76c4cb7ef0d2ead9750b (diff)
downloademacs-23f86fce48e1cc8118f0ea5cce49d1acfd4364c4.tar.gz
emacs-23f86fce48e1cc8118f0ea5cce49d1acfd4364c4.zip
Cleanup xmalloc.
* admin/coccinelle/xzalloc.cocci: Semantic patch to convert calls to xmalloc with following memset to xzalloc. * src/lisp.h (xzalloc): New prototype. Omit needless casts. * src/alloc.c (xzalloc): New function. Omit needless casts. * src/charset.c: Omit needless casts. Convert all calls to malloc with following memset to xzalloc. * src/dispnew.c: Likewise. * src/fringe.c: Likewise. * src/image.c: Likewise. * src/sound.c: Likewise. * src/term.c: Likewise. * src/w32fns.c: Likewise. * src/w32font.c: Likewise. * src/w32term.c: Likewise. * src/xfaces.c: Likewise. * src/xfns.c: Likewise. * src/xterm.c: Likewise. * src/atimer.c: Omit needless casts. * src/buffer.c: Likewise. * src/callproc.c: Likewise. * src/ccl.c: Likewise. * src/coding.c: Likewise. * src/composite.c: Likewise. * src/doc.c: Likewise. * src/doprnt.c: Likewise. * src/editfns.c: Likewise. * src/emacs.c: Likewise. * src/eval.c: Likewise. * src/filelock.c: Likewise. * src/fns.c: Likewise. * src/gtkutil.c: Likewise. * src/keyboard.c: Likewise. * src/lisp.h: Likewise. * src/lread.c: Likewise. * src/minibuf.c: Likewise. * src/msdos.c: Likewise. * src/print.c: Likewise. * src/process.c: Likewise. * src/region-cache.c: Likewise. * src/search.c: Likewise. * src/sysdep.c: Likewise. * src/termcap.c: Likewise. * src/terminal.c: Likewise. * src/tparam.c: Likewise. * src/w16select.c: Likewise. * src/w32.c: Likewise. * src/w32reg.c: Likewise. * src/w32select.c: Likewise. * src/w32uniscribe.c: Likewise. * src/widget.c: Likewise. * src/xdisp.c: Likewise. * src/xmenu.c: Likewise. * src/xrdb.c: Likewise. * src/xselect.c: Likewise.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/term.c b/src/term.c
index 128aaca20dd..ebf2f0b341e 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2863,8 +2863,7 @@ create_tty_output (struct frame *f)
2863 if (! FRAME_TERMCAP_P (f)) 2863 if (! FRAME_TERMCAP_P (f))
2864 abort (); 2864 abort ();
2865 2865
2866 t = xmalloc (sizeof (struct tty_output)); 2866 t = xzalloc (sizeof (struct tty_output));
2867 memset (t, 0, sizeof (struct tty_output));
2868 2867
2869 t->display_info = FRAME_TERMINAL (f)->display_info.tty; 2868 t->display_info = FRAME_TERMINAL (f)->display_info.tty;
2870 2869
@@ -3065,9 +3064,8 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3065 been_here = 1; 3064 been_here = 1;
3066 tty = &the_only_display_info; 3065 tty = &the_only_display_info;
3067#else 3066#else
3068 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); 3067 tty = xzalloc (sizeof (struct tty_display_info));
3069#endif 3068#endif
3070 memset (tty, 0, sizeof (struct tty_display_info));
3071 tty->next = tty_list; 3069 tty->next = tty_list;
3072 tty_list = tty; 3070 tty_list = tty;
3073 3071
@@ -3075,7 +3073,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3075 terminal->display_info.tty = tty; 3073 terminal->display_info.tty = tty;
3076 tty->terminal = terminal; 3074 tty->terminal = terminal;
3077 3075
3078 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); 3076 tty->Wcm = xmalloc (sizeof (struct cm));
3079 Wcm_clear (tty); 3077 Wcm_clear (tty);
3080 3078
3081 encode_terminal_src_size = 0; 3079 encode_terminal_src_size = 0;
@@ -3136,7 +3134,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3136 3134
3137 Wcm_clear (tty); 3135 Wcm_clear (tty);
3138 3136
3139 tty->termcap_term_buffer = (char *) xmalloc (buffer_size); 3137 tty->termcap_term_buffer = xmalloc (buffer_size);
3140 3138
3141 /* On some systems, tgetent tries to access the controlling 3139 /* On some systems, tgetent tries to access the controlling
3142 terminal. */ 3140 terminal. */
@@ -3177,7 +3175,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3177 abort (); 3175 abort ();
3178 buffer_size = strlen (tty->termcap_term_buffer); 3176 buffer_size = strlen (tty->termcap_term_buffer);
3179#endif 3177#endif
3180 tty->termcap_strings_buffer = area = (char *) xmalloc (buffer_size); 3178 tty->termcap_strings_buffer = area = xmalloc (buffer_size);
3181 tty->TS_ins_line = tgetstr ("al", address); 3179 tty->TS_ins_line = tgetstr ("al", address);
3182 tty->TS_ins_multi_lines = tgetstr ("AL", address); 3180 tty->TS_ins_multi_lines = tgetstr ("AL", address);
3183 tty->TS_bell = tgetstr ("bl", address); 3181 tty->TS_bell = tgetstr ("bl", address);
@@ -3345,7 +3343,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3345 tty->mouse_highlight.mouse_face_window = Qnil; 3343 tty->mouse_highlight.mouse_face_window = Qnil;
3346#endif 3344#endif
3347 3345
3348 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 3346 terminal->kboard = xmalloc (sizeof (KBOARD));
3349 init_kboard (terminal->kboard); 3347 init_kboard (terminal->kboard);
3350 KVAR (terminal->kboard, Vwindow_system) = Qnil; 3348 KVAR (terminal->kboard, Vwindow_system) = Qnil;
3351 terminal->kboard->next_kboard = all_kboards; 3349 terminal->kboard->next_kboard = all_kboards;