diff options
| author | Paul Eggert | 2012-07-05 11:35:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-05 11:35:48 -0700 |
| commit | 38182d901d030c7d65f4aa7a49b583afb30eb9b7 (patch) | |
| tree | a69e1a571495d6ca1c034359d7c995639774ab9b /src/term.c | |
| parent | 6dd5a677dbf794eedaa8325c46d57ac041373361 (diff) | |
| download | emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.tar.gz emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.zip | |
More xmalloc and related cleanup.
* alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c:
* callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c:
* doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c:
* font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c:
* gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c:
* nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c:
* regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c:
* sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c:
* xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c:
* xterm.c:
Omit needless casts involving void * pointers and allocation.
Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))",
as the former is more robust if P's type is changed.
Prefer xzalloc to xmalloc + memset 0.
Simplify malloc-or-realloc to realloc.
Don't worry about xmalloc returning a null pointer.
Prefer xstrdup to xmalloc + strcpy.
* editfns.c (Fmessage_box): Grow message_text by at least 80 when
growing it.
* keyboard.c (apply_modifiers_uncached): Prefer local array to
alloca of a constant.
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/term.c b/src/term.c index ebf2f0b341e..5e48cbbfc64 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2858,13 +2858,11 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, | |||
| 2858 | void | 2858 | void |
| 2859 | create_tty_output (struct frame *f) | 2859 | create_tty_output (struct frame *f) |
| 2860 | { | 2860 | { |
| 2861 | struct tty_output *t; | 2861 | struct tty_output *t = xzalloc (sizeof *t); |
| 2862 | 2862 | ||
| 2863 | if (! FRAME_TERMCAP_P (f)) | 2863 | if (! FRAME_TERMCAP_P (f)) |
| 2864 | abort (); | 2864 | abort (); |
| 2865 | 2865 | ||
| 2866 | t = xzalloc (sizeof (struct tty_output)); | ||
| 2867 | |||
| 2868 | t->display_info = FRAME_TERMINAL (f)->display_info.tty; | 2866 | t->display_info = FRAME_TERMINAL (f)->display_info.tty; |
| 2869 | 2867 | ||
| 2870 | f->output_data.tty = t; | 2868 | f->output_data.tty = t; |
| @@ -3064,7 +3062,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 3064 | been_here = 1; | 3062 | been_here = 1; |
| 3065 | tty = &the_only_display_info; | 3063 | tty = &the_only_display_info; |
| 3066 | #else | 3064 | #else |
| 3067 | tty = xzalloc (sizeof (struct tty_display_info)); | 3065 | tty = xzalloc (sizeof *tty); |
| 3068 | #endif | 3066 | #endif |
| 3069 | tty->next = tty_list; | 3067 | tty->next = tty_list; |
| 3070 | tty_list = tty; | 3068 | tty_list = tty; |
| @@ -3073,7 +3071,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 3073 | terminal->display_info.tty = tty; | 3071 | terminal->display_info.tty = tty; |
| 3074 | tty->terminal = terminal; | 3072 | tty->terminal = terminal; |
| 3075 | 3073 | ||
| 3076 | tty->Wcm = xmalloc (sizeof (struct cm)); | 3074 | tty->Wcm = xmalloc (sizeof *tty->Wcm); |
| 3077 | Wcm_clear (tty); | 3075 | Wcm_clear (tty); |
| 3078 | 3076 | ||
| 3079 | encode_terminal_src_size = 0; | 3077 | encode_terminal_src_size = 0; |
| @@ -3343,7 +3341,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ | |||
| 3343 | tty->mouse_highlight.mouse_face_window = Qnil; | 3341 | tty->mouse_highlight.mouse_face_window = Qnil; |
| 3344 | #endif | 3342 | #endif |
| 3345 | 3343 | ||
| 3346 | terminal->kboard = xmalloc (sizeof (KBOARD)); | 3344 | terminal->kboard = xmalloc (sizeof *terminal->kboard); |
| 3347 | init_kboard (terminal->kboard); | 3345 | init_kboard (terminal->kboard); |
| 3348 | KVAR (terminal->kboard, Vwindow_system) = Qnil; | 3346 | KVAR (terminal->kboard, Vwindow_system) = Qnil; |
| 3349 | terminal->kboard->next_kboard = all_kboards; | 3347 | terminal->kboard->next_kboard = all_kboards; |