emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113881: * term.c (get_named_tty, create_tty_output,


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r113881: * term.c (get_named_tty, create_tty_output, tty_free_frame_resources)
Date: Thu, 15 Aug 2013 05:26:20 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113881
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2013-08-15 09:23:40 +0400
message:
  * 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/image.c                    image.c-20091113204419-o5vbwnq5f7feedwu-2969
  src/term.c                     term.c-20091113204419-o5vbwnq5f7feedwu-220
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-14 19:09:51 +0000
+++ b/src/ChangeLog     2013-08-15 05:23:40 +0000
@@ -1,3 +1,12 @@
+2013-08-15  Dmitry Antipov  <address@hidden>
+
+       * 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  <address@hidden>
 
        * gmalloc.c (memalign) [CYGWIN]: Rename to emacs_memalign

=== modified file 'src/image.c'
--- a/src/image.c       2013-08-14 16:36:16 +0000
+++ b/src/image.c       2013-08-15 05:23:40 +0000
@@ -1360,14 +1360,12 @@
 struct image_cache *
 make_image_cache (void)
 {
-  struct image_cache *c = xzalloc (sizeof *c);
-  int size;
+  struct image_cache *c = xmalloc (sizeof *c);
 
-  size = 50;
-  c->images = xmalloc (size * sizeof *c->images);
-  c->size = size;
-  size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
-  c->buckets = xzalloc (size);
+  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;
 }
 

=== modified file 'src/term.c'
--- a/src/term.c        2013-08-03 03:29:03 +0000
+++ b/src/term.c        2013-08-15 05:23:40 +0000
@@ -2233,8 +2233,7 @@
 {
   struct terminal *t;
 
-  if (!name)
-    emacs_abort ();
+  eassert (name);
 
   for (t = terminal_list; t; t = t->next_terminal)
     {
@@ -2786,8 +2785,7 @@
 {
   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;
 
@@ -2799,8 +2797,7 @@
 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);
@@ -2815,8 +2812,7 @@
 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);
@@ -3443,8 +3439,7 @@
   if (!terminal->name)
     return;
 
-  if (terminal->type != output_termcap)
-    emacs_abort ();
+  eassert (terminal->type == output_termcap);
 
   tty = terminal->display_info.tty;
 

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-08-14 16:36:16 +0000
+++ b/src/xterm.c       2013-08-15 05:23:40 +0000
@@ -10080,33 +10080,15 @@
   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,
@@ -10267,14 +10249,9 @@
   }
 
   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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]