+2013-08-15 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * term.c (get_named_tty, create_tty_output, tty_free_frame_resources)
+ (tty_free_frame_resources, delete_tty): Prefer eassert to emacs_abort.
+ * image.c (make_image_cache): For struct image_cache, prefer xmalloc
+ to xzalloc and so avoid redundant call to memset.
+ * xterm.c (x_term_init): Avoid unnecessary initializations of dpyinfo
+ members because it is allocated with xzalloc and so already zeroed.
+
2013-08-14 Ken Brown <kbrown@cornell.edu>
* gmalloc.c (memalign) [CYGWIN]: Rename to emacs_memalign
struct image_cache *
make_image_cache (void)
{
- struct image_cache *c = xzalloc (sizeof *c);
- int size;
-
- size = 50;
- c->images = xmalloc (size * sizeof *c->images);
- c->size = size;
- size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
- c->buckets = xzalloc (size);
+ struct image_cache *c = xmalloc (sizeof *c);
+
+ c->size = 50;
+ c->used = c->refcount = 0;
+ c->images = xmalloc (c->size * sizeof *c->images);
+ c->buckets = xzalloc (IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets);
return c;
}
{
struct terminal *t;
- if (!name)
- emacs_abort ();
+ eassert (name);
for (t = terminal_list; t; t = t->next_terminal)
{
{
struct tty_output *t = xzalloc (sizeof *t);
- if (! FRAME_TERMCAP_P (f))
- emacs_abort ();
+ eassert (FRAME_TERMCAP_P (f));
t->display_info = FRAME_TERMINAL (f)->display_info.tty;
static void
tty_free_frame_resources (struct frame *f)
{
- if (! FRAME_TERMCAP_P (f))
- emacs_abort ();
+ eassert (FRAME_TERMCAP_P (f));
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
static void
tty_free_frame_resources (struct frame *f)
{
- if (! FRAME_TERMCAP_P (f) && ! FRAME_MSDOS_P (f))
- emacs_abort ();
+ eassert (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f));
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
if (!terminal->name)
return;
- if (terminal->type != output_termcap)
- emacs_abort ();
+ eassert (terminal->type == output_termcap);
tty = terminal->display_info.tty;
select_visual (dpyinfo);
dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen);
dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen);
- dpyinfo->client_leader_window = 0;
- dpyinfo->grabbed = 0;
- dpyinfo->reference_count = 0;
dpyinfo->icon_bitmap_id = -1;
- dpyinfo->n_fonts = 0;
- dpyinfo->bitmaps = 0;
- dpyinfo->bitmaps_size = 0;
- dpyinfo->bitmaps_last = 0;
- dpyinfo->scratch_cursor_gc = 0;
- hlinfo->mouse_face_mouse_frame = 0;
hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
hlinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_overlay = Qnil;
- hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
- hlinfo->mouse_face_defer = 0;
- hlinfo->mouse_face_hidden = 0;
- dpyinfo->x_focus_frame = 0;
- dpyinfo->x_focus_event_frame = 0;
- dpyinfo->x_highlight_frame = 0;
dpyinfo->wm_type = X_WMTYPE_UNKNOWN;
/* See if we can construct pixel values from RGB values. */
- dpyinfo->red_bits = dpyinfo->blue_bits = dpyinfo->green_bits = 0;
- dpyinfo->red_offset = dpyinfo->blue_offset = dpyinfo->green_offset = 0;
-
if (dpyinfo->visual->class == TrueColor)
{
get_bits_and_offset (dpyinfo->visual->red_mask,
}
dpyinfo->x_dnd_atoms_size = 8;
- dpyinfo->x_dnd_atoms_length = 0;
dpyinfo->x_dnd_atoms = xmalloc (sizeof *dpyinfo->x_dnd_atoms
* dpyinfo->x_dnd_atoms_size);
- dpyinfo->net_supported_atoms = NULL;
- dpyinfo->nr_net_supported_atoms = 0;
- dpyinfo->net_supported_window = 0;
-
connection = ConnectionNumber (dpyinfo->display);
dpyinfo->connection = connection;
dpyinfo->gray