summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-07-05 10:32:41 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-07-05 10:32:41 +0400
commit23f86fce48e1cc8118f0ea5cce49d1acfd4364c4 (patch)
tree837ae05f1ad4ad92936f804d580d95751779befe /src/term.c
parent0497dc44b44f148425ff76c4cb7ef0d2ead9750b (diff)
downloademacs-23f86fce48e1cc8118f0ea5cce49d1acfd4364c4.tar.gz
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)
if (! FRAME_TERMCAP_P (f))
abort ();
- t = xmalloc (sizeof (struct tty_output));
- memset (t, 0, sizeof (struct tty_output));
+ t = xzalloc (sizeof (struct tty_output));
t->display_info = FRAME_TERMINAL (f)->display_info.tty;
@@ -3065,9 +3064,8 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
been_here = 1;
tty = &the_only_display_info;
#else
- tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
+ tty = xzalloc (sizeof (struct tty_display_info));
#endif
- memset (tty, 0, sizeof (struct tty_display_info));
tty->next = tty_list;
tty_list = tty;
@@ -3075,7 +3073,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
terminal->display_info.tty = tty;
tty->terminal = terminal;
- tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
+ tty->Wcm = xmalloc (sizeof (struct cm));
Wcm_clear (tty);
encode_terminal_src_size = 0;
@@ -3136,7 +3134,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
Wcm_clear (tty);
- tty->termcap_term_buffer = (char *) xmalloc (buffer_size);
+ tty->termcap_term_buffer = xmalloc (buffer_size);
/* On some systems, tgetent tries to access the controlling
terminal. */
@@ -3177,7 +3175,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
abort ();
buffer_size = strlen (tty->termcap_term_buffer);
#endif
- tty->termcap_strings_buffer = area = (char *) xmalloc (buffer_size);
+ tty->termcap_strings_buffer = area = xmalloc (buffer_size);
tty->TS_ins_line = tgetstr ("al", address);
tty->TS_ins_multi_lines = tgetstr ("AL", address);
tty->TS_bell = tgetstr ("bl", address);
@@ -3345,7 +3343,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
tty->mouse_highlight.mouse_face_window = Qnil;
#endif
- terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+ terminal->kboard = xmalloc (sizeof (KBOARD));
init_kboard (terminal->kboard);
KVAR (terminal->kboard, Vwindow_system) = Qnil;
terminal->kboard->next_kboard = all_kboards;