emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103435: Merge: Minor cleanups uncove


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103435: Merge: Minor cleanups uncovered by gcc warnings
Date: Sat, 26 Feb 2011 23:57:49 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103435 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2011-02-26 23:57:49 -0800
message:
  Merge: Minor cleanups uncovered by gcc warnings
modified:
  src/ChangeLog
  src/dispextern.h
  src/dispnew.c
  src/frame.c
  src/frame.h
  src/msdos.c
  src/scroll.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-02-26 12:55:10 +0000
+++ b/src/ChangeLog     2011-02-27 07:50:33 +0000
@@ -1,3 +1,36 @@
+2011-02-27  Paul Eggert  <address@hidden>
+
+       * scroll.c (CHECK_BOUNDS): #define only if GLYPH_DEBUG.
+       This avoids a gcc warning in some configurations.
+
+       * frame.c (x_set_screen_gamma): Rename local to avoid shadowing.
+
+       * frame.h: Avoid gcc -Wmissing-prototypes diagnostics.
+       (set_menu_bar_lines, x_get_resource_string): New decls.
+       * msdos.c (set_menu_bar_lines): Omit decl.
+
+       * dispextern.h (struct glyph): Make u.img_id int, not unsigned.
+       It's always given int values and used as an int.  This suppresses
+       a gcc "comparison of unsigned expression >= 0" warning in some
+       configurations.
+
+       * dispnew.c: Rename locals to avoid shadowing.
+       (update_text_area, scrolling_window, update_frame_1): Rename locals.
+
+2011-02-26  Paul Eggert  <address@hidden>
+
+       * dispnew.c: Fix problems uncovered by gcc -Wstrict-prototypes.
+       (copy_glyph_row_contents): Remove; not used.
+       (frame_row_to_window, check_current_matrix_flags):
+       (window_change_signal): Now static, since they're not used elsewhere.
+       (check_current_matrix_flags): Surround with "#if 0", since its
+       only use is in a comment.  Maybe both the comment and the "#if 0"
+       stuff should be removed?
+
+       * dispnew.c: Fix problem uncovered by gcc -Wunused-variable.
+       (adjust_frame_glyphs_for_window_redisplay): Make 'w' local to the
+       contexts that actually need it.
+
 2011-02-26  Eli Zaretskii  <address@hidden>
 
        * s/msdos.h (HAVE_LSTAT): Define for DJGPP >= 2.04.

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2011-02-16 15:02:50 +0000
+++ b/src/dispextern.h  2011-02-27 02:41:48 +0000
@@ -431,7 +431,7 @@
     } cmp;
 
     /* Image ID for image glyphs (type == IMAGE_GLYPH).  */
-    unsigned img_id;
+    int img_id;
 
     /* Sub-structure for type == STRETCH_GLYPH.  */
     struct

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2011-02-16 15:02:50 +0000
+++ b/src/dispnew.c     2011-02-27 00:48:14 +0000
@@ -1129,32 +1129,6 @@
 }
 
 
-/* Copy contents of glyph row FROM to glyph row TO.  Glyph pointers in
-   TO and FROM are left unchanged.  Glyph contents are copied from the
-   glyph memory of FROM to the glyph memory of TO.  Increment buffer
-   positions in row TO by DELTA/ DELTA_BYTES.  */
-
-void
-copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from,
-                        EMACS_INT delta, EMACS_INT delta_bytes)
-{
-  int area;
-
-  /* This is like a structure assignment TO = FROM, except that
-     glyph pointers in the rows are left unchanged.  */
-  copy_row_except_pointers (to, from);
-
-  /* Copy glyphs from FROM to TO.  */
-  for (area = 0; area < LAST_AREA; ++area)
-    if (from->used[area])
-      memcpy (to->glyphs[area], from->glyphs[area],
-             from->used[area] * sizeof (struct glyph));
-
-  /* Increment buffer positions in TO by DELTA.  */
-  increment_row_positions (to, delta, delta_bytes);
-}
-
-
 /* Assign glyph row FROM to glyph row TO.  This works like a structure
    assignment TO = FROM, except that glyph pointers are not copied but
    exchanged between TO and FROM.  Pointers must be exchanged to avoid
@@ -2223,8 +2197,6 @@
 static void
 adjust_frame_glyphs_for_window_redisplay (struct frame *f)
 {
-  struct window *w;
-
   xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));
 
   /* Allocate/reallocate window matrices.  */
@@ -2236,6 +2208,7 @@
 #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
   {
     /* Allocate a dummy window if not already done.  */
+    struct window *w;
     if (NILP (f->menu_bar_window))
       {
        f->menu_bar_window = make_window ();
@@ -2258,23 +2231,26 @@
 #endif /* HAVE_X_WINDOWS */
 
 #ifndef USE_GTK
-  /* Allocate/ reallocate matrices of the tool bar window.  If we
-     don't have a tool bar window yet, make one.  */
-  if (NILP (f->tool_bar_window))
-    {
-      f->tool_bar_window = make_window ();
+  {
+    /* Allocate/ reallocate matrices of the tool bar window.  If we
+       don't have a tool bar window yet, make one.  */
+    struct window *w;
+    if (NILP (f->tool_bar_window))
+      {
+       f->tool_bar_window = make_window ();
+       w = XWINDOW (f->tool_bar_window);
+       XSETFRAME (w->frame, f);
+       w->pseudo_window_p = 1;
+      }
+    else
       w = XWINDOW (f->tool_bar_window);
-      XSETFRAME (w->frame, f);
-      w->pseudo_window_p = 1;
-    }
-  else
-    w = XWINDOW (f->tool_bar_window);
 
-  XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f));
-  XSETFASTINT (w->left_col, 0);
-  XSETFASTINT (w->total_lines, FRAME_TOOL_BAR_LINES (f));
-  XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f));
-  allocate_matrices_for_window_redisplay (w);
+    XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f));
+    XSETFASTINT (w->left_col, 0);
+    XSETFASTINT (w->total_lines, FRAME_TOOL_BAR_LINES (f));
+    XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f));
+    allocate_matrices_for_window_redisplay (w);
+  }
 #endif
 }
 
@@ -2924,7 +2900,7 @@
 /* Return the window in the window tree rooted in W containing frame
    row ROW.  Value is null if none is found.  */
 
-struct window *
+static struct window *
 frame_row_to_window (struct window *w, int row)
 {
   struct window *found = NULL;
@@ -3562,12 +3538,12 @@
 #endif /* HAVE_WINDOW_SYSTEM */
 
 
-#ifdef GLYPH_DEBUG
+#if defined GLYPH_DEBUG && 0
 
 /* Check that no row in the current matrix of window W is enabled
    which is below what's displayed in the window.  */
 
-void
+static void
 check_current_matrix_flags (struct window *w)
 {
   int last_seen_p = 0;
@@ -4014,7 +3990,7 @@
        {
          /* Otherwise clear to the end of the old row.  Everything
             after that position should be clear already.  */
-         int x;
+         int xlim;
 
          if (i >= desired_row->used[TEXT_AREA])
            rif->cursor_to (vpos, i, desired_row->y,
@@ -4031,11 +4007,11 @@
                  : (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])))
            {
              w->phys_cursor_on_p = 0;
-             x = -1;
+             xlim = -1;
            }
          else
-           x = current_row->pixel_width;
-         rif->clear_end_of_line (x);
+           xlim = current_row->pixel_width;
+         rif->clear_end_of_line (xlim);
          changed_p = 1;
        }
     }
@@ -4491,7 +4467,7 @@
        && old_lines[i]->old_uses == 1
         && old_lines[i]->new_uses == 1)
       {
-       int j, k;
+       int p, q;
        int new_line = old_lines[i]->new_line_number;
        struct run *run = run_pool + run_idx++;
 
@@ -4504,33 +4480,33 @@
        run->height = MATRIX_ROW (current_matrix, i)->height;
 
        /* Extend backward.  */
-       j = i - 1;
-       k = new_line - 1;
-       while (j > first_old
-              && k > first_new
-              && old_lines[j] == new_lines[k])
+       p = i - 1;
+       q = new_line - 1;
+       while (p > first_old
+              && q > first_new
+              && old_lines[p] == new_lines[q])
          {
-           int h = MATRIX_ROW (current_matrix, j)->height;
+           int h = MATRIX_ROW (current_matrix, p)->height;
            --run->current_vpos;
            --run->desired_vpos;
            ++run->nrows;
            run->height += h;
            run->desired_y -= h;
            run->current_y -= h;
-           --j, --k;
+           --p, --q;
          }
 
        /* Extend forward.  */
-       j = i + 1;
-       k = new_line + 1;
-       while (j < last_old
-              && k < last_new
-              && old_lines[j] == new_lines[k])
+       p = i + 1;
+       q = new_line + 1;
+       while (p < last_old
+              && q < last_new
+              && old_lines[p] == new_lines[q])
          {
-           int h = MATRIX_ROW (current_matrix, j)->height;
+           int h = MATRIX_ROW (current_matrix, p)->height;
            ++run->nrows;
            run->height += h;
-           ++j, ++k;
+           ++p, ++q;
          }
 
        /* Insert run into list of all runs.  Order runs by copied
@@ -4538,11 +4514,11 @@
           be copied because they are already in place.  This is done
           because we can avoid calling update_window_line in this
           case.  */
-       for (j = 0; j < nruns && runs[j]->height > run->height; ++j)
+       for (p = 0; p < nruns && runs[p]->height > run->height; ++p)
          ;
-       for (k = nruns; k > j; --k)
-         runs[k] = runs[k - 1];
-       runs[j] = run;
+       for (q = nruns; q > p; --q)
+         runs[q] = runs[q - 1];
+       runs[p] = run;
        ++nruns;
 
        i += run->nrows;
@@ -4639,7 +4615,7 @@
   struct glyph_matrix *current_matrix = f->current_matrix;
   struct glyph_matrix *desired_matrix = f->desired_matrix;
   int i;
-  int pause;
+  int pause_p;
   int preempt_count = baud_rate / 2400 + 1;
 
   xassert (current_matrix && desired_matrix);
@@ -4653,7 +4629,7 @@
 #if !PERIODIC_PREEMPTION_CHECKING
   if (!force_p && detect_input_pending_ignore_squeezables ())
     {
-      pause = 1;
+      pause_p = 1;
       goto do_pause;
     }
 #endif
@@ -4733,10 +4709,10 @@
        }
     }
 
-  pause = (i < FRAME_LINES (f) - 1) ? i : 0;
+  pause_p = (i < FRAME_LINES (f) - 1) ? i : 0;
 
   /* Now just clean up termcap drivers and set cursor, etc.  */
-  if (!pause)
+  if (!pause_p)
     {
       if ((cursor_in_echo_area
           /* If we are showing a message instead of the mini-buffer,
@@ -4837,7 +4813,7 @@
 #endif
 
   clear_desired_matrices (f);
-  return pause;
+  return pause_p;
 }
 
 
@@ -5594,7 +5570,7 @@
 
 #ifdef SIGWINCH
 
-SIGTYPE
+static SIGTYPE
 window_change_signal (int signalnum) /* If we don't have an argument, */
                                /* some compilers complain in signal calls.  */
 {

=== modified file 'src/frame.c'
--- a/src/frame.c       2011-02-16 16:35:16 +0000
+++ b/src/frame.c       2011-02-27 07:47:34 +0000
@@ -3275,12 +3275,12 @@
   bgcolor = Fassq (Qbackground_color, f->param_alist);
   if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
     {
-      Lisp_Object index = Fget (Qbackground_color, Qx_frame_parameter);
-      if (NATNUMP (index)
-         && (XFASTINT (index)
+      Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter);
+      if (NATNUMP (parm_index)
+         && (XFASTINT (parm_index)
              < sizeof (frame_parms)/sizeof (frame_parms[0]))
-         && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)])
-         (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)])
+         && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
+         (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
            (f, bgcolor, Qnil);
     }
 

=== modified file 'src/frame.h'
--- a/src/frame.h       2011-01-25 04:08:28 +0000
+++ b/src/frame.h       2011-02-27 07:30:02 +0000
@@ -841,6 +841,7 @@
 
 extern struct frame *last_nonminibuf_frame;
 
+extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
 extern struct frame *make_initial_frame (void);
 extern struct frame *make_terminal_frame (struct terminal *);
 extern struct frame *make_frame (int);
@@ -1131,17 +1132,20 @@
 extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
 
 extern void validate_x_resource_name (void);
-                                           
+
 extern Lisp_Object display_x_get_resource (Display_Info *,
                                           Lisp_Object attribute,
                                           Lisp_Object class,
                                           Lisp_Object component,
                                           Lisp_Object subclass);
 
+#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
+extern char *x_get_resource_string (const char *, const char *);
+#endif
+
 /* In xmenu.c */
 extern void set_frame_menubar (FRAME_PTR, int, int);
 
 #endif /* HAVE_WINDOW_SYSTEM */
 
 #endif /* not EMACS_FRAME_H */
-

=== modified file 'src/msdos.c'
--- a/src/msdos.c       2011-02-16 19:09:20 +0000
+++ b/src/msdos.c       2011-02-27 07:30:02 +0000
@@ -1389,8 +1389,6 @@
 void
 x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
-  extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
-
   set_menu_bar_lines (f, value, oldval);
 }
 
@@ -4236,4 +4234,3 @@
 }
 
 #endif /* MSDOS */
-

=== modified file 'src/scroll.c'
--- a/src/scroll.c      2011-01-26 08:36:39 +0000
+++ b/src/scroll.c      2011-02-27 07:50:33 +0000
@@ -262,7 +262,8 @@
   for (k = 0; k < window_size; ++k)
     copy_from[k] = -1;
 
-#define CHECK_BOUNDS                                                   \
+#if GLYPH_DEBUG
+# define CHECK_BOUNDS                                                  \
   do                                                                   \
     {                                                                  \
       int k;                                                           \
@@ -271,6 +272,7 @@
                 || (copy_from[k] >= 0 && copy_from[k] < window_size)); \
     }                                                                  \
   while (0);
+#endif
 
   /* When j is advanced, this corresponds to deleted lines.
      When i is advanced, this corresponds to inserted lines.  */
@@ -1035,4 +1037,3 @@
                 FRAME_DELETE_COST (frame), FRAME_DELETEN_COST (frame),
                 coefficient);
 }
-


reply via email to

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