Commit a4d4252b authored by Paul Eggert's avatar Paul Eggert

Merge: Minor cleanups uncovered by gcc warnings

parents 1f0816b6 c783d15b
2011-02-27 Paul Eggert <eggert@cs.ucla.edu>
* 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 <eggert@cs.ucla.edu>
* 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 <eliz@gnu.org> 2011-02-26 Eli Zaretskii <eliz@gnu.org>
* s/msdos.h (HAVE_LSTAT): Define for DJGPP >= 2.04. * s/msdos.h (HAVE_LSTAT): Define for DJGPP >= 2.04.
...@@ -431,7 +431,7 @@ struct glyph ...@@ -431,7 +431,7 @@ struct glyph
} cmp; } cmp;
/* Image ID for image glyphs (type == IMAGE_GLYPH). */ /* Image ID for image glyphs (type == IMAGE_GLYPH). */
unsigned img_id; int img_id;
/* Sub-structure for type == STRETCH_GLYPH. */ /* Sub-structure for type == STRETCH_GLYPH. */
struct struct
......
...@@ -1129,32 +1129,6 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) ...@@ -1129,32 +1129,6 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
} }
/* 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 /* Assign glyph row FROM to glyph row TO. This works like a structure
assignment TO = FROM, except that glyph pointers are not copied but assignment TO = FROM, except that glyph pointers are not copied but
exchanged between TO and FROM. Pointers must be exchanged to avoid exchanged between TO and FROM. Pointers must be exchanged to avoid
...@@ -2223,8 +2197,6 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f) ...@@ -2223,8 +2197,6 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
static void static void
adjust_frame_glyphs_for_window_redisplay (struct frame *f) adjust_frame_glyphs_for_window_redisplay (struct frame *f)
{ {
struct window *w;
xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f)); xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));
/* Allocate/reallocate window matrices. */ /* Allocate/reallocate window matrices. */
...@@ -2236,6 +2208,7 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) ...@@ -2236,6 +2208,7 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
{ {
/* Allocate a dummy window if not already done. */ /* Allocate a dummy window if not already done. */
struct window *w;
if (NILP (f->menu_bar_window)) if (NILP (f->menu_bar_window))
{ {
f->menu_bar_window = make_window (); f->menu_bar_window = make_window ();
...@@ -2258,23 +2231,26 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) ...@@ -2258,23 +2231,26 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
#endif /* HAVE_X_WINDOWS */ #endif /* HAVE_X_WINDOWS */
#ifndef USE_GTK #ifndef USE_GTK
/* Allocate/ reallocate matrices of the tool bar window. If we {
don't have a tool bar window yet, make one. */ /* Allocate/ reallocate matrices of the tool bar window. If we
if (NILP (f->tool_bar_window)) don't have a tool bar window yet, make one. */
{ struct window *w;
f->tool_bar_window = make_window (); 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); 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->top_line, FRAME_MENU_BAR_LINES (f));
XSETFASTINT (w->left_col, 0); XSETFASTINT (w->left_col, 0);
XSETFASTINT (w->total_lines, FRAME_TOOL_BAR_LINES (f)); XSETFASTINT (w->total_lines, FRAME_TOOL_BAR_LINES (f));
XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f)); XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f));
allocate_matrices_for_window_redisplay (w); allocate_matrices_for_window_redisplay (w);
}
#endif #endif
} }
...@@ -2924,7 +2900,7 @@ sync_window_with_frame_matrix_rows (struct window *w) ...@@ -2924,7 +2900,7 @@ sync_window_with_frame_matrix_rows (struct window *w)
/* Return the window in the window tree rooted in W containing frame /* Return the window in the window tree rooted in W containing frame
row ROW. Value is null if none is found. */ row ROW. Value is null if none is found. */
struct window * static struct window *
frame_row_to_window (struct window *w, int row) frame_row_to_window (struct window *w, int row)
{ {
struct window *found = NULL; struct window *found = NULL;
...@@ -3562,12 +3538,12 @@ redraw_overlapping_rows (struct window *w, int yb) ...@@ -3562,12 +3538,12 @@ redraw_overlapping_rows (struct window *w, int yb)
#endif /* HAVE_WINDOW_SYSTEM */ #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 /* Check that no row in the current matrix of window W is enabled
which is below what's displayed in the window. */ which is below what's displayed in the window. */
void static void
check_current_matrix_flags (struct window *w) check_current_matrix_flags (struct window *w)
{ {
int last_seen_p = 0; int last_seen_p = 0;
...@@ -4014,7 +3990,7 @@ update_text_area (struct window *w, int vpos) ...@@ -4014,7 +3990,7 @@ update_text_area (struct window *w, int vpos)
{ {
/* Otherwise clear to the end of the old row. Everything /* Otherwise clear to the end of the old row. Everything
after that position should be clear already. */ after that position should be clear already. */
int x; int xlim;
if (i >= desired_row->used[TEXT_AREA]) if (i >= desired_row->used[TEXT_AREA])
rif->cursor_to (vpos, i, desired_row->y, rif->cursor_to (vpos, i, desired_row->y,
...@@ -4031,11 +4007,11 @@ update_text_area (struct window *w, int vpos) ...@@ -4031,11 +4007,11 @@ update_text_area (struct window *w, int vpos)
: (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA]))) : (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])))
{ {
w->phys_cursor_on_p = 0; w->phys_cursor_on_p = 0;
x = -1; xlim = -1;
} }
else else
x = current_row->pixel_width; xlim = current_row->pixel_width;
rif->clear_end_of_line (x); rif->clear_end_of_line (xlim);
changed_p = 1; changed_p = 1;
} }
} }
...@@ -4491,7 +4467,7 @@ scrolling_window (struct window *w, int header_line_p) ...@@ -4491,7 +4467,7 @@ scrolling_window (struct window *w, int header_line_p)
&& old_lines[i]->old_uses == 1 && old_lines[i]->old_uses == 1
&& old_lines[i]->new_uses == 1) && old_lines[i]->new_uses == 1)
{ {
int j, k; int p, q;
int new_line = old_lines[i]->new_line_number; int new_line = old_lines[i]->new_line_number;
struct run *run = run_pool + run_idx++; struct run *run = run_pool + run_idx++;
...@@ -4504,33 +4480,33 @@ scrolling_window (struct window *w, int header_line_p) ...@@ -4504,33 +4480,33 @@ scrolling_window (struct window *w, int header_line_p)
run->height = MATRIX_ROW (current_matrix, i)->height; run->height = MATRIX_ROW (current_matrix, i)->height;
/* Extend backward. */ /* Extend backward. */
j = i - 1; p = i - 1;
k = new_line - 1; q = new_line - 1;
while (j > first_old while (p > first_old
&& k > first_new && q > first_new
&& old_lines[j] == new_lines[k]) && 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->current_vpos;
--run->desired_vpos; --run->desired_vpos;
++run->nrows; ++run->nrows;
run->height += h; run->height += h;
run->desired_y -= h; run->desired_y -= h;
run->current_y -= h; run->current_y -= h;
--j, --k; --p, --q;
} }
/* Extend forward. */ /* Extend forward. */
j = i + 1; p = i + 1;
k = new_line + 1; q = new_line + 1;
while (j < last_old while (p < last_old
&& k < last_new && q < last_new
&& old_lines[j] == new_lines[k]) && 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->nrows;
run->height += h; run->height += h;
++j, ++k; ++p, ++q;
} }
/* Insert run into list of all runs. Order runs by copied /* Insert run into list of all runs. Order runs by copied
...@@ -4538,11 +4514,11 @@ scrolling_window (struct window *w, int header_line_p) ...@@ -4538,11 +4514,11 @@ scrolling_window (struct window *w, int header_line_p)
be copied because they are already in place. This is done be copied because they are already in place. This is done
because we can avoid calling update_window_line in this because we can avoid calling update_window_line in this
case. */ 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) for (q = nruns; q > p; --q)
runs[k] = runs[k - 1]; runs[q] = runs[q - 1];
runs[j] = run; runs[p] = run;
++nruns; ++nruns;
i += run->nrows; i += run->nrows;
...@@ -4639,7 +4615,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) ...@@ -4639,7 +4615,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
struct glyph_matrix *current_matrix = f->current_matrix; struct glyph_matrix *current_matrix = f->current_matrix;
struct glyph_matrix *desired_matrix = f->desired_matrix; struct glyph_matrix *desired_matrix = f->desired_matrix;
int i; int i;
int pause; int pause_p;
int preempt_count = baud_rate / 2400 + 1; int preempt_count = baud_rate / 2400 + 1;
xassert (current_matrix && desired_matrix); xassert (current_matrix && desired_matrix);
...@@ -4653,7 +4629,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) ...@@ -4653,7 +4629,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
#if !PERIODIC_PREEMPTION_CHECKING #if !PERIODIC_PREEMPTION_CHECKING
if (!force_p && detect_input_pending_ignore_squeezables ()) if (!force_p && detect_input_pending_ignore_squeezables ())
{ {
pause = 1; pause_p = 1;
goto do_pause; goto do_pause;
} }
#endif #endif
...@@ -4733,10 +4709,10 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) ...@@ -4733,10 +4709,10 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
} }
} }
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. */ /* Now just clean up termcap drivers and set cursor, etc. */
if (!pause) if (!pause_p)
{ {
if ((cursor_in_echo_area if ((cursor_in_echo_area
/* If we are showing a message instead of the mini-buffer, /* If we are showing a message instead of the mini-buffer,
...@@ -4837,7 +4813,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) ...@@ -4837,7 +4813,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
#endif #endif
clear_desired_matrices (f); clear_desired_matrices (f);
return pause; return pause_p;
} }
...@@ -5594,7 +5570,7 @@ marginal_area_string (struct window *w, enum window_part part, ...@@ -5594,7 +5570,7 @@ marginal_area_string (struct window *w, enum window_part part,
#ifdef SIGWINCH #ifdef SIGWINCH
SIGTYPE static SIGTYPE
window_change_signal (int signalnum) /* If we don't have an argument, */ window_change_signal (int signalnum) /* If we don't have an argument, */
/* some compilers complain in signal calls. */ /* some compilers complain in signal calls. */
{ {
......
...@@ -3275,12 +3275,12 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu ...@@ -3275,12 +3275,12 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
bgcolor = Fassq (Qbackground_color, f->param_alist); bgcolor = Fassq (Qbackground_color, f->param_alist);
if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor))) if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
{ {
Lisp_Object index = Fget (Qbackground_color, Qx_frame_parameter); Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter);
if (NATNUMP (index) if (NATNUMP (parm_index)
&& (XFASTINT (index) && (XFASTINT (parm_index)
< sizeof (frame_parms)/sizeof (frame_parms[0])) < sizeof (frame_parms)/sizeof (frame_parms[0]))
&& FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)]) && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
(*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)]) (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
(f, bgcolor, Qnil); (f, bgcolor, Qnil);
} }
......
...@@ -841,6 +841,7 @@ extern Lisp_Object Qnoelisp; ...@@ -841,6 +841,7 @@ extern Lisp_Object Qnoelisp;
extern struct frame *last_nonminibuf_frame; 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_initial_frame (void);
extern struct frame *make_terminal_frame (struct terminal *); extern struct frame *make_terminal_frame (struct terminal *);
extern struct frame *make_frame (int); extern struct frame *make_frame (int);
...@@ -1131,17 +1132,20 @@ extern int x_figure_window_size (struct frame *, Lisp_Object, int); ...@@ -1131,17 +1132,20 @@ extern int x_figure_window_size (struct frame *, Lisp_Object, int);
extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object); extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
extern void validate_x_resource_name (void); extern void validate_x_resource_name (void);
extern Lisp_Object display_x_get_resource (Display_Info *, extern Lisp_Object display_x_get_resource (Display_Info *,
Lisp_Object attribute, Lisp_Object attribute,
Lisp_Object class, Lisp_Object class,
Lisp_Object component, Lisp_Object component,
Lisp_Object subclass); 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 */ /* In xmenu.c */
extern void set_frame_menubar (FRAME_PTR, int, int); extern void set_frame_menubar (FRAME_PTR, int, int);
#endif /* HAVE_WINDOW_SYSTEM */ #endif /* HAVE_WINDOW_SYSTEM */
#endif /* not EMACS_FRAME_H */ #endif /* not EMACS_FRAME_H */
...@@ -1389,8 +1389,6 @@ IT_delete_glyphs (struct frame *f, int n) ...@@ -1389,8 +1389,6 @@ IT_delete_glyphs (struct frame *f, int n)
void void
x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) 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); set_menu_bar_lines (f, value, oldval);
} }
...@@ -4236,4 +4234,3 @@ This variable is used only by MS-DOS terminals. */); ...@@ -4236,4 +4234,3 @@ This variable is used only by MS-DOS terminals. */);
} }
#endif /* MSDOS */ #endif /* MSDOS */
...@@ -262,7 +262,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m ...@@ -262,7 +262,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m
for (k = 0; k < window_size; ++k) for (k = 0; k < window_size; ++k)
copy_from[k] = -1; copy_from[k] = -1;
#define CHECK_BOUNDS \ #if GLYPH_DEBUG
# define CHECK_BOUNDS \
do \ do \
{ \ { \
int k; \ int k; \
...@@ -271,6 +272,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m ...@@ -271,6 +272,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m
|| (copy_from[k] >= 0 && copy_from[k] < window_size)); \ || (copy_from[k] >= 0 && copy_from[k] < window_size)); \
} \ } \
while (0); while (0);
#endif
/* When j is advanced, this corresponds to deleted lines. /* When j is advanced, this corresponds to deleted lines.
When i is advanced, this corresponds to inserted lines. */ When i is advanced, this corresponds to inserted lines. */
...@@ -1035,4 +1037,3 @@ do_line_insertion_deletion_costs (FRAME_PTR frame, ...@@ -1035,4 +1037,3 @@ do_line_insertion_deletion_costs (FRAME_PTR frame,
FRAME_DELETE_COST (frame), FRAME_DELETEN_COST (frame), FRAME_DELETE_COST (frame), FRAME_DELETEN_COST (frame),
coefficient); coefficient);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment