From 22770c84d5acd892c6a3302790f92f37f600c93e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 28 Feb 2011 22:29:00 -0500 Subject: Release logs for 23.3 release. Regenerate configure and other release files. --- src/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0fdc151e540..7a46109c9b1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-02-28 Chong Yidong + + * Version 23.3 released. + 2011-02-22 Kenichi Handa * font.c (font_open_entity): Be sure to set scaled_pixel_size. -- cgit v1.2.1 From 367c19e58bd4ccf47dd0ce018002b2ae4e12f949 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 11:43:58 -0800 Subject: * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. Add a FIXME comment, since the code still doesn't look right. --- src/ChangeLog | 4 ++++ src/xdisp.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d0380e42e49..94ce2a9f6ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-06 Paul Eggert + * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. + Add a FIXME comment, since the code still doesn't look right. + current_column: Now returns EMACS_INT, fixing some iftc. * bytecode.c (Fbyte_code): Don't cast current_column () to int. * cmds.c (internal_self_insert): Likewise. @@ -10,6 +13,7 @@ to int. * xdisp.c (redisplay_internal, redisplay_window, decode_mode_spec): Likewise. + * cmds.c (internal_self_insert): Declare locals to be EMACS_INT, not int or double, if they might contain a column number. * indent.c (current_column, Findent_to, indented_beyond_p): diff --git a/src/xdisp.c b/src/xdisp.c index 44cb7130119..44a317b5785 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22292,7 +22292,13 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) if (metrics_upper.width >= metrics_lower.width) lower_xoff = (width - metrics_lower.width) / 2; else - upper_xoff = (width - metrics_upper.width) / 2; + { + /* FIXME: This code doesn't look right. It formerly was + missing the "lower_xoff = 0;", which couldn't have + been right since it left lower_xoff uninitialized. */ + lower_xoff = 0; + upper_xoff = (width - metrics_upper.width) / 2; + } } /* +5 is for horizontal bars of a box plus 1-pixel spaces at -- cgit v1.2.1 From 9f36b9fd38fb4bde2ac4664f05a65e2dd973add2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 11:53:35 -0800 Subject: * xdisp.c (Fcurrent_bidi_paragraph_direction): Simplify slightly; this avoids a gcc -Wuninitialized diagnostic. --- src/ChangeLog | 2 ++ src/xdisp.c | 15 +++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 94ce2a9f6ce..8582bf67e04 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. Add a FIXME comment, since the code still doesn't look right. + (Fcurrent_bidi_paragraph_direction): Simplify slightly; this + avoids a gcc -Wuninitialized diagnostic. current_column: Now returns EMACS_INT, fixing some iftc. * bytecode.c (Fbyte_code): Don't cast current_column () to int. diff --git a/src/xdisp.c b/src/xdisp.c index 44a317b5785..174312ccab3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17912,16 +17912,13 @@ paragraphs, text begins at the right margin and is read from right to left. See also `bidi-paragraph-direction'. */) (Lisp_Object buffer) { - struct buffer *buf; - struct buffer *old; + struct buffer *buf = current_buffer; + struct buffer *old = buf; - if (NILP (buffer)) - buf = current_buffer; - else + if (! NILP (buffer)) { CHECK_BUFFER (buffer); buf = XBUFFER (buffer); - old = current_buffer; } if (NILP (BVAR (buf, bidi_display_reordering))) @@ -17938,8 +17935,7 @@ See also `bidi-paragraph-direction'. */) EMACS_INT bytepos = BUF_PT_BYTE (buf); int c; - if (buf != current_buffer) - set_buffer_temp (buf); + set_buffer_temp (buf); /* bidi_paragraph_init finds the base direction of the paragraph by searching forward from paragraph start. We need the base direction of the current or _previous_ paragraph, so we need @@ -17967,8 +17963,7 @@ See also `bidi-paragraph-direction'. */) itb.paragraph_dir = NEUTRAL_DIR; bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); - if (buf != current_buffer) - set_buffer_temp (old); + set_buffer_temp (old); switch (itb.paragraph_dir) { case L2R: -- cgit v1.2.1 From dba6549815e211c820a249cbfe857a92c7418896 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 12:15:10 -0800 Subject: * xdisp.c (display_line): Mark variables that gcc -Wuninitialized cannot deduce are never used uninitialized. * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c which in turn is copied from coreutils. --- src/ChangeLog | 4 ++++ src/lisp.h | 7 +++++++ src/xdisp.c | 16 +++++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8582bf67e04..23bf646f742 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,10 @@ Add a FIXME comment, since the code still doesn't look right. (Fcurrent_bidi_paragraph_direction): Simplify slightly; this avoids a gcc -Wuninitialized diagnostic. + (display_line): Mark variables that gcc -Wuninitialized cannot + deduce are never used uninitialized. + * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c + which in turn is copied from coreutils. current_column: Now returns EMACS_INT, fixing some iftc. * bytecode.c (Fbyte_code): Don't cast current_column () to int. diff --git a/src/lisp.h b/src/lisp.h index e38d6a8ec3c..719d72d28a4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3524,6 +3524,13 @@ extern void init_system_name (void); && (circular_list_error ((list)), 1))) \ : 0))) +/* Use this to suppress gcc's `...may be used before initialized' warnings. */ +#ifdef lint +# define IF_LINT(Code) Code +#else +# define IF_LINT(Code) /* empty */ +#endif + /* The ubiquitous min and max macros. */ #ifdef max diff --git a/src/xdisp.c b/src/xdisp.c index 174312ccab3..180c65d18ed 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17231,14 +17231,16 @@ display_line (struct it *it) struct glyph_row *row = it->glyph_row; Lisp_Object overlay_arrow_string; struct it wrap_it; - int may_wrap = 0, wrap_x; - int wrap_row_used = -1, wrap_row_ascent, wrap_row_height; - int wrap_row_phys_ascent, wrap_row_phys_height; - int wrap_row_extra_line_spacing; - EMACS_INT wrap_row_min_pos, wrap_row_min_bpos; - EMACS_INT wrap_row_max_pos, wrap_row_max_bpos; + int may_wrap = 0, wrap_x IF_LINT (= 0); + int wrap_row_used = -1; + int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0); + int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0); + int wrap_row_extra_line_spacing IF_LINT (= 0); + EMACS_INT wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0); + EMACS_INT wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0); int cvpos; - EMACS_INT min_pos = ZV + 1, min_bpos, max_pos = 0, max_bpos; + EMACS_INT min_pos = ZV + 1, max_pos = 0; + EMACS_INT min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0); /* We always start displaying at hpos zero even if hscrolled. */ xassert (it->hpos == 0 && it->current_x == 0); -- cgit v1.2.1 From 70739cbeb98fae41f27fc2e4fc34670c8ec39bb7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 14:04:59 -0800 Subject: xdisp.c (BUILD_COMPOSITE_GLYPH_STRING): Mark variables that gcc -Wuninitialized cannot deduce are never used uninitialized. --- src/ChangeLog | 5 +++-- src/xdisp.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 23bf646f742..ff8c5fd027d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,8 +4,9 @@ Add a FIXME comment, since the code still doesn't look right. (Fcurrent_bidi_paragraph_direction): Simplify slightly; this avoids a gcc -Wuninitialized diagnostic. - (display_line): Mark variables that gcc -Wuninitialized cannot - deduce are never used uninitialized. + (display_line, BUILD_COMPOSITE_GLYPH_STRING): Mark variables that + gcc -Wuninitialized cannot deduce are never used uninitialized. + * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c which in turn is copied from coreutils. diff --git a/src/xdisp.c b/src/xdisp.c index 180c65d18ed..0f8fd3d0477 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21089,7 +21089,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) int cmp_id = (row)->glyphs[area][START].u.cmp.id; \ struct composition *cmp = composition_table[cmp_id]; \ XChar2b *char2b; \ - struct glyph_string *first_s; \ + struct glyph_string *first_s IF_LINT (= NULL); \ int n; \ \ char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ -- cgit v1.2.1 From 0e086e8f7f79c0473a00153ba70c7febab7d0712 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 14:11:02 -0800 Subject: xdisp.c (draw_glyphs): Mark variables that gcc -Wuninitialized cannot deduce are never used uninitialized. --- src/ChangeLog | 5 +++-- src/xdisp.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ff8c5fd027d..5f7cc98ee2a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,8 +4,9 @@ Add a FIXME comment, since the code still doesn't look right. (Fcurrent_bidi_paragraph_direction): Simplify slightly; this avoids a gcc -Wuninitialized diagnostic. - (display_line, BUILD_COMPOSITE_GLYPH_STRING): Mark variables that - gcc -Wuninitialized cannot deduce are never used uninitialized. + (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs): + Mark variables that gcc -Wuninitialized cannot deduce are never + used uninitialized. * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c which in turn is copied from coreutils. diff --git a/src/xdisp.c b/src/xdisp.c index 0f8fd3d0477..7d6190ed8ce 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21293,7 +21293,8 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, { struct glyph_string *h, *t; Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - int mouse_beg_col, mouse_end_col, check_mouse_face = 0; + int mouse_beg_col IF_LINT (= 0), mouse_end_col IF_LINT (= 0); + int check_mouse_face = 0; int dummy_x = 0; /* If mouse highlighting is on, we may need to draw adjacent -- cgit v1.2.1 From 44a3a108430ef79370ad2957a5d71d4cd040962b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 14:22:56 -0800 Subject: xdisp.c (draw_glyphs): Mark variables that gcc -Wuninitialized cannot deduce are never used uninitialized. --- src/ChangeLog | 4 ++-- src/xdisp.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5f7cc98ee2a..c0e350e45f9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,8 +5,8 @@ (Fcurrent_bidi_paragraph_direction): Simplify slightly; this avoids a gcc -Wuninitialized diagnostic. (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs): - Mark variables that gcc -Wuninitialized cannot deduce are never - used uninitialized. + (note_mouse_highlight): Mark variables that gcc -Wuninitialized + does not deduce are never used uninitialized. * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c which in turn is copied from coreutils. diff --git a/src/xdisp.c b/src/xdisp.c index 7d6190ed8ce..f7f887f7850 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25457,7 +25457,8 @@ note_mouse_highlight (struct frame *f, int x, int y) { /* The mouse-highlighting, if any, comes from an overlay or text property in the buffer. */ - Lisp_Object buffer, cover_string; + Lisp_Object buffer IF_LINT (= Qnil); + Lisp_Object cover_string IF_LINT (= Qnil); if (STRINGP (object)) { -- cgit v1.2.1 From 032f16205d3fc06ecafa26382745b49985dd124b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 14:34:54 -0800 Subject: * xmenu.c (menu_highlight_callback): Now static. --- src/ChangeLog | 2 ++ src/xmenu.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c0e350e45f9..02d6ec1ae9e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-06 Paul Eggert + * xmenu.c (menu_highlight_callback): Now static. + * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. Add a FIXME comment, since the code still doesn't look right. (Fcurrent_bidi_paragraph_direction): Simplify slightly; this diff --git a/src/xmenu.c b/src/xmenu.c index 934db0f0406..750dad6da17 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -723,7 +723,7 @@ show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help) unhighlighting. */ #ifdef USE_GTK -void +static void menu_highlight_callback (GtkWidget *widget, gpointer call_data) { xg_menu_item_cb_data *cb_data; @@ -742,7 +742,7 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data) show_help_event (cb_data->cl_data->f, widget, help); } #else -void +static void menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data) { struct frame *f; -- cgit v1.2.1 From 9d66f88eb9f67c5484abb4000e2d5e6acf34a795 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 14:36:06 -0800 Subject: * xmenu.c (set_frame_menubar): Remove unused local. --- src/ChangeLog | 1 + src/xmenu.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 02d6ec1ae9e..1ca428fa685 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-06 Paul Eggert * xmenu.c (menu_highlight_callback): Now static. + (set_frame_menubar): Remove unused local. * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. Add a FIXME comment, since the code still doesn't look right. diff --git a/src/xmenu.c b/src/xmenu.c index 750dad6da17..c79db086df3 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1175,8 +1175,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) } else { - GtkWidget *wvbox = f->output_data.x->vbox_widget; - menubar_widget = xg_create_widget ("menubar", "menubar", f, first_wv, G_CALLBACK (menubar_selection_callback), -- cgit v1.2.1 From ef272f1fc10a4f8464c886ccc02ea67b2c3b2769 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 6 Mar 2011 18:19:25 -0500 Subject: Revert incorrect logic in 2011-03-06T07:50:01Z!eggert@cs.ucla.edu. * src/xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 change. --- src/ChangeLog | 5 +++++ src/xdisp.c | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a96edcdfdca..d7131096995 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-06 Chong Yidong + + * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 + change. + 2011-03-06 Paul Eggert current_column: Now returns EMACS_INT, fixing some iftc diff --git a/src/xdisp.c b/src/xdisp.c index 44cb7130119..e62b491ad32 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13697,6 +13697,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) int buffer_unchanged_p = 0; int temp_scroll_step = 0; int count = SPECPDL_INDEX (); + int rc; int centering_position = -1; int last_line_misfit = 0; EMACS_INT beg_unchanged, end_unchanged; @@ -14008,15 +14009,12 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* Handle case where text has not changed, only point, and it has not moved off the frame, and we are not retrying after hscroll. (current_matrix_up_to_date_p is nonzero when retrying.) */ - if (current_matrix_up_to_date_p) + if (current_matrix_up_to_date_p + && (rc = try_cursor_movement (window, startp, &temp_scroll_step), + rc != CURSOR_MOVEMENT_CANNOT_BE_USED)) { - int rc = try_cursor_movement (window, startp, &temp_scroll_step); - switch (rc) { - case CURSOR_MOVEMENT_CANNOT_BE_USED: - break; - case CURSOR_MOVEMENT_SUCCESS: used_current_matrix_p = 1; goto done; -- cgit v1.2.1 From c6678f2916c22cd3b16232dc941f318c894ef56e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 7 Mar 2011 00:20:23 -0500 Subject: Revert 2010-05-25T15:54:53Z!juri@jurta.org; regenerate release logs. * lisp/progmodes/cc-cmds.el (c-beginning-of-statement): Revert 2011-01-31 change. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7a46109c9b1..12ea037ee91 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,4 @@ -2011-02-28 Chong Yidong +2011-03-07 Chong Yidong * Version 23.3 released. -- cgit v1.2.1 From d432397227a87fd18c33a27806cd2c0fbcd203af Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 22:23:15 -0800 Subject: * xmenu.c (xmenu_show): Rename parameter to avoid shadowing. --- src/ChangeLog | 1 + src/xmenu.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1ca428fa685..add827a9dc4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * xmenu.c (menu_highlight_callback): Now static. (set_frame_menubar): Remove unused local. + (xmenu_show): Rename parameter to avoid shadowing. * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. Add a FIXME comment, since the code still doesn't look right. diff --git a/src/xmenu.c b/src/xmenu.c index c79db086df3..64d74ee66d7 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1598,7 +1598,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, EMACS_UINT timestamp) { int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; @@ -1613,11 +1613,11 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, if (! FRAME_X_P (f)) abort (); - *error = NULL; + *error_name = NULL; if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) { - *error = "Empty menu"; + *error_name = "Empty menu"; return Qnil; } -- cgit v1.2.1 From 8868a2381e0ae9d40d5b9f21f38a29822ec2fe2a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 22:39:56 -0800 Subject: * xdisp.c (redisplay_window): Rename local to avoid shadowing. --- src/ChangeLog | 2 ++ src/xdisp.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 90722187e6c..95cc4a5d633 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -14,6 +14,8 @@ * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c. + * xdisp.c (redisplay_window): Rename local to avoid shadowing. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/xdisp.c b/src/xdisp.c index 858a0f74fb1..f2477a2eca5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14163,11 +14163,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p) { /* The function returns -1 if new fonts were loaded, 1 if successful, 0 if not successful. */ - int rc = try_scrolling (window, just_this_one_p, + int ss = try_scrolling (window, just_this_one_p, scroll_conservatively, emacs_scroll_step, temp_scroll_step, last_line_misfit); - switch (rc) + switch (ss) { case SCROLLING_SUCCESS: goto done; -- cgit v1.2.1 From 6d1f7feedacad0112846d84232b3d4a8dd96b740 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 22:43:11 -0800 Subject: * xmenu.c (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const" since they might point to immutable storage. --- src/ChangeLog | 2 ++ src/xmenu.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 95cc4a5d633..f1b08f62b8e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,8 @@ * xmenu.c (menu_highlight_callback): Now static. (set_frame_menubar): Remove unused local. (xmenu_show): Rename parameter to avoid shadowing. + (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const" + since they might point to immutable storage. * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. Add a FIXME comment, since the code still doesn't look right. diff --git a/src/xmenu.c b/src/xmenu.c index 64d74ee66d7..a64b305238b 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1662,7 +1662,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, { /* Create a new pane. */ Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); @@ -2010,7 +2010,7 @@ xdialog_show (FRAME_PTR f, representing the text label and buttons. */ { Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; pane_string = (NILP (pane_name) @@ -2305,7 +2305,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, { /* Create a new pane. */ Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; maxlines = max (maxlines, lines); lines = 0; -- cgit v1.2.1 From 281585b0bd2a6063c11cfcc308a560f416c3eee7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 22:46:29 -0800 Subject: * xmenu.c (next_menubar_widget_id): Declare only if USE_X_TOOLKIT, since it's unused otherwise. --- src/ChangeLog | 2 ++ src/xmenu.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f1b08f62b8e..a0f797b0e6f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,8 @@ (xmenu_show): Rename parameter to avoid shadowing. (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const" since they might point to immutable storage. + (next_menubar_widget_id): Declare only if USE_X_TOOLKIT, + since it's unused otherwise. * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. Add a FIXME comment, since the code still doesn't look right. diff --git a/src/xmenu.c b/src/xmenu.c index a64b305238b..36684c7dafa 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -124,11 +124,11 @@ static int update_frame_menubar (struct frame *); Xt on behalf of one of the widget sets. */ static int popup_activated_flag; -static int next_menubar_widget_id; - #ifdef USE_X_TOOLKIT +static int next_menubar_widget_id; + /* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */ static struct frame * -- cgit v1.2.1 From 4554d213635d99c2461e0fc20441fd0e7f14435d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 22:58:49 -0800 Subject: * window.c (window_loop, size_window): (run_window_configuration_change_hook, enlarge_window): Rename locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/window.c | 47 ++++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a0f797b0e6f..150f193af0b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -19,6 +19,8 @@ * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c. * xdisp.c (redisplay_window): Rename local to avoid shadowing. + * window.c (window_loop, size_window): + (run_window_configuration_change_hook, enlarge_window): Likewise. 2011-03-06 Chong Yidong diff --git a/src/window.c b/src/window.c index 7c55be972b2..2ec51a756d4 100644 --- a/src/window.c +++ b/src/window.c @@ -2209,13 +2209,13 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame case DELETE_BUFFER_WINDOWS: if (EQ (w->buffer, obj)) { - struct frame *f = XFRAME (WINDOW_FRAME (w)); + struct frame *fr = XFRAME (WINDOW_FRAME (w)); /* If this window is dedicated, and in a frame of its own, kill the frame. */ - if (EQ (window, FRAME_ROOT_WINDOW (f)) + if (EQ (window, FRAME_ROOT_WINDOW (fr)) && !NILP (w->dedicated) - && other_visible_frames (f)) + && other_visible_frames (fr)) { /* Skip the other windows on this frame. There might be one, the minibuffer! */ @@ -2267,16 +2267,16 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame if (EQ (w->buffer, obj)) { Lisp_Object buffer; - struct frame *f = XFRAME (w->frame); + struct frame *fr = XFRAME (w->frame); /* Find another buffer to show in this window. */ buffer = Fother_buffer (obj, Qnil, w->frame); /* If this window is dedicated, and in a frame of its own, kill the frame. */ - if (EQ (window, FRAME_ROOT_WINDOW (f)) + if (EQ (window, FRAME_ROOT_WINDOW (fr)) && !NILP (w->dedicated) - && other_visible_frames (f)) + && other_visible_frames (fr)) { /* Skip the other windows on this frame. There might be one, the minibuffer! */ @@ -2290,11 +2290,11 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame } else if (!NILP (w->dedicated) && !NILP (w->parent)) { - Lisp_Object window; - XSETWINDOW (window, w); + Lisp_Object window_to_delete; + XSETWINDOW (window_to_delete, w); /* If this window is dedicated and not the only window in its frame, then kill it. */ - Fdelete_window (window); + Fdelete_window (window_to_delete); } else { @@ -3170,11 +3170,11 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs last_pos = first_pos; for (n = 0, child = *forward; !NILP (child); child = c->next, ++n) { - int new_size, old_size; + int new_child_size, old_child_size; c = XWINDOW (child); - old_size = WINDOW_TOTAL_SIZE (c, width_p); - new_size = old_size; + old_child_size = WINDOW_TOTAL_SIZE (c, width_p); + new_child_size = old_child_size; /* The top or left edge position of this child equals the bottom or right edge of its predecessor. */ @@ -3186,18 +3186,20 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs /* If this child can be resized, do it. */ if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) { - new_size = new_sizes ? new_sizes[n] : old_size + each + extra; + new_child_size = + new_sizes ? new_sizes[n] : old_child_size + each + extra; extra = 0; } /* Set new size. Note that size_window also propagates edge positions to children, so it's not a no-op if we didn't change the child's size. */ - size_window (child, new_size, width_p, 1, first_only, last_only); + size_window (child, new_child_size, width_p, 1, + first_only, last_only); /* Remember the bottom/right edge position of this child; it will be used to set the top/left edge of the next child. */ - last_pos += new_size; + last_pos += new_child_size; } xfree (new_sizes); @@ -3325,12 +3327,12 @@ run_window_configuration_change_hook (struct frame *f) if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, buffer))) { - int count = SPECPDL_INDEX (); + int count1 = SPECPDL_INDEX (); record_unwind_protect (select_window_norecord, Fselected_window ()); select_window_norecord (window); run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, buffer)); - unbind_to (count, Qnil); + unbind_to (count1, Qnil); } } } @@ -4119,7 +4121,7 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag) { /* If trying to grow this window to or beyond size of the parent, just delete all the sibling windows. */ - Lisp_Object start, tem, next; + Lisp_Object start, tem; start = XWINDOW (parent)->vchild; if (NILP (start)) @@ -4129,9 +4131,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag) tem = XWINDOW (window)->next; while (! NILP (tem)) { - next = XWINDOW (tem)->next; + Lisp_Object next1 = XWINDOW (tem)->next; delete_window (tem); - tem = next; + tem = next1; } /* Delete any siblings that come after WINDOW. @@ -4140,9 +4142,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag) tem = start; while (! EQ (tem, window)) { - next = XWINDOW (tem)->next; + Lisp_Object next1 = XWINDOW (tem)->next; delete_window (tem); - tem = next; + tem = next1; } } else @@ -7224,4 +7226,3 @@ keys_of_window (void) initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); initial_define_key (meta_map, 'v', "scroll-down-command"); } - -- cgit v1.2.1 From 7e5cf297731ddb042bfc5effa2128acfc776cc09 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 23:06:05 -0800 Subject: * window.c (display_buffer): Now static. --- src/ChangeLog | 2 ++ src/window.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 150f193af0b..0408deade82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -22,6 +22,8 @@ * window.c (window_loop, size_window): (run_window_configuration_change_hook, enlarge_window): Likewise. + * window.c (display_buffer): Now static. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/window.c b/src/window.c index 2ec51a756d4..838be475d51 100644 --- a/src/window.c +++ b/src/window.c @@ -3604,7 +3604,7 @@ select_frame_norecord (Lisp_Object frame) ? Fselect_frame (frame, Qt) : selected_frame; } -Lisp_Object +static Lisp_Object display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame) { return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame); -- cgit v1.2.1 From a586633d66b8da9634c600de93279e244f29c939 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2011 23:07:38 -0800 Subject: * window.h (check_all_windows): New decl, to forestall gcc -Wmissing-prototypes diagnostic. --- src/ChangeLog | 2 ++ src/window.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0408deade82..ac2f0c418e1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -23,6 +23,8 @@ (run_window_configuration_change_hook, enlarge_window): Likewise. * window.c (display_buffer): Now static. + * window.h (check_all_windows): New decl, to forestall + gcc -Wmissing-prototypes diagnostic. 2011-03-06 Chong Yidong diff --git a/src/window.h b/src/window.h index 690fd9a50fa..f788e126d6d 100644 --- a/src/window.h +++ b/src/window.h @@ -778,6 +778,7 @@ extern void freeze_window_starts (struct frame *, int); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); extern int window_relative_x_coord (struct window *, enum window_part, int); +extern void check_all_windows (void); void run_window_configuration_change_hook (struct frame *f); -- cgit v1.2.1 From cf715c3c952706b13fe4a9a9279739b7ed480a15 Mon Sep 17 00:00:00 2001 From: Adrian Robert Date: Mon, 7 Mar 2011 11:00:11 +0200 Subject: * nsterm.m (ns_draw_window_cursor): Fix handling of 'cursor_width' parameter for hbar cursors. Based on a patch by Ben Key . --- src/ChangeLog | 6 ++++++ src/nsterm.m | 18 +++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d7131096995..7fbf3e1ef6c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-07 Adrian Robert + + * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width" + parameter for hbar cursors. Based on a patch by Ben Key + . + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/nsterm.m b/src/nsterm.m index cc2c4cf9807..c7cd411c614 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2235,7 +2235,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, -------------------------------------------------------------------------- */ { NSRect r, s; - int fx, fy, h; + int fx, fy, h, cursor_height; struct frame *f = WINDOW_XFRAME (w); struct glyph *phys_cursor_glyph; int overspill; @@ -2279,13 +2279,20 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); /* The above get_phys_cursor_geometry call set w->phys_cursor_width - to the glyph width; replace with CURSOR_WIDTH for bar cursors. */ - if (cursor_type == BAR_CURSOR || cursor_type == HBAR_CURSOR) + to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ + if (cursor_type == BAR_CURSOR) { if (cursor_width < 1) cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); w->phys_cursor_width = cursor_width; } + /* If we have an HBAR, "cursor_width" MAY specify height. */ + else if (cursor_type == HBAR_CURSOR) + { + cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width; + fy += h - cursor_height; + h = cursor_height; + } r.origin.x = fx, r.origin.y = fy; r.size.height = h; @@ -2337,10 +2344,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, [FRAME_CURSOR_COLOR (f) set]; break; case HBAR_CURSOR: - s = r; - s.origin.y += lrint (0.75 * s.size.height); - s.size.height = lrint (s.size.height * 0.25); - NSRectFill (s); + NSRectFill (r); break; case BAR_CURSOR: s = r; -- cgit v1.2.1 From 7faeca66c766912265dea911f92c64b9608c0872 Mon Sep 17 00:00:00 2001 From: Ben Key Date: Mon, 7 Mar 2011 22:11:24 +0100 Subject: Fix bug#8181. * src/w32fns.c (FILE_NAME_COMBO_BOX, FILE_NAME_LIST): Define. (file_dialog_callback): Fix locating the window handle of the File Name text field. After disabling it, set focus on the list control. (Fx_file_dialog): If only_dir_p is non-nil, set the text of the File Name text field to "Current Directory" if it does not already have another value. --- src/ChangeLog | 9 +++++++++ src/w32fns.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7fbf3e1ef6c..9c612e0e09f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2011-03-07 Ben Key + + * w32fns.c (FILE_NAME_COMBO_BOX, FILE_NAME_LIST): Define. + (file_dialog_callback): Fix locating the window handle of the File Name + text field. After disabling it, set focus on the list control. + (Fx_file_dialog): If only_dir_p is non-nil, set the text of the File + Name text field to "Current Directory" if it does not already have + another value. (Bug#8181) + 2011-03-07 Adrian Robert * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width" diff --git a/src/w32fns.c b/src/w32fns.c index ec48397657a..09442d41e14 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -60,6 +60,8 @@ along with GNU Emacs. If not, see . */ #include #include #define FILE_NAME_TEXT_FIELD edt1 +#define FILE_NAME_COMBO_BOX cmb13 +#define FILE_NAME_LIST lst1 #include "font.h" #include "w32font.h" @@ -5868,13 +5870,37 @@ file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND dialog = GetParent (hwnd); HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); + HWND list = GetDlgItem (dialog, FILE_NAME_LIST); - /* Directories is in index 2. */ + /* At least on Windows 7, the above attempt to get the window handle + to the File Name Text Field fails. The following code does the + job though. Note that this code is based on my examination of the + window hierarchy using Microsoft Spy++. bk */ + if (edit_control == NULL) + { + HWND tmp = GetDlgItem (dialog, FILE_NAME_COMBO_BOX); + if (tmp) + { + tmp = GetWindow (tmp, GW_CHILD); + if (tmp) + edit_control = GetWindow (tmp, GW_CHILD); + } + } + + /* Directories is in index 2. */ if (notify->lpOFN->nFilterIndex == 2) { CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, "Current Directory"); EnableWindow (edit_control, FALSE); + /* Note that at least on Windows 7, the above call to EnableWindow + disables the window that would ordinarily have focus. If we + do not set focus to some other window here, focus will land in + no man's land and the user will be unable to tab through the + dialog box (pressing tab will only result in a beep). + Avoid that problem by setting focus to the list here. */ + if (CDN_INITDONE == notify->hdr.code) + SetFocus (list); } else { @@ -5951,6 +5977,13 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) else filename[0] = '\0'; + /* The code in file_dialog_callback that attempts to set the text + of the file name edit window when handling the CDN_INITDONE + WM_NOTIFY message does not work. Setting filename to "Current + Directory" in the only_dir_p case here does work however. */ + if (filename[0] == 0 && ! NILP (only_dir_p)) + strcpy (filename, "Current Directory"); + { NEWOPENFILENAME new_file_details; BOOL file_opened = FALSE; -- cgit v1.2.1 From e18c0aa3359a9339443858d9732718877ddf0d6c Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 7 Mar 2011 22:16:42 +0100 Subject: Remove unnecessary "(tiny change)" markers. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9c612e0e09f..46ad067c9cd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -152,7 +152,7 @@ as per recent filemodestring API change. Reported by Jonas Öster in . -2011-02-23 Ben Key (tiny change) +2011-02-23 Ben Key * nsterm.m (ns_draw_window_cursor): Obey the cursor_width argument directly, for bar cursors. -- cgit v1.2.1 From d6550a9f3013b49b2d04395ed19f0ea1ec683e6c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 16:06:36 -0800 Subject: 2011-03-08 Paul Eggert * window.c (size_window): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. --- src/ChangeLog | 6 +++++- src/window.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ac2f0c418e1..e3b3c8c2566 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,6 @@ -2011-03-07 Paul Eggert +2011-03-08 Paul Eggert + +2011-03-08 Paul Eggert * xmenu.c (menu_highlight_callback): Now static. (set_frame_menubar): Remove unused local. @@ -23,6 +25,8 @@ (run_window_configuration_change_hook, enlarge_window): Likewise. * window.c (display_buffer): Now static. + (size_window): Mark variables that gcc -Wuninitialized + does not deduce are never used uninitialized. * window.h (check_all_windows): New decl, to forestall gcc -Wmissing-prototypes diagnostic. diff --git a/src/window.c b/src/window.c index 838be475d51..eaa910571e0 100644 --- a/src/window.c +++ b/src/window.c @@ -3124,7 +3124,7 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs } else if (!NILP (*forward)) { - int fixed_size, each, extra, n; + int fixed_size, each IF_LINT (= 0), extra IF_LINT (= 0), n; int resize_fixed_p, nfixed; int last_pos, first_pos, nchildren, total; int *new_sizes = NULL; @@ -5522,7 +5522,7 @@ and redisplay normally--don't erase and redraw the frame. */) struct buffer *obuf = current_buffer; int center_p = 0; EMACS_INT charpos, bytepos; - int iarg; + int iarg IF_LINT (= 0); int this_scroll_margin; /* If redisplay is suppressed due to an error, try again. */ -- cgit v1.2.1 From f60958682b055102431c24a30b598a2bf3ec97c3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 16:22:52 -0800 Subject: * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid shadowing. * charset.c (map_charset_for_dump, Fchar_charset): Likewise. --- src/ChangeLog | 6 ++++-- src/charset.c | 10 +++++----- src/charset.h | 7 +++---- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e3b3c8c2566..ec7322cfe43 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,3 @@ -2011-03-08 Paul Eggert - 2011-03-08 Paul Eggert * xmenu.c (menu_highlight_callback): Now static. @@ -30,6 +28,10 @@ * window.h (check_all_windows): New decl, to forestall gcc -Wmissing-prototypes diagnostic. + * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid + shadowing. + * charset.c (map_charset_for_dump, Fchar_charset): Likewise. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/charset.c b/src/charset.c index 3624e740acb..f2fcb5bf9d7 100644 --- a/src/charset.c +++ b/src/charset.c @@ -668,9 +668,9 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object while (1) { - int index = GET_TEMP_CHARSET_WORK_ENCODER (c); + int idx = GET_TEMP_CHARSET_WORK_ENCODER (c); - if (index >= from_idx && index <= to_idx) + if (idx >= from_idx && idx <= to_idx) { if (NILP (XCAR (range))) XSETCAR (range, make_number (c)); @@ -2066,10 +2066,10 @@ that case, find the charset from what supported by that coding system. */) for (; CONSP (restriction); restriction = XCDR (restriction)) { - struct charset *charset; + struct charset *rcharset; - CHECK_CHARSET_GET_CHARSET (XCAR (restriction), charset); - if (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset)) + CHECK_CHARSET_GET_CHARSET (XCAR (restriction), rcharset); + if (ENCODE_CHAR (rcharset, c) != CHARSET_INVALID_CODE (rcharset)) return XCAR (restriction); } return Qnil; diff --git a/src/charset.h b/src/charset.h index 1fc552a5bd3..8c87ffe6c3d 100644 --- a/src/charset.h +++ b/src/charset.h @@ -358,9 +358,9 @@ extern int emacs_mule_charset[256]; #define CHECK_CHARSET_GET_CHARSET(x, charset) \ do { \ - int id; \ - CHECK_CHARSET_GET_ID (x, id); \ - charset = CHARSET_FROM_ID (id); \ + int csid; \ + CHECK_CHARSET_GET_ID (x, csid); \ + charset = CHARSET_FROM_ID (csid); \ } while (0) @@ -541,4 +541,3 @@ extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object), struct charset *, unsigned, unsigned); #endif /* EMACS_CHARSET_H */ - -- cgit v1.2.1 From 726929c43aaf671dcbac9b45f9da5b7c9168f3ef Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 16:35:37 -0800 Subject: * charset.c: Include . (Fsort_charsets): Redo min/max calculation to shorten the code a bit and to avoid gcc -Wuninitialized warning. --- src/ChangeLog | 3 +++ src/charset.c | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ec7322cfe43..39f806283f3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -31,6 +31,9 @@ * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid shadowing. * charset.c (map_charset_for_dump, Fchar_charset): Likewise. + Include . + (Fsort_charsets): Redo min/max calculation to shorten the code a bit + and to avoid gcc -Wuninitialized warning. 2011-03-06 Chong Yidong diff --git a/src/charset.c b/src/charset.c index f2fcb5bf9d7..0ce548d5a18 100644 --- a/src/charset.c +++ b/src/charset.c @@ -29,6 +29,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include #include "lisp.h" @@ -2250,7 +2251,7 @@ See also `charset-priority-list' and `set-charset-priority'. */) int n = XFASTINT (len), i, j, done; Lisp_Object tail, elt, attrs; struct charset_sort_data *sort_data; - int id, min_id, max_id; + int id, min_id = INT_MAX, max_id = INT_MIN; USE_SAFE_ALLOCA; if (n == 0) @@ -2262,11 +2263,9 @@ See also `charset-priority-list' and `set-charset-priority'. */) CHECK_CHARSET_GET_ATTR (elt, attrs); sort_data[i].charset = elt; sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); - if (i == 0) - min_id = max_id = id; - else if (id < min_id) + if (id < min_id) min_id = id; - else if (id > max_id) + if (id > max_id) max_id = id; } for (done = 0, tail = Vcharset_ordered_list, i = 0; -- cgit v1.2.1 From 89ef49dfdacaf2cca55246c902591b69618a287b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 16:36:30 -0800 Subject: * charset.c (load_charset_map): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. --- src/ChangeLog | 2 ++ src/charset.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 39f806283f3..c108bb38bea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -34,6 +34,8 @@ Include . (Fsort_charsets): Redo min/max calculation to shorten the code a bit and to avoid gcc -Wuninitialized warning. + (load_charset_map): Mark variables that gcc -Wuninitialized + does not deduce are never used uninitialized. 2011-03-06 Chong Yidong diff --git a/src/charset.c b/src/charset.c index 0ce548d5a18..e46dadab93a 100644 --- a/src/charset.c +++ b/src/charset.c @@ -251,7 +251,7 @@ struct charset_map_entries static void load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag) { - Lisp_Object vec, table; + Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil); unsigned max_code = CHARSET_MAX_CODE (charset); int ascii_compatible_p = charset->ascii_compatible_p; int min_char, max_char, nonascii_min_char; -- cgit v1.2.1 From 0ac2c2991c1cba4e3c6e5f7b62c7d61b01d69994 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 16:46:23 -0800 Subject: * charset.c (load_charset): Abort instead of using uninitialized var. --- src/ChangeLog | 1 + src/charset.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c108bb38bea..02dc5390f38 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -36,6 +36,7 @@ and to avoid gcc -Wuninitialized warning. (load_charset_map): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. + (load_charset): Abort instead of using uninitialized var. 2011-03-06 Chong Yidong diff --git a/src/charset.c b/src/charset.c index e46dadab93a..d82b29ae44b 100644 --- a/src/charset.c +++ b/src/charset.c @@ -630,8 +630,12 @@ load_charset (struct charset *charset, int control_flag) if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP) map = CHARSET_MAP (charset); - else if (CHARSET_UNIFIED_P (charset)) - map = CHARSET_UNIFY_MAP (charset); + else + { + if (! CHARSET_UNIFIED_P (charset)) + abort (); + map = CHARSET_UNIFY_MAP (charset); + } if (STRINGP (map)) load_charset_map_from_file (charset, map, control_flag); else -- cgit v1.2.1 From f38b440c4b40777c25631323f2501ffb5ba98251 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 17:41:19 -0800 Subject: * coding.c (coding_set_source, coding_set_destination): Use "else { /* comment */ }" rather than "else /* comment */;" for clarity, and to avoid gcc -Wempty-body warning. --- src/ChangeLog | 4 ++++ src/coding.c | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 02dc5390f38..b88ff2ccbb4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -38,6 +38,10 @@ does not deduce are never used uninitialized. (load_charset): Abort instead of using uninitialized var. + * coding.c (coding_set_source, coding_set_destination): + Use "else { /* comment */ }" rather than "else /* comment */;" + for clarity, and to avoid gcc -Wempty-body warning. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/coding.c b/src/coding.c index f6310369ad3..cb13793daba 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1051,9 +1051,10 @@ coding_set_source (struct coding_system *coding) coding->source = SDATA (coding->src_object) + coding->src_pos_byte; } else - /* Otherwise, the source is C string and is never relocated - automatically. Thus we don't have to update anything. */ - ; + { + /* Otherwise, the source is C string and is never relocated + automatically. Thus we don't have to update anything. */ + } } static void @@ -1079,9 +1080,10 @@ coding_set_destination (struct coding_system *coding) } } else - /* Otherwise, the destination is C string and is never relocated - automatically. Thus we don't have to update anything. */ - ; + { + /* Otherwise, the destination is C string and is never relocated + automatically. Thus we don't have to update anything. */ + } } -- cgit v1.2.1 From 1c2cc4efceea675cfa303414478e4abd160e26d0 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 8 Mar 2011 02:52:20 +0100 Subject: src/w32xfns.c (select_palette): Check success of RealizePalette against GDI_ERROR, not zero. --- src/ChangeLog | 5 +++++ src/w32xfns.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 46ad067c9cd..b73e3d0c860 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-08 Juanma Barranquero + + * w32xfns.c (select_palette): Check success of RealizePalette against + GDI_ERROR, not zero. + 2011-03-07 Ben Key * w32fns.c (FILE_NAME_COMBO_BOX, FILE_NAME_LIST): Define. diff --git a/src/w32xfns.c b/src/w32xfns.c index df9acca5fb9..fbbf11bd65c 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -97,7 +97,7 @@ select_palette (FRAME_PTR f, HDC hdc) else f->output_data.w32->old_palette = NULL; - if (RealizePalette (hdc)) + if (RealizePalette (hdc) != GDI_ERROR) { Lisp_Object frame, framelist; FOR_EACH_FRAME (framelist, frame) -- cgit v1.2.1 From 2735d0606bd871584b2e6343f3dce4c1a155b296 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 20:37:19 -0800 Subject: * coding.c (Fdefine_coding_system_internal): Don't redeclare 'i' inside a block, when the outer 'i' will do. (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule): (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022): (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5): (decode_coding_raw_text, decode_coding_charset, get_translation_table): (Fdecode_sjis_char, Fdefine_coding_system_internal): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise. --- src/ChangeLog | 9 +++++ src/character.h | 8 ++--- src/coding.c | 101 ++++++++++++++++++++++++++++---------------------------- 3 files changed, 63 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b88ff2ccbb4..bbcc067fecd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -41,6 +41,15 @@ * coding.c (coding_set_source, coding_set_destination): Use "else { /* comment */ }" rather than "else /* comment */;" for clarity, and to avoid gcc -Wempty-body warning. + (Fdefine_coding_system_internal): Don't redeclare 'i' inside + a block, when the outer 'i' will do. + (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule): + (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022): + (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5): + (decode_coding_raw_text, decode_coding_charset, get_translation_table): + (Fdecode_sjis_char, Fdefine_coding_system_internal): + Rename locals to avoid shadowing. + * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise. 2011-03-06 Chong Yidong diff --git a/src/character.h b/src/character.h index fb29ced66b7..d29ab41557b 100644 --- a/src/character.h +++ b/src/character.h @@ -356,11 +356,11 @@ along with GNU Emacs. If not, see . */ CHARIDX++; \ if (STRING_MULTIBYTE (STRING)) \ { \ - unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ - int len; \ + unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \ + int string_len; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \ + BYTEIDX += string_len; \ } \ else \ { \ diff --git a/src/coding.c b/src/coding.c index cb13793daba..495e8148b05 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1320,7 +1320,7 @@ decode_coding_utf_8 (struct coding_system *coding) int multibytep = coding->src_multibyte; enum utf_bom_type bom = CODING_UTF_8_BOM (coding); Lisp_Object attr, charset_list; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -1381,7 +1381,7 @@ decode_coding_utf_8 (struct coding_system *coding) } else if (UTF_8_1_OCTET_P (c1)) { - if (eol_crlf && c1 == '\r') + if (eol_dos && c1 == '\r') ONE_MORE_BYTE (byte_after_cr); c = c1; } @@ -1639,7 +1639,7 @@ decode_coding_utf_16 (struct coding_system *coding) enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); int surrogate = CODING_UTF_16_SURROGATE (coding); Lisp_Object attr, charset_list; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr1 = -1, byte_after_cr2 = -1; @@ -1736,7 +1736,7 @@ decode_coding_utf_16 (struct coding_system *coding) CODING_UTF_16_SURROGATE (coding) = surrogate = c; else { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') { ONE_MORE_BYTE (byte_after_cr1); ONE_MORE_BYTE (byte_after_cr2); @@ -1920,17 +1920,17 @@ detect_coding_emacs_mule (struct coding_system *coding, it because analyzing it is too heavy for detecting. But, at least, we check that the composite character constitutes of more than 4 bytes. */ - const unsigned char *src_base; + const unsigned char *src_start; repeat: - src_base = src; + src_start = src; do { ONE_MORE_BYTE (c); } while (c >= 0xA0); - if (src - src_base <= 4) + if (src - src_start <= 4) break; found = CATEGORY_MASK_EMACS_MULE; if (c == 0x80) @@ -1990,7 +1990,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base = src; int multibytep = coding->src_multibyte; - int charset_id; + int charset_ID; unsigned code; int c; int consumed_chars = 0; @@ -2000,7 +2000,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, if (c < 0) { c = -c; - charset_id = emacs_mule_charset[0]; + charset_ID = emacs_mule_charset[0]; } else { @@ -2036,7 +2036,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, switch (emacs_mule_bytes[c]) { case 2: - if ((charset_id = emacs_mule_charset[c]) < 0) + if ((charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2049,7 +2049,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) { ONE_MORE_BYTE (c); - if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) + if (c < 0xA0 || (charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2058,7 +2058,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, } else { - if ((charset_id = emacs_mule_charset[c]) < 0) + if ((charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2073,7 +2073,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, case 4: ONE_MORE_BYTE (c); - if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) + if (c < 0 || (charset_ID = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2087,21 +2087,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, case 1: code = c; - charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; + charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; break; default: abort (); } CODING_DECODE_CHAR (coding, src, src_base, src_end, - CHARSET_FROM_ID (charset_id), code, c); + CHARSET_FROM_ID (charset_ID), code, c); if (c < 0) goto invalid_code; } *nbytes = src - src_base; *nchars = consumed_chars; if (id) - *id = charset_id; + *id = charset_ID; return (mseq_found ? -c : c); no_more_source: @@ -2374,7 +2374,7 @@ decode_coding_emacs_mule (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; @@ -2424,7 +2424,7 @@ decode_coding_emacs_mule (struct coding_system *coding) if (c < 0x80) { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); id = charset_ascii; if (cmp_status->state != COMPOSING_NO) @@ -3160,7 +3160,7 @@ detect_coding_iso_2022 (struct coding_system *coding, if (! single_shifting && ! (rejected & CATEGORY_MASK_ISO_8_2)) { - int i = 1; + int len = 1; while (src < src_end) { src_base = src; @@ -3170,20 +3170,20 @@ detect_coding_iso_2022 (struct coding_system *coding, src = src_base; break; } - i++; + len++; } - if (i & 1 && src < src_end) + if (len & 1 && src < src_end) { rejected |= CATEGORY_MASK_ISO_8_2; if (composition_count >= 0) - composition_count += i; + composition_count += len; } else { found |= CATEGORY_MASK_ISO_8_2; if (composition_count >= 0) - composition_count += i / 2; + composition_count += len / 2; } } break; @@ -3311,10 +3311,10 @@ detect_coding_iso_2022 (struct coding_system *coding, } \ else /* new format (after ver.21) */ \ { \ - int c; \ + int b; \ \ - ONE_MORE_BYTE (c); \ - rule = COMPOSITION_ENCODE_RULE (rule - 81, c - 32); \ + ONE_MORE_BYTE (b); \ + rule = COMPOSITION_ENCODE_RULE (rule - 81, b - 32); \ if (rule >= 0) \ rule += 0x100; /* to destinguish it from the old format */ \ nbytes = 2; \ @@ -3506,7 +3506,7 @@ decode_coding_iso_2022 (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; int i; @@ -3626,7 +3626,7 @@ decode_coding_iso_2022 (struct coding_system *coding) break; case ISO_control_0: - if (eol_crlf && c1 == '\r') + if (eol_dos && c1 == '\r') ONE_MORE_BYTE (byte_after_cr); MAYBE_FINISH_COMPOSITION (); charset = CHARSET_FROM_ID (charset_ascii); @@ -4031,7 +4031,6 @@ decode_coding_iso_2022 (struct coding_system *coding) const char *intermediate_char_94 = "()*+"; \ const char *intermediate_char_96 = ",-./"; \ int revision = -1; \ - int c; \ \ if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \ revision = CHARSET_ISO_REVISION (charset); \ @@ -4044,11 +4043,12 @@ decode_coding_iso_2022 (struct coding_system *coding) EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \ if (CHARSET_DIMENSION (charset) == 1) \ { \ + int b; \ if (! CHARSET_ISO_CHARS_96 (charset)) \ - c = intermediate_char_94[reg]; \ + b = intermediate_char_94[reg]; \ else \ - c = intermediate_char_96[reg]; \ - EMIT_ONE_ASCII_BYTE (c); \ + b = intermediate_char_96[reg]; \ + EMIT_ONE_ASCII_BYTE (b); \ } \ else \ { \ @@ -4709,7 +4709,7 @@ decode_coding_sjis (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -4744,7 +4744,7 @@ decode_coding_sjis (struct coding_system *coding) goto invalid_code; if (c < 0x80) { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); charset = charset_roman; } @@ -4826,7 +4826,7 @@ decode_coding_big5 (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -4859,7 +4859,7 @@ decode_coding_big5 (struct coding_system *coding) goto invalid_code; if (c < 0x80) { - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); charset = charset_roman; } @@ -5263,13 +5263,13 @@ encode_coding_ccl (struct coding_system *coding) static void decode_coding_raw_text (struct coding_system *coding) { - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); coding->chars_at_source = 1; coding->consumed_char = coding->src_chars; coding->consumed = coding->src_bytes; - if (eol_crlf && coding->source[coding->src_bytes - 1] == '\r') + if (eol_dos && coding->source[coding->src_bytes - 1] == '\r') { coding->consumed_char--; coding->consumed--; @@ -5482,7 +5482,7 @@ decode_coding_charset (struct coding_system *coding) int char_offset = coding->produced_char; int last_offset = char_offset; int last_id = charset_ascii; - int eol_crlf = + int eol_dos = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); int byte_after_cr = -1; @@ -5516,7 +5516,7 @@ decode_coding_charset (struct coding_system *coding) else { ONE_MORE_BYTE (c); - if (eol_crlf && c == '\r') + if (eol_dos && c == '\r') ONE_MORE_BYTE (byte_after_cr); } if (c < 0) @@ -6609,15 +6609,15 @@ get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup) } else if (CONSP (translation_table)) { - Lisp_Object tail, val; + Lisp_Object tail; for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) if (CHAR_TABLE_P (XCAR (tail)) && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) { - val = XCHAR_TABLE (XCAR (tail))->extras[1]; - if (NATNUMP (val) && *max_lookup < XFASTINT (val)) - *max_lookup = XFASTINT (val); + Lisp_Object tailval = XCHAR_TABLE (XCAR (tail))->extras[1]; + if (NATNUMP (tailval) && *max_lookup < XFASTINT (tailval)) + *max_lookup = XFASTINT (tailval); } } } @@ -9114,10 +9114,10 @@ Return the corresponding character. */) } else { - int s1 = c >> 8, s2 = c & 0xFF; + int c1 = c >> 8, c2 = c & 0xFF; - if (s1 < 0x81 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF - || s2 < 0x40 || s2 == 0x7F || s2 > 0xFC) + if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF + || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC) error ("Invalid code: %d", code); SJIS_TO_JIS (c); charset = charset_kanji; @@ -9800,7 +9800,6 @@ usage: (define-coding-system-internal ...) */) else if (EQ (coding_type, Qiso_2022)) { Lisp_Object initial, reg_usage, request, flags; - int i; if (nargs < coding_arg_iso2022_max) goto short_args; @@ -9832,12 +9831,12 @@ usage: (define-coding-system-internal ...) */) for (tail = request; ! NILP (tail); tail = Fcdr (tail)) { int id; - Lisp_Object tmp; + Lisp_Object tmp1; val = Fcar (tail); CHECK_CONS (val); - tmp = XCAR (val); - CHECK_CHARSET_GET_ID (tmp, id); + tmp1 = XCAR (val); + CHECK_CHARSET_GET_ID (tmp1, id); CHECK_NATNUM_CDR (val); if (XINT (XCDR (val)) >= 4) error ("Invalid graphic register number: %d", XINT (XCDR (val))); -- cgit v1.2.1 From e2f1bab96318b2809aad624ee9bbbdfd7fd6dd6e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 20:41:22 -0800 Subject: * coding.c (emacs_mule_char, encode_invocation_designation): Now static, since they're not used elsewhere. --- src/ChangeLog | 2 ++ src/coding.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bbcc067fecd..3a5a4c97628 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -50,6 +50,8 @@ (Fdecode_sjis_char, Fdefine_coding_system_internal): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise. + * coding.c (emacs_mule_char, encode_invocation_designation): + Now static, since they're not used elsewhere. 2011-03-06 Chong Yidong diff --git a/src/coding.c b/src/coding.c index 495e8148b05..4fdbd1fd752 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1982,7 +1982,7 @@ detect_coding_emacs_mule (struct coding_system *coding, the decoded character or rule. If an invalid byte is found, return -1. If SRC is too short, return -2. */ -int +static int emacs_mule_char (struct coding_system *coding, const unsigned char *src, int *nbytes, int *nchars, int *id, struct composition_status *cmp_status) @@ -4228,7 +4228,7 @@ decode_coding_iso_2022 (struct coding_system *coding) to use CHARSET. The element `spec.iso_2022' of *CODING is updated. Return new DST. */ -unsigned char * +static unsigned char * encode_invocation_designation (struct charset *charset, struct coding_system *coding, unsigned char *dst, int *p_nchars) -- cgit v1.2.1 From 413bb2db753528a2e4bd70f8bbabcd232b11b6d7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 21:28:41 -0800 Subject: * coding.c (decode_coding_iso_2022): Add "default: abort ();" as a safety check. --- src/ChangeLog | 1 + src/coding.c | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3a5a4c97628..1b518a6341c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -52,6 +52,7 @@ * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise. * coding.c (emacs_mule_char, encode_invocation_designation): Now static, since they're not used elsewhere. + (decode_coding_iso_2022): Add "default: abort ();" as a safety check. 2011-03-06 Chong Yidong diff --git a/src/coding.c b/src/coding.c index 4fdbd1fd752..c9d32489351 100644 --- a/src/coding.c +++ b/src/coding.c @@ -3899,6 +3899,10 @@ decode_coding_iso_2022 (struct coding_system *coding) } continue; } + break; + + default: + abort (); } if (cmp_status->state == COMPOSING_NO -- cgit v1.2.1 From c4a63b128d3f8405fa1037e0c22bd8fabcbdd123 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:12:45 -0800 Subject: * coding.c: (decode_coding_object, encode_coding_object, detect_coding_system): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. --- src/ChangeLog | 3 +++ src/coding.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1b518a6341c..ae111aef44c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -53,6 +53,9 @@ * coding.c (emacs_mule_char, encode_invocation_designation): Now static, since they're not used elsewhere. (decode_coding_iso_2022): Add "default: abort ();" as a safety check. + (decode_coding_object, encode_coding_object, detect_coding_system): + Mark variables that gcc -Wuninitialized does not deduce are never + used uninitialized. 2011-03-06 Chong Yidong diff --git a/src/coding.c b/src/coding.c index c9d32489351..75fc92eee8d 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7658,12 +7658,12 @@ decode_coding_object (struct coding_system *coding, Lisp_Object dst_object) { int count = SPECPDL_INDEX (); - unsigned char *destination; - EMACS_INT dst_bytes; + unsigned char *destination IF_LINT (= NULL); + EMACS_INT dst_bytes IF_LINT (= 0); EMACS_INT chars = to - from; EMACS_INT bytes = to_byte - from_byte; Lisp_Object attrs; - int saved_pt = -1, saved_pt_byte; + int saved_pt = -1, saved_pt_byte IF_LINT (= 0); int need_marker_adjustment = 0; Lisp_Object old_deactivate_mark; @@ -7851,7 +7851,7 @@ encode_coding_object (struct coding_system *coding, EMACS_INT chars = to - from; EMACS_INT bytes = to_byte - from_byte; Lisp_Object attrs; - int saved_pt = -1, saved_pt_byte; + int saved_pt = -1, saved_pt_byte IF_LINT (= 0); int need_marker_adjustment = 0; int kill_src_buffer = 0; Lisp_Object old_deactivate_mark; @@ -8184,8 +8184,8 @@ detect_coding_system (const unsigned char *src, base_category = XINT (CODING_ATTR_CATEGORY (attrs)); if (base_category == coding_category_undecided) { - enum coding_category category; - struct coding_system *this; + enum coding_category category IF_LINT (= 0); + struct coding_system *this IF_LINT (= NULL); int c, i; /* Skip all ASCII bytes except for a few ISO2022 controls. */ -- cgit v1.2.1 From 5f58e762f919864376efe785253006590a1e4dc5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:23:55 -0800 Subject: * coding.c: (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT): (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P): (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER): (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R): Remove unused macros. --- src/ChangeLog | 5 +++++ src/coding.c | 57 +-------------------------------------------------------- 2 files changed, 6 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ae111aef44c..fdc9fb126ed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -56,6 +56,11 @@ (decode_coding_object, encode_coding_object, detect_coding_system): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. + (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT): + (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P): + (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER): + (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R): + Remove unused macros. 2011-03-06 Chong Yidong diff --git a/src/coding.c b/src/coding.c index 75fc92eee8d..3df34cea173 100644 --- a/src/coding.c +++ b/src/coding.c @@ -395,8 +395,6 @@ Lisp_Object Vbig5_coding_system; /* Control characters of ISO2022. */ /* code */ /* function */ -#define ISO_CODE_LF 0x0A /* line-feed */ -#define ISO_CODE_CR 0x0D /* carriage-return */ #define ISO_CODE_SO 0x0E /* shift-out */ #define ISO_CODE_SI 0x0F /* shift-in */ #define ISO_CODE_SS2_7 0x19 /* single-shift-2 for 7-bit code */ @@ -479,7 +477,7 @@ enum iso_code_class_type #define CODING_ISO_FLAG_COMPOSITION 0x2000 -#define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 +/* #define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 */ #define CODING_ISO_FLAG_USE_ROMAN 0x8000 @@ -721,25 +719,6 @@ static struct coding_system coding_categories[coding_category_max]; } while (0) -#define ONE_MORE_BYTE_NO_CHECK(c) \ - do { \ - c = *src++; \ - if (multibytep && (c & 0x80)) \ - { \ - if ((c & 0xFE) == 0xC0) \ - c = ((c & 1) << 6) | *src++; \ - else \ - { \ - src--; \ - c = - string_char (src, &src, NULL); \ - record_conversion_result \ - (coding, CODING_RESULT_INVALID_SRC); \ - } \ - } \ - consumed_chars++; \ - } while (0) - - /* Store a byte C in the place pointed by DST and increment DST to the next free point, and increment PRODUCED_CHARS. The caller should assure that C is 0..127, and declare and set the variable `dst' @@ -1219,7 +1198,6 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes, #define UTF_8_4_OCTET_LEADING_P(c) (((c) & 0xF8) == 0xF0) #define UTF_8_5_OCTET_LEADING_P(c) (((c) & 0xFC) == 0xF8) -#define UTF_BOM 0xFEFF #define UTF_8_BOM_1 0xEF #define UTF_8_BOM_2 0xBB #define UTF_8_BOM_3 0xBF @@ -1535,11 +1513,6 @@ encode_coding_utf_8 (struct coding_system *coding) #define UTF_16_LOW_SURROGATE_P(val) \ (((val) & 0xFC00) == 0xDC00) -#define UTF_16_INVALID_P(val) \ - (((val) == 0xFFFE) \ - || ((val) == 0xFFFF) \ - || UTF_16_LOW_SURROGATE_P (val)) - static int detect_coding_utf_16 (struct coding_system *coding, @@ -2905,10 +2878,6 @@ enum iso_code_class_type iso_code_class[256]; ((id) <= (coding)->max_charset_id \ && (coding)->safe_charsets[id] != 255) - -#define SHIFT_OUT_OK(category) \ - (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0) - static void setup_iso_safe_charsets (Lisp_Object attrs) { @@ -4295,30 +4264,6 @@ encode_invocation_designation (struct charset *charset, return dst; } -/* The following three macros produce codes for indicating direction - of text. */ -#define ENCODE_CONTROL_SEQUENCE_INTRODUCER \ - do { \ - if (CODING_ISO_FLAGS (coding) == CODING_ISO_FLAG_SEVEN_BITS) \ - EMIT_TWO_ASCII_BYTES (ISO_CODE_ESC, '['); \ - else \ - EMIT_ONE_BYTE (ISO_CODE_CSI); \ - } while (0) - - -#define ENCODE_DIRECTION_R2L() \ - do { \ - ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \ - EMIT_TWO_ASCII_BYTES ('2', ']'); \ - } while (0) - - -#define ENCODE_DIRECTION_L2R() \ - do { \ - ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \ - EMIT_TWO_ASCII_BYTES ('0', ']'); \ - } while (0) - /* Produce codes for designation and invocation to reset the graphic planes and registers to initial state. */ -- cgit v1.2.1 From ee05f96119932f5e4f33b59e1a2f4abdd9c0a34a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:34:38 -0800 Subject: * coding.c (decode_coding_emacs_mule): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. --- src/ChangeLog | 4 ++-- src/coding.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fdc9fb126ed..07a7c1736ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -54,8 +54,8 @@ Now static, since they're not used elsewhere. (decode_coding_iso_2022): Add "default: abort ();" as a safety check. (decode_coding_object, encode_coding_object, detect_coding_system): - Mark variables that gcc -Wuninitialized does not deduce are never - used uninitialized. + (decode_coding_emacs_mule): Mark variables that gcc + -Wuninitialized does not deduce are never used uninitialized. (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT): (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P): (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER): diff --git a/src/coding.c b/src/coding.c index 3df34cea173..096268d1a72 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2365,7 +2365,7 @@ decode_coding_emacs_mule (struct coding_system *coding) while (1) { - int c, id; + int c, id IF_LINT (= 0); src_base = src; consumed_chars_base = consumed_chars; @@ -2410,7 +2410,7 @@ decode_coding_emacs_mule (struct coding_system *coding) } else { - int nchars, nbytes; + int nchars IF_LINT (= 0), nbytes IF_LINT (= 0); /* emacs_mule_char can load a charset map from a file, which allocates a large structure and might cause buffer text to be relocated as result. Thus, we need to remember the -- cgit v1.2.1 From 160b01f65a12a9e6893c270662d6ae249a1db300 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:36:31 -0800 Subject: * coding.c (detect_coding_iso_2022): Initialize a local variable that might be used uninitialized. Leave a FIXME because it's not clear that this initialization is needed. --- src/ChangeLog | 3 +++ src/coding.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 07a7c1736ce..2020fa3bb11 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -56,6 +56,9 @@ (decode_coding_object, encode_coding_object, detect_coding_system): (decode_coding_emacs_mule): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. + (detect_coding_iso_2022): Initialize a local variable that might + be used uninitialized. Leave a FIXME because it's not clear that + this initialization is needed. (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT): (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P): (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER): diff --git a/src/coding.c b/src/coding.c index 096268d1a72..9a6a4484e50 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2954,7 +2954,12 @@ detect_coding_iso_2022 (struct coding_system *coding, const unsigned char *src_end = coding->source + coding->src_bytes; int multibytep = coding->src_multibyte; int single_shifting = 0; - int id; + + /* FIXME: Does ID need to be initialized here? The "End of composition" + code below does not initialize ID even though ID is used + afterwards, and perhaps that is a bug. */ + int id = 0; + int c, c1; int consumed_chars = 0; int i; -- cgit v1.2.1 From 232b38b960b67b75f6c6ce47426ce49488ad9d15 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:38:52 -0800 Subject: * category.c (hash_get_category_set): Remove unused local var. --- src/ChangeLog | 2 ++ src/category.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2020fa3bb11..a073e269091 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -65,6 +65,8 @@ (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R): Remove unused macros. + * category.c (hash_get_category_set): Remove unused local var. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/category.c b/src/category.c index bcd73d3a487..abe4609d02e 100644 --- a/src/category.c +++ b/src/category.c @@ -61,7 +61,6 @@ static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object); static Lisp_Object hash_get_category_set (Lisp_Object table, Lisp_Object category_set) { - Lisp_Object val; struct Lisp_Hash_Table *h; int i; unsigned hash; @@ -538,4 +537,3 @@ See the documentation of the variable `word-combining-categories'. */); category_table_version = 0; } - -- cgit v1.2.1 From 9f3b5e6926e3a127df87e7829e30d4cd59fecbcf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:39:53 -0800 Subject: * category.c (copy_category_table): Now static, since it's not used elsewhere. --- src/ChangeLog | 1 + src/category.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a073e269091..f0a12a7c5d1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -66,6 +66,7 @@ Remove unused macros. * category.c (hash_get_category_set): Remove unused local var. + (copy_category_table): Now static, since it's not used elsewhere. 2011-03-06 Chong Yidong diff --git a/src/category.c b/src/category.c index abe4609d02e..cc7ff88474f 100644 --- a/src/category.c +++ b/src/category.c @@ -227,7 +227,7 @@ copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val) the original and the copy. This function is called recursively by binding TABLE to a sub char table. */ -Lisp_Object +static Lisp_Object copy_category_table (Lisp_Object table) { table = copy_char_table (table); -- cgit v1.2.1 From fb90da1b9b967f4dba5360615acab0e1cac37796 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:48:20 -0800 Subject: * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string): (Fregister_code_conversion_map): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/ccl.c | 57 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 31 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f0a12a7c5d1..2b894e9a511 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -68,6 +68,9 @@ * category.c (hash_get_category_set): Remove unused local var. (copy_category_table): Now static, since it's not used elsewhere. + * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string): + (Fregister_code_conversion_map): Rename locals to avoid shadowing. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/ccl.c b/src/ccl.c index 411c041b22a..5428e94c69a 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -758,18 +758,18 @@ while(0) buffer. */ #define CCL_WRITE_STRING(len) \ do { \ - int i; \ + int ccli; \ if (!dst) \ CCL_INVALID_CMD; \ else if (dst + len <= dst_end) \ { \ if (XFASTINT (ccl_prog[ic]) & 0x1000000) \ - for (i = 0; i < len; i++) \ - *dst++ = XFASTINT (ccl_prog[ic + i]) & 0xFFFFFF; \ + for (ccli = 0; ccli < len; ccli++) \ + *dst++ = XFASTINT (ccl_prog[ic + ccli]) & 0xFFFFFF; \ else \ - for (i = 0; i < len; i++) \ - *dst++ = ((XFASTINT (ccl_prog[ic + (i / 3)])) \ - >> ((2 - (i % 3)) * 8)) & 0xFF; \ + for (ccli = 0; ccli < len; ccli++) \ + *dst++ = ((XFASTINT (ccl_prog[ic + (ccli / 3)])) \ + >> ((2 - (ccli % 3)) * 8)) & 0xFF; \ } \ else \ CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ @@ -806,15 +806,15 @@ while(0) #define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \ do { \ - unsigned code; \ + unsigned ncode; \ \ - charset = char_charset ((c), (charset_list), &code); \ + charset = char_charset ((c), (charset_list), &ncode); \ if (! charset && ! NILP (charset_list)) \ - charset = char_charset ((c), Qnil, &code); \ + charset = char_charset ((c), Qnil, &ncode); \ if (charset) \ { \ (id) = CHARSET_ID (charset); \ - (encoded) = code; \ + (encoded) = ncode; \ } \ } while (0) @@ -2092,22 +2092,22 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY { const unsigned char *p = SDATA (str) + consumed_bytes; const unsigned char *endp = SDATA (str) + str_bytes; - int i = 0; + int j = 0; int *src, src_size; if (endp - p == str_chars - consumed_chars) - while (i < CCL_EXECUTE_BUF_SIZE && p < endp) - source[i++] = *p++; + while (j < CCL_EXECUTE_BUF_SIZE && p < endp) + source[j++] = *p++; else - while (i < CCL_EXECUTE_BUF_SIZE && p < endp) - source[i++] = STRING_CHAR_ADVANCE (p); - consumed_chars += i; + while (j < CCL_EXECUTE_BUF_SIZE && p < endp) + source[j++] = STRING_CHAR_ADVANCE (p); + consumed_chars += j; consumed_bytes = p - SDATA (str); if (consumed_bytes == str_bytes) ccl.last_block = NILP (contin); src = source; - src_size = i; + src_size = j; while (1) { ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE, @@ -2123,8 +2123,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); outp = outbuf + offset; } - for (i = 0; i < ccl.produced; i++) - CHAR_STRING_ADVANCE (destination[i], outp); + for (j = 0; j < ccl.produced; j++) + CHAR_STRING_ADVANCE (destination[j], outp); } else { @@ -2135,8 +2135,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); outp = outbuf + offset; } - for (i = 0; i < ccl.produced; i++) - *outp++ = destination[i]; + for (j = 0; j < ccl.produced; j++) + *outp++ = destination[j]; } src += ccl.consumed; src_size -= ccl.consumed; @@ -2253,7 +2253,7 @@ Return index number of the registered map. */) { int len = ASIZE (Vcode_conversion_map_vector); int i; - Lisp_Object index; + Lisp_Object idx; CHECK_SYMBOL (symbol); CHECK_VECTOR (map); @@ -2267,11 +2267,11 @@ Return index number of the registered map. */) if (EQ (symbol, XCAR (slot))) { - index = make_number (i); + idx = make_number (i); XSETCDR (slot, map); Fput (symbol, Qcode_conversion_map, map); - Fput (symbol, Qcode_conversion_map_id, index); - return index; + Fput (symbol, Qcode_conversion_map_id, idx); + return idx; } } @@ -2279,11 +2279,11 @@ Return index number of the registered map. */) Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector, len * 2, Qnil); - index = make_number (i); + idx = make_number (i); Fput (symbol, Qcode_conversion_map, map); - Fput (symbol, Qcode_conversion_map_id, index); + Fput (symbol, Qcode_conversion_map_id, idx); ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map)); - return index; + return idx; } @@ -2341,4 +2341,3 @@ used by CCL. */); defsubr (&Sregister_ccl_program); defsubr (&Sregister_code_conversion_map); } - -- cgit v1.2.1 From d0891610cbb712da0acf7ef435a93b7b2d37579d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 23:49:41 -0800 Subject: * character.c (string_count_byte8): Likewise. --- src/ChangeLog | 1 + src/character.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2b894e9a511..8102f455802 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -67,6 +67,7 @@ * category.c (hash_get_category_set): Remove unused local var. (copy_category_table): Now static, since it's not used elsewhere. + * character.c (string_count_byte8): Likewise. * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string): (Fregister_code_conversion_map): Rename locals to avoid shadowing. diff --git a/src/character.c b/src/character.c index 6f3312fec29..fdaf22f04f8 100644 --- a/src/character.c +++ b/src/character.c @@ -786,7 +786,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, i } -EMACS_INT +static EMACS_INT string_count_byte8 (Lisp_Object string) { int multibyte = STRING_MULTIBYTE (string); -- cgit v1.2.1 From fb93dbc227d09c5ec433b5f637fd677e2536a988 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 00:08:41 -0800 Subject: * chartab.c (copy_sub_char_table): Now static, since it's not used elsewhere. --- src/ChangeLog | 3 +++ src/chartab.c | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8102f455802..90804f01b3b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -72,6 +72,9 @@ * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string): (Fregister_code_conversion_map): Rename locals to avoid shadowing. + * chartab.c (copy_sub_char_table): Now static, since it's not used + elsewhere. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/chartab.c b/src/chartab.c index cd8aa784eb4..413d3f39e79 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -118,7 +118,7 @@ char_table_ascii (Lisp_Object table) return XSUB_CHAR_TABLE (sub)->contents[0]; } -Lisp_Object +static Lisp_Object copy_sub_char_table (Lisp_Object table) { Lisp_Object copy; @@ -951,7 +951,7 @@ map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), map_charset_chars. */ void -map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), +map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object function, Lisp_Object table, Lisp_Object arg, struct charset *charset, unsigned from, unsigned to) @@ -1012,4 +1012,3 @@ syms_of_chartab (void) defsubr (&Soptimize_char_table); defsubr (&Smap_char_table); } - -- cgit v1.2.1 From 5c156ace080f89b44c73cd78d404c7263fe2003e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 00:12:00 -0800 Subject: * chartab.c: (sub_char_table_ref_and_range, char_table_ref_and_range): Rename locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/chartab.c | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 90804f01b3b..ccd0578cf38 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -74,6 +74,8 @@ * chartab.c (copy_sub_char_table): Now static, since it's not used elsewhere. + (sub_char_table_ref_and_range, char_table_ref_and_range): + Rename locals to avoid shadowing. 2011-03-06 Chong Yidong diff --git a/src/chartab.c b/src/chartab.c index 413d3f39e79..ec5b2ffab76 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -216,16 +216,16 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp int depth = XINT (tbl->depth); int min_char = XINT (tbl->min_char); int max_char = min_char + chartab_chars[depth - 1] - 1; - int index = CHARTAB_IDX (c, depth, min_char), idx; + int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; Lisp_Object val; - val = tbl->contents[index]; + val = tbl->contents[chartab_idx]; if (SUB_CHAR_TABLE_P (val)) val = sub_char_table_ref_and_range (val, c, from, to, defalt); else if (NILP (val)) val = defalt; - idx = index; + idx = chartab_idx; while (idx > 0 && *from < min_char + idx * chartab_chars[depth]) { Lisp_Object this_val; @@ -244,13 +244,13 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp break; } } - while ((c = min_char + (index + 1) * chartab_chars[depth]) <= max_char + while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char && *to >= c) { Lisp_Object this_val; - index++; - this_val = tbl->contents[index]; + chartab_idx++; + this_val = tbl->contents[chartab_idx]; if (SUB_CHAR_TABLE_P (this_val)) this_val = sub_char_table_ref_and_range (this_val, c, from, to, defalt); else if (NILP (this_val)) @@ -275,10 +275,10 @@ Lisp_Object char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); - int index = CHARTAB_IDX (c, 0, 0), idx; + int chartab_idx = CHARTAB_IDX (c, 0, 0), idx; Lisp_Object val; - val = tbl->contents[index]; + val = tbl->contents[chartab_idx]; if (*from < 0) *from = 0; if (*to < 0) @@ -288,7 +288,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) else if (NILP (val)) val = tbl->defalt; - idx = index; + idx = chartab_idx; while (*from < idx * chartab_chars[0]) { Lisp_Object this_val; @@ -308,13 +308,13 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) break; } } - while (*to >= (index + 1) * chartab_chars[0]) + while (*to >= (chartab_idx + 1) * chartab_chars[0]) { Lisp_Object this_val; - index++; - c = index * chartab_chars[0]; - this_val = tbl->contents[index]; + chartab_idx++; + c = chartab_idx * chartab_chars[0]; + this_val = tbl->contents[chartab_idx]; if (SUB_CHAR_TABLE_P (this_val)) this_val = sub_char_table_ref_and_range (this_val, c, from, to, tbl->defalt); -- cgit v1.2.1 From bbcd0949d9cd085b6838c03f3d89171f967372fa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 00:13:36 -0800 Subject: * chartab.c (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros. --- src/ChangeLog | 1 + src/chartab.c | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ccd0578cf38..7f179c13420 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -76,6 +76,7 @@ elsewhere. (sub_char_table_ref_and_range, char_table_ref_and_range): Rename locals to avoid shadowing. + (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros. 2011-03-06 Chong Yidong diff --git a/src/chartab.c b/src/chartab.c index ec5b2ffab76..85aa5932ac3 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -331,20 +331,6 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) } -#define ASET_RANGE(ARRAY, FROM, TO, LIMIT, VAL) \ - do { \ - int limit = (TO) < (LIMIT) ? (TO) : (LIMIT); \ - for (; (FROM) < limit; (FROM)++) (ARRAY)->contents[(FROM)] = (VAL); \ - } while (0) - -#define GET_SUB_CHAR_TABLE(TABLE, SUBTABLE, IDX, DEPTH, MIN_CHAR) \ - do { \ - (SUBTABLE) = (TABLE)->contents[(IDX)]; \ - if (!SUB_CHAR_TABLE_P (SUBTABLE)) \ - (SUBTABLE) = make_sub_char_table ((DEPTH), (MIN_CHAR), (SUBTABLE)); \ - } while (0) - - static void sub_char_table_set (Lisp_Object table, int c, Lisp_Object val) { -- cgit v1.2.1 From 7d3b386272126dc07ab5d0a2008832cec9d0fdcc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 00:23:12 -0800 Subject: * bidi.c (bidi_check_type): Now static, since it's not used elsewhere. --- src/ChangeLog | 2 ++ src/bidi.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7f179c13420..b6bc36e10ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -78,6 +78,8 @@ Rename locals to avoid shadowing. (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros. + * bidi.c (bidi_check_type): Now static, since it's not used elsewhere. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/bidi.c b/src/bidi.c index eeacf65bd5c..1289798dd8c 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -180,7 +180,7 @@ bidi_get_type (int ch, bidi_dir_t override) } } -void +static void bidi_check_type (bidi_type_t type) { if (type < UNKNOWN_BT || type > NEUTRAL_ON) -- cgit v1.2.1 From 5b555da1c99bc5b266727fa532c2f89eb8d033dd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 00:26:27 -0800 Subject: * dispextern.h (bidi_dump_cached_states): Likewise. --- src/ChangeLog | 1 + src/dispextern.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b6bc36e10ce..4bf04043ab9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -27,6 +27,7 @@ does not deduce are never used uninitialized. * window.h (check_all_windows): New decl, to forestall gcc -Wmissing-prototypes diagnostic. + * dispextern.h (bidi_dump_cached_states): Likewise. * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid shadowing. diff --git a/src/dispextern.h b/src/dispextern.h index 37ae7ee5fd5..30979d487ff 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2944,6 +2944,7 @@ enum tool_bar_item_image extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *); extern void bidi_move_to_visually_next (struct bidi_it *); +extern void bidi_dump_cached_states (void); extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int); extern int bidi_mirror_char (int); -- cgit v1.2.1 From 0afb4571a7b54dc7693e605f7ec8a0a3a9251b4d Mon Sep 17 00:00:00 2001 From: Jan D Date: Tue, 8 Mar 2011 09:34:55 +0100 Subject: Updates for compiling with Gtk+ 3.0 (--with-x-toolkit=gtk3). * configure.in: Require 3.0 for --with-gtk3. Add HAVE_GTK3. * doc/emacs/xresources.texi (GTK resources): ~/.emacs.d/gtkrc does not work for Gtk+ 3. * src/gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define gdk_window_get_screen, gdk_window_get_geometry, gdk_x11_window_lookup_for_display and GDK_KEY_g. (xg_set_screen): Use DEFAULT_GDK_DISPLAY. (xg_get_pixbuf_from_pixmap): New function. (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap to Pixmap, take frame as parameter, remove GdkColormap parameter. Call xg_get_pixbuf_from_pixmap instead of gdk_pixbuf_get_from_drawable. (xg_get_image_for_pixmap): Do not make GdkPixmaps, call xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead. (xg_check_special_colors): Use GtkStyleContext and its functions for HAVE_GTK3. (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. (xg_prepare_tooltip, create_dialog, menubar_map_cb) (xg_update_frame_menubar, xg_tool_bar_detach_callback) (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call gtk_widget_get_preferred_size. (xg_frame_resized): gdk_window_get_geometry only takes 5 parameters. (xg_win_to_widget, xg_event_is_for_menubar): Call gdk_x11_window_lookup_for_display. (xg_set_widget_bg): New function. (delete_cb): New function. (xg_create_frame_widgets): connect delete-event to delete_cb. Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3 (xg_set_background_color): Call xg_set_widget_bg. (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask. (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3. Only call gtk_range_set_update_policy if ! HAVE_GTK3. (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback if ! HAVE_GTK3. (update_frame_tool_bar): Call gtk_widget_hide. (xg_initialize): Use GDK_KEY_g. * src/xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size. * src/xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id if ! HAVE_GTK3 (x_session_initialize): Call gdk_x11_set_sm_client_id. * src/xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3. (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS. Load ~/emacs.d/gtkrc only for ! HAVE_GTK3. * src/xterm.h (DEFAULT_GDK_DISPLAY): New define. (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines for ! HAVE_GTK3. (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID. --- src/ChangeLog | 52 ++++++++++++ src/config.in | 3 + src/gtkutil.c | 267 ++++++++++++++++++++++++++++++++++++++-------------------- src/xmenu.c | 2 +- src/xsmfns.c | 6 +- src/xterm.c | 29 ++++++- src/xterm.h | 13 ++- 7 files changed, 277 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b73e3d0c860..ff5ee064a92 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,55 @@ +2011-03-08 Jan Djärv + + * xterm.h (DEFAULT_GDK_DISPLAY): New define. + (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines + for ! HAVE_GTK3. + (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID. + + * xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size. + + * gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define + gdk_window_get_screen, gdk_window_get_geometry, + gdk_x11_window_lookup_for_display and GDK_KEY_g. + (xg_set_screen): Use DEFAULT_GDK_DISPLAY. + (xg_get_pixbuf_from_pixmap): New function. + (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap + to Pixmap, take frame as parameter, remove GdkColormap parameter. + Call xg_get_pixbuf_from_pixmap instead of + gdk_pixbuf_get_from_drawable. + (xg_get_image_for_pixmap): Do not make GdkPixmaps, call + xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead. + (xg_check_special_colors): Use GtkStyleContext and its functions + for HAVE_GTK3. + (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. + (xg_prepare_tooltip, create_dialog, menubar_map_cb) + (xg_update_frame_menubar, xg_tool_bar_detach_callback) + (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call + gtk_widget_get_preferred_size. + (xg_frame_resized): gdk_window_get_geometry only takes 5 + parameters. + (xg_win_to_widget, xg_event_is_for_menubar): Call + gdk_x11_window_lookup_for_display. + (xg_set_widget_bg): New function. + (delete_cb): New function. + (xg_create_frame_widgets): connect delete-event to delete_cb. + Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3 + (xg_set_background_color): Call xg_set_widget_bg. + (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask. + (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3. + Only call gtk_range_set_update_policy if ! HAVE_GTK3. + (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback + if ! HAVE_GTK3. + (update_frame_tool_bar): Call gtk_widget_hide. + (xg_initialize): Use GDK_KEY_g. + + * xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id + if ! HAVE_GTK3 + (x_session_initialize): Call gdk_x11_set_sm_client_id. + + * xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3. + (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS. + Load ~/emacs.d/gtkrc only for ! HAVE_GTK3. + 2011-03-08 Juanma Barranquero * w32xfns.c (select_palette): Check success of RealizePalette against diff --git a/src/config.in b/src/config.in index 7f33727c0b1..8889213b781 100644 --- a/src/config.in +++ b/src/config.in @@ -285,6 +285,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `grantpt' function. */ #undef HAVE_GRANTPT +/* Define to 1 if using GTK 3 or later. */ +#undef HAVE_GTK3 + /* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */ #undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE diff --git a/src/gtkutil.c b/src/gtkutil.c index 6ecd5d624af..b1ea6336eb6 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -40,6 +40,10 @@ along with GNU Emacs. If not, see . */ #include #endif +#ifdef HAVE_GTK3 +#include +#endif + #define FRAME_TOTAL_PIXEL_HEIGHT(f) \ (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) @@ -69,6 +73,15 @@ along with GNU Emacs. If not, see . */ #define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) #endif +#ifndef HAVE_GTK3 +#define gdk_window_get_screen(w) gdk_drawable_get_screen (w) +#define gdk_window_get_geometry(w, a, b, c, d) \ + gdk_window_get_geometry (w, a, b, c, d, 0) +#define gdk_x11_window_lookup_for_display(d, w) \ + gdk_xid_table_lookup_for_display (d, w) +#define GDK_KEY_g GDK_g +#endif + #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) @@ -88,7 +101,7 @@ static GdkDisplay *gdpy_def; static void xg_set_screen (GtkWidget *w, FRAME_PTR f) { - if (FRAME_X_DISPLAY (f) != GDK_DISPLAY ()) + if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ()) { GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); GdkScreen *gscreen = gdk_display_get_default_screen (gdpy); @@ -229,29 +242,55 @@ xg_create_default_cursor (Display *dpy) return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); } +static GdkPixbuf * +xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix) +{ + int iunused; + GdkPixbuf *tmp_buf; + Window wunused; + unsigned int width, height, uunused; + XImage *xim; + + XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused, + &width, &height, &uunused, &uunused); + + xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height, + ~0, XYPixmap); + if (!xim) return 0; + + tmp_buf = gdk_pixbuf_new_from_data (xim->data, + GDK_COLORSPACE_RGB, + FALSE, + xim->bitmap_unit, + (int) width, + (int) height, + xim->bytes_per_line, + NULL, + NULL); + XDestroyImage (xim); + return tmp_buf; +} + /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ static GdkPixbuf * -xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, - GdkPixmap *gmask, - GdkColormap *cmap) +xg_get_pixbuf_from_pix_and_mask (FRAME_PTR f, + Pixmap pix, + Pixmap mask) { int width, height; GdkPixbuf *icon_buf, *tmp_buf; - gdk_drawable_get_size (gpix, &width, &height); - tmp_buf = gdk_pixbuf_get_from_drawable (NULL, gpix, cmap, - 0, 0, 0, 0, width, height); + tmp_buf = xg_get_pixbuf_from_pixmap (f, pix); icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0); g_object_unref (G_OBJECT (tmp_buf)); - if (gmask) + width = gdk_pixbuf_get_width (icon_buf); + height = gdk_pixbuf_get_height (icon_buf); + + if (mask) { - GdkPixbuf *mask_buf = gdk_pixbuf_get_from_drawable (NULL, - gmask, - NULL, - 0, 0, 0, 0, - width, height); + GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask); guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); int rowstride = gdk_pixbuf_get_rowstride (icon_buf); @@ -316,10 +355,6 @@ xg_get_image_for_pixmap (FRAME_PTR f, GtkWidget *widget, GtkImage *old_widget) { - GdkPixmap *gpix; - GdkPixmap *gmask; - GdkDisplay *gdpy; - GdkColormap *cmap; GdkPixbuf *icon_buf; /* If we have a file, let GTK do all the image handling. @@ -347,10 +382,6 @@ xg_get_image_for_pixmap (FRAME_PTR f, on a monochrome display, and sometimes bad on all displays with certain themes. */ - gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap); - gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0; - /* This is a workaround to make icons look good on pseudo color displays. Apparently GTK expects the images to have an alpha channel. If they don't, insensitive and activated icons will @@ -360,18 +391,17 @@ xg_get_image_for_pixmap (FRAME_PTR f, not associated with the img->pixmap. The img->pixmap may be removed by clearing the image cache and then the tool bar redraw fails, since Gtk+ assumes the pixmap is always there. */ - cmap = gtk_widget_get_colormap (widget); - icon_buf = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap); - - if (! old_widget) - old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); - else - gtk_image_set_from_pixbuf (old_widget, icon_buf); + icon_buf = xg_get_pixbuf_from_pix_and_mask (f, img->pixmap, img->mask); - g_object_unref (G_OBJECT (icon_buf)); + if (icon_buf) + { + if (! old_widget) + old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); + else + gtk_image_set_from_pixbuf (old_widget, icon_buf); - g_object_unref (G_OBJECT (gpix)); - if (gmask) g_object_unref (G_OBJECT (gmask)); + g_object_unref (G_OBJECT (icon_buf)); + } return GTK_WIDGET (old_widget); } @@ -514,28 +544,43 @@ xg_check_special_colors (struct frame *f, XColor *color) { int success_p = 0; - if (FRAME_GTK_WIDGET (f)) - { - if (strcmp ("gtk_selection_bg_color", color_name) == 0) - { - GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); - color->red = gsty->bg[GTK_STATE_SELECTED].red; - color->green = gsty->bg[GTK_STATE_SELECTED].green; - color->blue = gsty->bg[GTK_STATE_SELECTED].blue; - color->pixel = gsty->bg[GTK_STATE_SELECTED].pixel; - success_p = 1; - } - else if (strcmp ("gtk_selection_fg_color", color_name) == 0) - { - GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); - color->red = gsty->fg[GTK_STATE_SELECTED].red; - color->green = gsty->fg[GTK_STATE_SELECTED].green; - color->blue = gsty->fg[GTK_STATE_SELECTED].blue; - color->pixel = gsty->fg[GTK_STATE_SELECTED].pixel; - success_p = 1; - } - } + int get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0; + int get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0; + + if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) + return success_p; + + BLOCK_INPUT; + { +#ifdef HAVE_GTK3 + GtkStyleContext *gsty + = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f)); + GdkRGBA col; + char buf[64]; + int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED; + if (get_fg) + gtk_style_context_get_color (gsty, state, &col); + else + gtk_style_context_get_background_color (gsty, state, &col); + + sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue); + success_p = XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), + buf, color); +#else + GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); + GdkColor *grgb = get_bg + ? &gsty->bg[GTK_STATE_SELECTED] + : &gsty->fg[GTK_STATE_SELECTED]; + + color->red = grgb->red; + color->green = grgb->green; + color->blue = grgb->blue; + color->pixel = grgb->pixel; + success_p = 1; +#endif + } + UNBLOCK_INPUT; return success_p; } @@ -629,7 +674,7 @@ xg_prepare_tooltip (FRAME_PTR f, encoded_string = ENCODE_UTF_8 (string); widget = GTK_WIDGET (x->ttip_lbl); gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); - screen = gdk_drawable_get_screen (gwin); + screen = gdk_window_get_screen (gwin); settings = gtk_settings_get_for_screen (screen); g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL); if (tt_enabled) @@ -650,7 +695,7 @@ xg_prepare_tooltip (FRAME_PTR f, gtk_tooltip_set_custom (x->ttip_widget, widget); gtk_tooltip_set_text (x->ttip_widget, SDATA (encoded_string)); - gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (x->ttip_window), NULL, &req); if (width) *width = req.width; if (height) *height = req.height; @@ -696,7 +741,7 @@ xg_hide_tooltip (FRAME_PTR f) if (g_object_get_data (G_OBJECT (win), "restore-tt")) { GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win)); - GdkScreen *screen = gdk_drawable_get_screen (gwin); + GdkScreen *screen = gdk_window_get_screen (gwin); GtkSettings *settings = gtk_settings_get_for_screen (screen); g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); } @@ -797,7 +842,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) if (FRAME_GTK_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_WIDGET (f))) gdk_window_get_geometry (gtk_widget_get_window (FRAME_GTK_WIDGET (f)), 0, 0, - &pixelwidth, &pixelheight, 0); + &pixelwidth, &pixelheight); else return; } @@ -910,8 +955,8 @@ xg_win_to_widget (Display *dpy, Window wdesc) BLOCK_INPUT; - gdkwin = gdk_xid_table_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), - wdesc); + gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), + wdesc); if (gdkwin) { GdkEvent event; @@ -923,14 +968,29 @@ xg_win_to_widget (Display *dpy, Window wdesc) return gwdesc; } -/* Fill in the GdkColor C so that it represents PIXEL. - W is the widget that color will be used for. Used to find colormap. */ +/* Set the background of widget W to PIXEL. */ static void -xg_pix_to_gcolor (GtkWidget *w, long unsigned int pixel, GdkColor *c) +xg_set_widget_bg (FRAME_PTR f, GtkWidget *w, long unsigned int pixel) { +#ifdef HAVE_GTK3 + GdkRGBA bg; + XColor xbg; + xbg.pixel = pixel; + if (XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &xbg)) + { + bg.red = (double)xbg.red/65536.0; + bg.green = (double)xbg.green/65536.0; + bg.blue = (double)xbg.blue/65536.0; + bg.alpha = 1.0; + gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg); + } +#else + GdkColor bg; GdkColormap *map = gtk_widget_get_colormap (w); - gdk_colormap_query_color (map, pixel, c); + gdk_colormap_query_color (map, pixel, &bg); + gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &bg); +#endif } /* Callback called when the gtk theme changes. @@ -953,6 +1013,28 @@ style_changed_cb (GObject *go, kbd_buffer_store_event (&event); } +/* Called when a delete-event occurs on WIDGET. */ + +static gboolean +delete_cb (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ +#ifdef HAVE_GTK3 + /* The event doesn't arrive in the normal event loop. Send event + here. */ + FRAME_PTR f = (FRAME_PTR) user_data; + struct input_event ie; + + EVENT_INIT (ie); + ie.kind = DELETE_WINDOW_EVENT; + XSETFRAME (ie.frame_or_window, f); + kbd_buffer_store_event (&ie); +#endif + + return TRUE; +} + /* Create and set up the GTK widgets for frame F. Return 0 if creation failed, non-zero otherwise. */ @@ -962,7 +1044,6 @@ xg_create_frame_widgets (FRAME_PTR f) GtkWidget *wtop; GtkWidget *wvbox, *whbox; GtkWidget *wfixed; - GdkColor bg; GtkRcStyle *style; char *title = 0; @@ -1029,7 +1110,7 @@ xg_create_frame_widgets (FRAME_PTR f) /* Add callback to do nothing on WM_DELETE_WINDOW. The default in GTK is to destroy the widget. We want Emacs to do that instead. */ g_signal_connect (G_OBJECT (wtop), "delete-event", - G_CALLBACK (gtk_true), 0); + G_CALLBACK (delete_cb), f); /* Convert our geometry parameters into a geometry string and specify it. @@ -1057,9 +1138,9 @@ xg_create_frame_widgets (FRAME_PTR f) /* Since GTK clears its window by filling with the background color, we must keep X and GTK background in sync. */ - xg_pix_to_gcolor (wfixed, FRAME_BACKGROUND_PIXEL (f), &bg); - gtk_widget_modify_bg (wfixed, GTK_STATE_NORMAL, &bg); + xg_set_widget_bg (f, wfixed, FRAME_BACKGROUND_PIXEL (f)); +#ifndef HAVE_GTK3 /* Also, do not let any background pixmap to be set, this looks very bad as Emacs overwrites the background pixmap with its own idea of background color. */ @@ -1068,6 +1149,9 @@ xg_create_frame_widgets (FRAME_PTR f) /* Must use g_strdup because gtk_widget_modify_style does g_free. */ style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup (""); gtk_widget_modify_style (wfixed, style); +#else + gtk_widget_set_can_focus (wfixed, TRUE); +#endif #ifdef USE_GTK_TOOLTIP /* Steal a tool tip window we can move ourselves. */ @@ -1224,11 +1308,8 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg) { if (FRAME_GTK_WIDGET (f)) { - GdkColor gdk_bg; - BLOCK_INPUT; - xg_pix_to_gcolor (FRAME_GTK_WIDGET (f), bg, &gdk_bg); - gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &gdk_bg); + xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f)); UNBLOCK_INPUT; } } @@ -1240,11 +1321,10 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg) void xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask) { - GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - GdkPixmap *gpix = gdk_pixmap_foreign_new_for_display (gdpy, icon_pixmap); - GdkPixmap *gmask = gdk_pixmap_foreign_new_for_display (gdpy, icon_mask); - GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, NULL); - + GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f, + icon_pixmap, + icon_mask); + if (gp) gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), gp); } @@ -1381,7 +1461,7 @@ create_dialog (widget_value *wv, /* Try to make dialog look better. Must realize first so the widget can calculate the size it needs. */ gtk_widget_realize (w); - gtk_widget_size_request (w, &req); + gtk_widget_get_preferred_size (w, NULL, &req); gtk_box_set_spacing (wvbox, req.height); if (item->value && strlen (item->value) > 0) button_spacing = 2*req.width/strlen (item->value); @@ -3028,7 +3108,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data) { GtkRequisition req; FRAME_PTR f = (FRAME_PTR) user_data; - gtk_widget_size_request (w, &req); + gtk_widget_get_preferred_size (w, NULL, &req); if (FRAME_MENUBAR_HEIGHT (f) != req.height) { FRAME_MENUBAR_HEIGHT (f) = req.height; @@ -3059,7 +3139,7 @@ xg_update_frame_menubar (FRAME_PTR f) g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); gtk_widget_show_all (x->menubar_widget); - gtk_widget_size_request (x->menubar_widget, &req); + gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req); /* If menu bar doesn't know its height yet, cheat a little so the frame doesn't jump so much when resized later in menubar_map_cb. */ @@ -3120,7 +3200,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) return 0; gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - gw = gdk_xid_table_lookup_for_display (gdpy, event->xbutton.window); + gw = gdk_x11_window_lookup_for_display (gdpy, event->xbutton.window); if (! gw) return 0; gevent.any.window = gw; gwdesc = gtk_get_event_widget (&gevent); @@ -3284,8 +3364,12 @@ xg_create_scroll_bar (FRAME_PTR f, { GtkWidget *wscroll; GtkWidget *webox; - GtkObject *vadj; int scroll_id; +#ifdef HAVE_GTK3 + GtkAdjustment *vadj; +#else + GtkObject *vadj; +#endif /* Page, step increment values are not so important here, they will be corrected in x_set_toolkit_scroll_bar_thumb. */ @@ -3295,7 +3379,9 @@ xg_create_scroll_bar (FRAME_PTR f, wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); webox = gtk_event_box_new (); gtk_widget_set_name (wscroll, scroll_bar_name); +#ifndef HAVE_GTK3 gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS); +#endif g_object_set_data (G_OBJECT (wscroll), XG_FRAME_DATA, (gpointer)f); scroll_id = xg_store_widget_in_map (wscroll); @@ -3793,8 +3879,8 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox, { GtkRequisition req, req2; FRAME_X_OUTPUT (f)->toolbar_detached = 1; - gtk_widget_size_request (GTK_WIDGET (wbox), &req); - gtk_widget_size_request (w, &req2); + gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); + gtk_widget_get_preferred_size (w, NULL, &req2); req.width -= req2.width; req.height -= req2.height; if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) @@ -3828,8 +3914,8 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox, { GtkRequisition req, req2; FRAME_X_OUTPUT (f)->toolbar_detached = 0; - gtk_widget_size_request (GTK_WIDGET (wbox), &req); - gtk_widget_size_request (w, &req2); + gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); + gtk_widget_get_preferred_size (w, NULL, &req2); req.width += req2.width; req.height += req2.height; if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) @@ -3894,6 +3980,7 @@ xg_tool_bar_help_callback (GtkWidget *w, Returns FALSE to tell GTK to keep processing this event. */ +#ifndef HAVE_GTK3 static gboolean xg_tool_bar_item_expose_callback (GtkWidget *w, GdkEventExpose *event, @@ -3902,7 +3989,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, gint width, height; gdk_drawable_get_size (event->window, &width, &height); - event->area.x -= width > event->area.width ? width-event->area.width : 0; event->area.y -= height > event->area.height ? height-event->area.height : 0; @@ -3914,6 +4000,7 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, return FALSE; } +#endif #ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION #define toolbar_set_orientation(w, o) \ @@ -4063,13 +4150,14 @@ xg_make_tool_item (FRAME_PTR f, g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); +#ifndef HAVE_GTK3 /* Catch expose events to overcome an annoying redraw bug, see comment for xg_tool_bar_item_expose_callback. */ g_signal_connect (G_OBJECT (ti), "expose-event", G_CALLBACK (xg_tool_bar_item_expose_callback), 0); - +#endif gtk_tool_item_set_homogeneous (ti, FALSE); /* Callback to save modifyer mask (Shift/Control, etc). GTK makes @@ -4153,7 +4241,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f) GtkRequisition req; int nl = 0, nr = 0, nt = 0, nb = 0; - gtk_widget_size_request (GTK_WIDGET (x->handlebox_widget), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req); if (x->toolbar_in_hbox) { int pos; @@ -4203,7 +4291,6 @@ update_frame_tool_bar (FRAME_PTR f) GtkToolItem *ti; GtkTextDirection dir; int pack_tool_bar = x->handlebox_widget == NULL; - Lisp_Object style; int text_image, horiz; @@ -4551,13 +4638,13 @@ xg_initialize (void) /* Make dialogs close on C-g. Since file dialog inherits from dialog, this works for them also. */ binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_DIALOG)); - gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK, "close", 0); /* Make menus close on C-g. */ binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_MENU_SHELL)); - gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK, "cancel", 0); } diff --git a/src/xmenu.c b/src/xmenu.c index 934db0f0406..8967437a376 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1390,7 +1390,7 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer /* Check if there is room for the menu. If not, adjust x/y so that the menu is fully visible. */ - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req); if (data->x + req.width > disp_width) *x -= data->x + req.width - disp_width; if (data->y + req.height > disp_height) diff --git a/src/xsmfns.c b/src/xsmfns.c index 825cec451d9..f3879dbcec0 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -41,6 +41,10 @@ along with GNU Emacs. If not, see . */ #include "process.h" #include "keyboard.h" +#ifndef HAVE_GTK3 +#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w) +#endif + /* This is the event used when SAVE_SESSION_EVENT occurs. */ static struct input_event emacs_event; @@ -459,7 +463,7 @@ x_session_initialize (struct x_display_info *dpyinfo) #ifdef USE_GTK /* GTK creats a leader window by itself, but we need to tell it about our client_id. */ - gdk_set_sm_client_id (client_id); + gdk_x11_set_sm_client_id (client_id); #else create_client_leader_window (dpyinfo, client_id); #endif diff --git a/src/xterm.c b/src/xterm.c index 909b6978f5a..bb792d8b9a7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3021,6 +3021,17 @@ XTflash (struct frame *f) /* Use Gdk routines to draw. This way, we won't draw over scroll bars when the scroll bars and the edit widget share the same X window. */ GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); +#ifdef HAVE_GTK3 + cairo_t *cr = gdk_cairo_create (window); + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE); +#define XFillRectangle(d, win, gc, x, y, w, h) \ + do { \ + cairo_rectangle (cr, x, y, w, h); \ + cairo_fill (cr); \ + } \ + while (0) +#else /* ! HAVE_GTK3 */ GdkGCValues vals; GdkGC *gc; vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f) @@ -3030,7 +3041,8 @@ XTflash (struct frame *f) &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND); #define XFillRectangle(d, win, gc, x, y, w, h) \ gdk_draw_rectangle (window, gc, TRUE, x, y, w, h) -#else +#endif /* ! HAVE_GTK3 */ +#else /* ! USE_GTK */ GC gc; /* Create a GC that will use the GXxor function to flip foreground @@ -3151,7 +3163,11 @@ XTflash (struct frame *f) width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); #ifdef USE_GTK +#ifdef HAVE_GTK3 + cairo_destroy (cr); +#else g_object_unref (G_OBJECT (gc)); +#endif #undef XFillRectangle #else XFreeGC (FRAME_X_DISPLAY (f), gc); @@ -9863,6 +9879,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) XSetLocaleModifiers (""); + /* Emacs can only handle core input events, so make sure + Gtk doesn't use Xinput or Xinput2 extensions. */ + { + static char fix_events[] = "GDK_CORE_DEVICE_EVENTS=1"; + putenv (fix_events); + } + /* Work around GLib bug that outputs a faulty warning. See https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL @@ -9874,11 +9897,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) fixup_locale (); xg_initialize (); - dpy = GDK_DISPLAY (); + dpy = DEFAULT_GDK_DISPLAY (); /* NULL window -> events for all windows go to our function */ gdk_window_add_filter (NULL, event_handler_gdk, NULL); +#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90 /* Load our own gtkrc if it exists. */ { const char *file = "~/.emacs.d/gtkrc"; @@ -9890,6 +9914,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) gtk_rc_parse (SSDATA (abs_file)); } +#endif XSetErrorHandler (x_error_handler); XSetIOErrorHandler (x_io_error_quitter); diff --git a/src/xterm.h b/src/xterm.h index 48d68557796..ee17cfe2bd5 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -675,9 +675,20 @@ enum #define gtk_adjustment_get_upper(w) ((w)->upper) #endif +#ifdef HAVE_GTK3 +#define DEFAULT_GDK_DISPLAY() \ + gdk_x11_display_get_xdisplay (gdk_display_get_default ()) +#else +#undef GDK_WINDOW_XID +#define GDK_WINDOW_XID(w) GDK_WINDOW_XWINDOW (w) +#define DEFAULT_GDK_DISPLAY() GDK_DISPLAY () +#define gtk_widget_get_preferred_size(a, ign, b) \ + gtk_widget_size_request(a, b) +#endif + #define GTK_WIDGET_TO_X_WIN(w) \ ((w) && gtk_widget_get_window (w) \ - ? GDK_WINDOW_XWINDOW (gtk_widget_get_window (w)) : 0) + ? GDK_WINDOW_XID (gtk_widget_get_window (w)) : 0) #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget) #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget) -- cgit v1.2.1 From 630d6892438c5fff742a0dddb0692d2a991418e2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 09:25:52 -0800 Subject: * bidi.c (BIDI_BOB): Remove unused macro. --- src/ChangeLog | 1 + src/bidi.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4bf04043ab9..3375d985a41 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -80,6 +80,7 @@ (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros. * bidi.c (bidi_check_type): Now static, since it's not used elsewhere. + (BIDI_BOB): Remove unused macro. 2011-03-06 Chong Yidong diff --git a/src/bidi.c b/src/bidi.c index 1289798dd8c..3457e177436 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -72,7 +72,6 @@ static Lisp_Object bidi_type_table, bidi_mirror_table; #define RLO_CHAR 0x202E #define BIDI_EOB -1 -#define BIDI_BOB -2 /* FIXME: Is this needed? */ /* Local data structures. (Look in dispextern.h for the rest.) */ -- cgit v1.2.1 From 6be7d3dab6a206d26d1845e3791eaf26be1be72f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 09:28:17 -0800 Subject: * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. --- src/ChangeLog | 3 +++ src/cm.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3375d985a41..477e74483e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -82,6 +82,9 @@ * bidi.c (bidi_check_type): Now static, since it's not used elsewhere. (BIDI_BOB): Remove unused macro. + * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not + deduce are never used uninitialized. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/cm.c b/src/cm.c index d4aedad6db4..af4116f3fec 100644 --- a/src/cm.c +++ b/src/cm.c @@ -330,7 +330,7 @@ cmgoto (struct tty_display_info *tty, int row, int col) llcost, relcost, directcost; - int use; + int use IF_LINT (= 0); char *p, *dcm; @@ -460,4 +460,3 @@ Wcm_init (struct tty_display_info *tty) return - 2; return 0; } - -- cgit v1.2.1 From 72abad34056c26fce75f8ece4b66ce386f2d0725 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 09:30:15 -0800 Subject: * term.c (encode_terminal_code): Now static. --- src/ChangeLog | 2 ++ src/term.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 477e74483e6..325822a29a2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -85,6 +85,8 @@ * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. + * term.c (encode_terminal_code): Now static. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/term.c b/src/term.c index f082bb40e89..873ffaba299 100644 --- a/src/term.c +++ b/src/term.c @@ -512,7 +512,7 @@ static int encode_terminal_dst_size; Set CODING->produced to the byte-length of the resulting byte sequence, and return a pointer to that byte sequence. */ -unsigned char * +static unsigned char * encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) { struct glyph *src_end = src + src_len; -- cgit v1.2.1 From 75f8807fe6cc437f58845ec21621614d1dbb7f36 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 09:31:51 -0800 Subject: * term.c (encode_terminal_code): Remove unused local --- src/ChangeLog | 2 +- src/term.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 325822a29a2..107d7d663da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -85,7 +85,7 @@ * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. - * term.c (encode_terminal_code): Now static. + * term.c (encode_terminal_code): Now static. Remove unused local. 2011-03-06 Chong Yidong diff --git a/src/term.c b/src/term.c index 873ffaba299..80db7fbeb17 100644 --- a/src/term.c +++ b/src/term.c @@ -664,8 +664,6 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi } else { - unsigned char *p = SDATA (string); - if (! STRING_MULTIBYTE (string)) string = string_to_multibyte (string); nbytes = buf - encode_terminal_src; -- cgit v1.2.1 From 50938595880fd87c7dcd39a607cba1b0a7598baf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 10:26:34 -0800 Subject: * tparam.h: New file. * term.c, tparam.h: Include it. * deps.mk (term.o, tparam.o): Depend on tparam.h. * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr): Move these decls to tparam.h, and make them agree with what is actually in tparam.c. The previous trick of using incompatible decls in different modules does not conform to the C standard. All callers of tparam changed to use tparam's actual API. * tparam.c (tparam1, tparam, tgoto): Use const pointers where appropriate. --- src/ChangeLog | 11 +++++++++++ src/deps.mk | 4 ++-- src/term.c | 25 +++++++------------------ src/tparam.c | 16 +++++++++------- src/tparam.h | 31 +++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 src/tparam.h (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 107d7d663da..350f01953d4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -87,6 +87,17 @@ * term.c (encode_terminal_code): Now static. Remove unused local. + * tparam.h: New file. + * term.c, tparam.h: Include it. + * deps.mk (term.o, tparam.o): Depend on tparam.h. + * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr): + Move these decls to tparam.h, and make them agree with what + is actually in tparam.c. The previous trick of using incompatible + decls in different modules does not conform to the C standard. + All callers of tparam changed to use tparam's actual API. + * tparam.c (tparam1, tparam, tgoto): + Use const pointers where appropriate. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/deps.mk b/src/deps.mk index 77994bcaadb..2b162b07bb8 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -190,13 +190,13 @@ sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ - systty.h syssignal.h $(INTERVALS_H) buffer.h ../lib/unistd.h + systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h termcap.o: termcap.c lisp.h $(config_h) terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ msdos.h terminfo.o: terminfo.c lisp.h globals.h $(config_h) -tparam.o: tparam.c lisp.h $(config_h) +tparam.o: tparam.c tparam.h lisp.h $(config_h) undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ lisp.h globals.h $(config_h) unexaix.o: unexaix.c lisp.h $(config_h) diff --git a/src/term.c b/src/term.c index 80db7fbeb17..19d7d893069 100644 --- a/src/term.c +++ b/src/term.c @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "termchar.h" #include "termopts.h" +#include "tparam.h" #include "buffer.h" #include "character.h" #include "charset.h" @@ -53,18 +54,6 @@ along with GNU Emacs. If not, see . */ static int been_here = -1; #endif -/* For now, don't try to include termcap.h. On some systems, - configure finds a non-standard termcap.h that the main build - won't find. */ -extern void tputs (const char *, int, int (*)(int)); -extern int tgetent (char *, const char *); -extern int tgetflag (char *id); -extern int tgetnum (char *id); - -char *tparam (char *, char *, int, int, ...); - -extern char *tgetstr (char *, char **); - #include "cm.h" #ifdef HAVE_X_WINDOWS #include "xterm.h" @@ -262,7 +251,7 @@ tty_set_scroll_region (struct frame *f, int start, int stop) struct tty_display_info *tty = FRAME_TTY (f); if (tty->TS_set_scroll_region) - buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1); + buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0); else if (tty->TS_set_scroll_region_1) buf = tparam (tty->TS_set_scroll_region_1, 0, 0, FRAME_LINES (f), start, @@ -859,7 +848,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len) if (tty->TS_ins_multi_chars) { - buf = tparam (tty->TS_ins_multi_chars, 0, 0, len); + buf = tparam (tty->TS_ins_multi_chars, 0, 0, len, 0, 0, 0); OUTPUT1 (tty, buf); xfree (buf); if (start) @@ -955,7 +944,7 @@ tty_delete_glyphs (struct frame *f, int n) if (tty->TS_del_multi_chars) { - buf = tparam (tty->TS_del_multi_chars, 0, 0, n); + buf = tparam (tty->TS_del_multi_chars, 0, 0, n, 0, 0, 0); OUTPUT1 (tty, buf); xfree (buf); } @@ -997,7 +986,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n) { raw_cursor_to (f, vpos, 0); tty_background_highlight (tty); - buf = tparam (multi, 0, 0, i); + buf = tparam (multi, 0, 0, i, 0, 0, 0); OUTPUT (tty, buf); xfree (buf); } @@ -2125,7 +2114,7 @@ turn_on_face (struct frame *f, int face_id) ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; if (fg >= 0 && ts) { - p = tparam (ts, NULL, 0, (int) fg); + p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0); OUTPUT (tty, p); xfree (p); } @@ -2133,7 +2122,7 @@ turn_on_face (struct frame *f, int face_id) ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; if (bg >= 0 && ts) { - p = tparam (ts, NULL, 0, (int) bg); + p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0); OUTPUT (tty, p); xfree (p); } diff --git a/src/tparam.c b/src/tparam.c index fcbb63881e6..6aae0b97db9 100644 --- a/src/tparam.c +++ b/src/tparam.c @@ -21,6 +21,7 @@ Boston, MA 02110-1301, USA. */ #include #include #include "lisp.h" /* for xmalloc */ +#include "tparam.h" #ifndef NULL #define NULL (char *) 0 @@ -38,11 +39,12 @@ Boston, MA 02110-1301, USA. */ The fourth and following args to tparam serve as the parameter values. */ -static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp); +static char *tparam1 (char const *string, char *outstring, int len, + char *up, char *left, int *argp); -/* VARARGS 2 */ char * -tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3) +tparam (const char *string, char *outstring, int len, + int arg0, int arg1, int arg2, int arg3) { int arg[4]; @@ -59,7 +61,7 @@ char *UP; static char tgoto_buf[50]; char * -tgoto (char *cm, int hpos, int vpos) +tgoto (const char *cm, int hpos, int vpos) { int args[2]; if (!cm) @@ -70,10 +72,11 @@ tgoto (char *cm, int hpos, int vpos) } static char * -tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp) +tparam1 (const char *string, char *outstring, int len, + char *up, char *left, register int *argp) { register int c; - register char *p = string; + register const char *p = string; register char *op = outstring; char *outend; int outlen = 0; @@ -277,4 +280,3 @@ main (argc, argv) } #endif /* DEBUG */ - diff --git a/src/tparam.h b/src/tparam.h new file mode 100644 index 00000000000..11c9ae68aad --- /dev/null +++ b/src/tparam.h @@ -0,0 +1,31 @@ +/* Interface definitions for termcap entries. + +Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + + +/* Don't try to include termcap.h. On some systems, configure finds a + non-standard termcap.h that the main build won't find. */ + +void tputs (const char *, int, int (*) (int)); +int tgetent (char *, const char *); +int tgetflag (char *id); +int tgetnum (char *id); +char *tgetstr (char *, char **); +char *tgoto (const char *, int, int); + +char *tparam (const char *, char *, int, int, int, int, int); -- cgit v1.2.1 From fbceeba21b3b5aeb2a0f98d4ca937cabbe07fab0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 18:12:00 -0800 Subject: * cm.c (calccost, cmgoto): Use const pointers where appropriate. * cm.h (struct cm): Likewise. * dispextern.h (do_line_insertion_deletion_costs): Likewise. * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise. * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table): (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph): (turn_on_face, init_tty): Likewise. * termchar.h (struct tty_display_info): Likewise. * term.c (tgetflag, tgetnum, tgetstr): Redefine to use const pointers. --- src/ChangeLog | 10 ++++++ src/cm.c | 6 ++-- src/cm.h | 33 ++++++++++---------- src/dispextern.h | 7 +++-- src/scroll.c | 13 +++++--- src/term.c | 51 ++++++++++++++++++++----------- src/termchar.h | 93 ++++++++++++++++++++++++++++---------------------------- 7 files changed, 120 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 350f01953d4..a8594fb3fc6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -98,6 +98,16 @@ * tparam.c (tparam1, tparam, tgoto): Use const pointers where appropriate. + * cm.c (calccost, cmgoto): Use const pointers where appropriate. + * cm.h (struct cm): Likewise. + * dispextern.h (do_line_insertion_deletion_costs): Likewise. + * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise. + * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table): + (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph): + (turn_on_face, init_tty): Likewise. + * termchar.h (struct tty_display_info): Likewise. + * term.c (tgetflag, tgetnum, tgetstr): Redefine to use const pointers. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/cm.c b/src/cm.c index af4116f3fec..108ee5720f3 100644 --- a/src/cm.c +++ b/src/cm.c @@ -199,7 +199,7 @@ calccost (struct tty_display_info *tty, tabx, tab2x, tabcost; - register char *p; + register const char *p; /* If have just wrapped on a terminal with xn, don't believe the cursor position: give up here @@ -331,8 +331,8 @@ cmgoto (struct tty_display_info *tty, int row, int col) relcost, directcost; int use IF_LINT (= 0); - char *p, - *dcm; + char *p; + const char *dcm; /* First the degenerate case */ if (row == curY (tty) && col == curX (tty)) /* already there */ diff --git a/src/cm.h b/src/cm.h index 7b4bedd4e88..5d430598f0c 100644 --- a/src/cm.h +++ b/src/cm.h @@ -35,25 +35,25 @@ struct cm int cm_curX; /* Current column */ /* Capabilities from termcap */ - char *cm_up; /* up (up) */ - char *cm_down; /* down (do) */ - char *cm_left; /* left (le) */ - char *cm_right; /* right (nd) */ - char *cm_home; /* home (ho) */ - char *cm_cr; /* carriage return (cr) */ - char *cm_ll; /* last line (ll) */ - char *cm_tab; /* tab (ta) */ - char *cm_backtab; /* backtab (bt) */ + const char *cm_up; /* up (up) */ + const char *cm_down; /* down (do) */ + const char *cm_left; /* left (le) */ + const char *cm_right; /* right (nd) */ + const char *cm_home; /* home (ho) */ + const char *cm_cr; /* carriage return (cr) */ + const char *cm_ll; /* last line (ll) */ + const char *cm_tab; /* tab (ta) */ + const char *cm_backtab; /* backtab (bt) */ char *cm_abs; /* absolute (cm) */ - char *cm_habs; /* horizontal absolute (ch) */ - char *cm_vabs; /* vertical absolute (cv) */ + const char *cm_habs; /* horizontal absolute (ch) */ + const char *cm_vabs; /* vertical absolute (cv) */ #if 0 - char *cm_ds; /* "don't send" string (ds) */ + const char *cm_ds; /* "don't send" string (ds) */ #endif - char *cm_multiup; /* multiple up (UP) */ - char *cm_multidown; /* multiple down (DO) */ - char *cm_multileft; /* multiple left (LE) */ - char *cm_multiright; /* multiple right (RI) */ + const char *cm_multiup; /* multiple up (UP) */ + const char *cm_multidown; /* multiple down (DO) */ + const char *cm_multileft; /* multiple left (LE) */ + const char *cm_multiright; /* multiple right (RI) */ int cm_cols; /* number of cols on screen (co) */ int cm_rows; /* number of rows on screen (li) */ int cm_tabwidth; /* tab width (it) */ @@ -168,4 +168,3 @@ extern void cmcostinit (struct tty_display_info *); extern void cmgoto (struct tty_display_info *, int, int); extern void Wcm_clear (struct tty_display_info *); extern int Wcm_init (struct tty_display_info *); - diff --git a/src/dispextern.h b/src/dispextern.h index 30979d487ff..9843dfd1fcd 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3326,9 +3326,10 @@ extern struct terminal *init_tty (const char *, const char *, int); extern int scrolling_max_lines_saved (int, int, int *, int *, int *); extern int scroll_cost (struct frame *, int, int, int); -extern void do_line_insertion_deletion_costs (struct frame *, char *, - char *, char *, char *, - char *, char *, int); +extern void do_line_insertion_deletion_costs (struct frame *, const char *, + const char *, const char *, + const char *, const char *, + const char *, int); void scrolling_1 (struct frame *, int, int, int, int *, int *, int *, int *, int); diff --git a/src/scroll.c b/src/scroll.c index 1343b89c41e..33af18d2090 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -938,8 +938,8 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int static void ins_del_costs (FRAME_PTR frame, - char *one_line_string, char *multi_string, - char *setup_string, char *cleanup_string, + const char *one_line_string, const char *multi_string, + const char *setup_string, const char *cleanup_string, int *costvec, int *ncostvec, int coefficient) { @@ -994,9 +994,12 @@ ins_del_costs (FRAME_PTR frame, void do_line_insertion_deletion_costs (FRAME_PTR frame, - char *ins_line_string, char *multi_ins_string, - char *del_line_string, char *multi_del_string, - char *setup_string, char *cleanup_string, + const char *ins_line_string, + const char *multi_ins_string, + const char *del_line_string, + const char *multi_del_string, + const char *setup_string, + const char *cleanup_string, int coefficient) { if (FRAME_INSERT_COST (frame) != 0) diff --git a/src/term.c b/src/term.c index 19d7d893069..6986cfb9e03 100644 --- a/src/term.c +++ b/src/term.c @@ -961,9 +961,10 @@ static void tty_ins_del_lines (struct frame *f, int vpos, int n) { struct tty_display_info *tty = FRAME_TTY (f); - char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; - char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; - char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; + const char *multi = + n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; + const char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; + const char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; register int i = n > 0 ? n : -n; register char *buf; @@ -1138,9 +1139,9 @@ calculate_costs (struct frame *frame) if (FRAME_TERMCAP_P (frame)) { struct tty_display_info *tty = FRAME_TTY (frame); - register char *f = (tty->TS_set_scroll_region - ? tty->TS_set_scroll_region - : tty->TS_set_scroll_region_1); + register const char *f = (tty->TS_set_scroll_region + ? tty->TS_set_scroll_region + : tty->TS_set_scroll_region_1); FRAME_SCROLL_REGION_COST (frame) = string_cost (f); @@ -1194,7 +1195,7 @@ calculate_costs (struct frame *frame) } struct fkey_table { - char *cap, *name; + const char *cap, *name; }; /* Termcap capability names that correspond directly to X keysyms. @@ -1305,6 +1306,18 @@ static char **term_get_fkeys_address; static KBOARD *term_get_fkeys_kboard; static Lisp_Object term_get_fkeys_1 (void); +/* Rework termcap API to accept const pointer args. */ +static inline int my_tgetflag (const char *x) { return tgetflag ((char *) x); } +static inline int my_tgetnum (const char *x) { return tgetnum ((char *) x); } +static inline char *my_tgetstr (const char *x, char **a) +{ return tgetstr ((char *) x, a); } +#undef tgetflag +#undef tgetnum +#undef tgetstr +#define tgetflag my_tgetflag +#define tgetnum my_tgetnum +#define tgetstr my_tgetstr + /* Find the escape codes sent by the function keys for Vinput_decode_map. This function scans the termcap function key sequence entries, and adds entries to Vinput_decode_map for each function key it finds. */ @@ -1352,9 +1365,9 @@ term_get_fkeys_1 (void) "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. */ { - char *k_semi = tgetstr ("k;", address); - char *k0 = tgetstr ("k0", address); - char *k0_name = "f10"; + const char *k_semi = tgetstr ("k;", address); + const char *k0 = tgetstr ("k0", address); + const char *k0_name = "f10"; if (k_semi) { @@ -1447,7 +1460,7 @@ static void append_glyph (struct it *); static void produce_stretch_glyph (struct it *); static void append_composite_glyph (struct it *); static void produce_composite_glyph (struct it *); -static void append_glyphless_glyph (struct it *, int, char *); +static void append_glyphless_glyph (struct it *, int, const char *); static void produce_glyphless_glyph (struct it *, int, Lisp_Object); /* Append glyphs to IT's glyph_row. Called from produce_glyphs for @@ -1815,7 +1828,7 @@ produce_composite_glyph (struct it *it) comes from it->nglyphs bytes). */ static void -append_glyphless_glyph (struct it *it, int face_id, char *str) +append_glyphless_glyph (struct it *it, int face_id, const char *str) { struct glyph *glyph, *end; int i; @@ -1890,7 +1903,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) { int face_id; int len; - char buf[9], *str = " "; + char buf[9]; + char const *str = " "; /* Get a face ID for the glyph by utilizing a cache (the same way as done for `escape-glyph' in get_next_display_element). */ @@ -2109,7 +2123,8 @@ turn_on_face (struct frame *f, int face_id) if (tty->TN_max_colors > 0) { - char *ts, *p; + const char *ts; + char *p; ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; if (fg >= 0 && ts) @@ -3519,10 +3534,10 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ If it were in the termcap entry, it would confuse other programs. */ if (!tty->TS_set_window) { - p = tty->TS_termcap_modes; - while (*p && strcmp (p, "\033v ")) - p++; - if (*p) + const char *m = tty->TS_termcap_modes; + while (*m && strcmp (m, "\033v ")) + m++; + if (*m) tty->TS_set_window = "\033v%C %C %C %C "; } /* Termcap entry often fails to have :in: flag */ diff --git a/src/termchar.h b/src/termchar.h index 277a96932b4..035974a8ce6 100644 --- a/src/termchar.h +++ b/src/termchar.h @@ -84,58 +84,58 @@ struct tty_display_info /* Strings, numbers and flags taken from the termcap entry. */ - char *TS_ins_line; /* "al" */ - char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */ - char *TS_bell; /* "bl" */ - char *TS_clr_to_bottom; /* "cd" */ - char *TS_clr_line; /* "ce", clear to end of line */ - char *TS_clr_frame; /* "cl" */ - char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ - char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, + const char *TS_ins_line; /* "al" */ + const char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */ + const char *TS_bell; /* "bl" */ + const char *TS_clr_to_bottom; /* "cd" */ + const char *TS_clr_line; /* "ce", clear to end of line */ + const char *TS_clr_frame; /* "cl" */ + const char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ + const char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, lines above scroll region, lines below it, total lines again) */ - char *TS_del_char; /* "dc" */ - char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */ - char *TS_del_line; /* "dl" */ - char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */ - char *TS_delete_mode; /* "dm", enter character-delete mode */ - char *TS_end_delete_mode; /* "ed", leave character-delete mode */ - char *TS_end_insert_mode; /* "ei", leave character-insert mode */ - char *TS_ins_char; /* "ic" */ - char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */ - char *TS_insert_mode; /* "im", enter character-insert mode */ - char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */ - char *TS_end_keypad_mode; /* "ke" */ - char *TS_keypad_mode; /* "ks" */ - char *TS_pad_char; /* "pc", char to use as padding */ - char *TS_repeat; /* "rp" (2 params, # times to repeat + const char *TS_del_char; /* "dc" */ + const char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */ + const char *TS_del_line; /* "dl" */ + const char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */ + const char *TS_delete_mode; /* "dm", enter character-delete mode */ + const char *TS_end_delete_mode; /* "ed", leave character-delete mode */ + const char *TS_end_insert_mode; /* "ei", leave character-insert mode */ + const char *TS_ins_char; /* "ic" */ + const char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */ + const char *TS_insert_mode; /* "im", enter character-insert mode */ + const char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */ + const char *TS_end_keypad_mode; /* "ke" */ + const char *TS_keypad_mode; /* "ks" */ + const char *TS_pad_char; /* "pc", char to use as padding */ + const char *TS_repeat; /* "rp" (2 params, # times to repeat and character to be repeated) */ - char *TS_end_standout_mode; /* "se" */ - char *TS_fwd_scroll; /* "sf" */ - char *TS_standout_mode; /* "so" */ - char *TS_rev_scroll; /* "sr" */ - char *TS_end_termcap_modes; /* "te" */ - char *TS_termcap_modes; /* "ti" */ - char *TS_visible_bell; /* "vb" */ - char *TS_cursor_normal; /* "ve" */ - char *TS_cursor_visible; /* "vs" */ - char *TS_cursor_invisible; /* "vi" */ - char *TS_set_window; /* "wi" (4 params, start and end of window, + const char *TS_end_standout_mode; /* "se" */ + const char *TS_fwd_scroll; /* "sf" */ + const char *TS_standout_mode; /* "so" */ + const char *TS_rev_scroll; /* "sr" */ + const char *TS_end_termcap_modes; /* "te" */ + const char *TS_termcap_modes; /* "ti" */ + const char *TS_visible_bell; /* "vb" */ + const char *TS_cursor_normal; /* "ve" */ + const char *TS_cursor_visible; /* "vs" */ + const char *TS_cursor_invisible; /* "vi" */ + const char *TS_set_window; /* "wi" (4 params, start and end of window, each as vpos and hpos) */ - char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ - char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ - char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ - char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ - char *TS_exit_underline_mode; /* "us" -- start underlining. */ - char *TS_enter_underline_mode; /* "ue" -- end underlining. */ + const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ + const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ + const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ + const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ + const char *TS_exit_underline_mode; /* "us" -- start underlining. */ + const char *TS_enter_underline_mode; /* "ue" -- end underlining. */ /* "as"/"ae" -- start/end alternate character set. Not really supported, yet. */ - char *TS_enter_alt_charset_mode; - char *TS_exit_alt_charset_mode; + const char *TS_enter_alt_charset_mode; + const char *TS_exit_alt_charset_mode; - char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */ + const char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */ /* Value of the "NC" (no_color_video) capability, or 0 if not present. */ int TN_no_color_video; @@ -147,12 +147,12 @@ struct tty_display_info int TN_max_pairs; /* "op" -- SVr4 set default pair to its original value. */ - char *TS_orig_pair; + const char *TS_orig_pair; /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color. 1 param, the color index. */ - char *TS_set_foreground; - char *TS_set_background; + const char *TS_set_foreground; + const char *TS_set_background; int TF_hazeltine; /* termcap hz flag. */ int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */ @@ -210,4 +210,3 @@ extern struct tty_display_info *tty_list; : (abort(), (struct tty_display_info *) 0)) #define CURTTY() FRAME_TTY (SELECTED_FRAME()) - -- cgit v1.2.1 From 7f3f1250d4f74203c828e7ba03b721b1f269a0d7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 18:15:18 -0800 Subject: * term.c (term_mouse_position): Rename local to avoid shadowing. --- src/ChangeLog | 2 ++ src/term.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a8594fb3fc6..a3695bda635 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -108,6 +108,8 @@ * termchar.h (struct tty_display_info): Likewise. * term.c (tgetflag, tgetnum, tgetstr): Redefine to use const pointers. + * term.c (term_mouse_position): Rename local to avoid shadowing. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/term.c b/src/term.c index 6986cfb9e03..9531cce5f9f 100644 --- a/src/term.c +++ b/src/term.c @@ -2700,14 +2700,14 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) Set *bar_window to Qnil, and *x and *y to the column and row of the character cell the mouse is over. - Set *time to the time the mouse was at the returned position. + Set *timeptr to the time the mouse was at the returned position. This clears mouse_moved until the next motion event arrives. */ static void term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, - Lisp_Object *y, unsigned long *time) + Lisp_Object *y, unsigned long *timeptr) { struct timeval now; @@ -2720,7 +2720,7 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, XSETINT (*x, last_mouse_x); XSETINT (*y, last_mouse_y); gettimeofday(&now, 0); - *time = (now.tv_sec * 1000) + (now.tv_usec / 1000); + *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000); } /* Prepare a mouse-event in *RESULT for placement in the input queue. -- cgit v1.2.1 From e6ca6543685fded0d1b3322dd06d0fa70d3e2a44 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 21:40:59 -0800 Subject: * alloc.c (mark_ttys): Move decl from here ... * lisp.h (mark_ttys): ... to here, so that it's checked against defn. --- src/ChangeLog | 3 +++ src/alloc.c | 1 - src/lisp.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a3695bda635..8bbc818ec7d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -110,6 +110,9 @@ * term.c (term_mouse_position): Rename local to avoid shadowing. + * alloc.c (mark_ttys): Move decl from here ... + * lisp.h (mark_ttys): ... to here, so that it's checked against defn. + 2011-03-06 Chong Yidong * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 diff --git a/src/alloc.c b/src/alloc.c index d7006ca6bfd..8632897606a 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -271,7 +271,6 @@ Lisp_Object Qpost_gc_hook; static void mark_buffer (Lisp_Object); static void mark_terminals (void); extern void mark_kboards (void); -extern void mark_ttys (void); extern void mark_backtrace (void); static void gc_sweep (void); static void mark_glyph_matrix (struct glyph_matrix *); diff --git a/src/lisp.h b/src/lisp.h index 719d72d28a4..1e8e01cf91f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3378,6 +3378,7 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, /* Defined in term.c */ extern int *char_ins_del_vector; +extern void mark_ttys (void); extern void syms_of_term (void); extern void fatal (const char *msgid, ...) NO_RETURN; -- cgit v1.2.1 From b024a9466a0e238e053d0464f4a4f9b19d04648b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 21:46:35 -0800 Subject: * term.c, tparam.h (tgetflag, tgetnum, tgetstr): Move the const to the .h file --- src/ChangeLog | 1 - src/term.c | 12 ------------ src/tparam.h | 6 +++--- 3 files changed, 3 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8bbc818ec7d..89f4bbb3db9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -106,7 +106,6 @@ (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph): (turn_on_face, init_tty): Likewise. * termchar.h (struct tty_display_info): Likewise. - * term.c (tgetflag, tgetnum, tgetstr): Redefine to use const pointers. * term.c (term_mouse_position): Rename local to avoid shadowing. diff --git a/src/term.c b/src/term.c index 9531cce5f9f..e9e880a0c7f 100644 --- a/src/term.c +++ b/src/term.c @@ -1306,18 +1306,6 @@ static char **term_get_fkeys_address; static KBOARD *term_get_fkeys_kboard; static Lisp_Object term_get_fkeys_1 (void); -/* Rework termcap API to accept const pointer args. */ -static inline int my_tgetflag (const char *x) { return tgetflag ((char *) x); } -static inline int my_tgetnum (const char *x) { return tgetnum ((char *) x); } -static inline char *my_tgetstr (const char *x, char **a) -{ return tgetstr ((char *) x, a); } -#undef tgetflag -#undef tgetnum -#undef tgetstr -#define tgetflag my_tgetflag -#define tgetnum my_tgetnum -#define tgetstr my_tgetstr - /* Find the escape codes sent by the function keys for Vinput_decode_map. This function scans the termcap function key sequence entries, and adds entries to Vinput_decode_map for each function key it finds. */ diff --git a/src/tparam.h b/src/tparam.h index 11c9ae68aad..3cd3e6053cc 100644 --- a/src/tparam.h +++ b/src/tparam.h @@ -23,9 +23,9 @@ along with GNU Emacs. If not, see . */ void tputs (const char *, int, int (*) (int)); int tgetent (char *, const char *); -int tgetflag (char *id); -int tgetnum (char *id); -char *tgetstr (char *, char **); +int tgetflag (const char *); +int tgetnum (const char *); +char *tgetstr (const char *, char **); char *tgoto (const char *, int, int); char *tparam (const char *, char *, int, int, int, int, int); -- cgit v1.2.1 From 426994c30418e7410bac86d9cd43e6fb20d91922 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:07:27 -0800 Subject: * terminal.c (store_terminal_param): Now static. --- src/ChangeLog | 4 +++- src/terminal.c | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 89f4bbb3db9..f5d452a5dfb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,6 @@ -2011-03-08 Paul Eggert +2011-03-09 Paul Eggert + + * terminal.c (store_terminal_param): Now static. * xmenu.c (menu_highlight_callback): Now static. (set_frame_menubar): Remove unused local. diff --git a/src/terminal.c b/src/terminal.c index 309cc0095e8..c5185601fb6 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -109,7 +109,7 @@ void raw_cursor_to (struct frame *f, int row, int col) { if (FRAME_TERMINAL (f)->raw_cursor_to_hook) - (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); + (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); } /* Erase operations */ @@ -444,7 +444,7 @@ selected frame's terminal). */) /* Set the value of terminal parameter PARAMETER in terminal D to VALUE. Return the previous value. */ -Lisp_Object +static Lisp_Object store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value) { Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); @@ -569,4 +569,3 @@ or some time later. */); Fprovide (intern_c_string ("multi-tty"), Qnil); } - -- cgit v1.2.1 From 071048a3f588c7ae789983bf411a6ea948758abc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:17:32 -0800 Subject: * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/xfaces.c | 27 +++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f5d452a5dfb..6d22732b5e0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-09 Paul Eggert + * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename + or move locals to avoid shadowing. + * terminal.c (store_terminal_param): Now static. * xmenu.c (menu_highlight_callback): Now static. diff --git a/src/xfaces.c b/src/xfaces.c index 4cc47c85050..d877d8525dd 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -847,7 +847,6 @@ clear_face_cache (int clear_fonts_p) { #ifdef HAVE_WINDOW_SYSTEM Lisp_Object tail, frame; - struct frame *f; if (clear_fonts_p || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT) @@ -875,7 +874,7 @@ clear_face_cache (int clear_fonts_p) /* Clear GCs of realized faces. */ FOR_EACH_FRAME (tail, frame) { - f = XFRAME (frame); + struct frame *f = XFRAME (frame); if (FRAME_WINDOW_P (f)) clear_face_gcs (FRAME_FACE_CACHE (f)); } @@ -1754,14 +1753,14 @@ the WIDTH times as wide as FACE on FRAME. */) /* This is of limited utility since it works with character widths. Keep it for compatibility. --gerd. */ int face_id = lookup_named_face (f, face, 0); - struct face *face = (face_id < 0 - ? NULL - : FACE_FROM_ID (f, face_id)); + struct face *width_face = (face_id < 0 + ? NULL + : FACE_FROM_ID (f, face_id)); - if (face && face->font) + if (width_face && width_face->font) { - size = face->font->pixel_size; - avgwidth = face->font->average_width; + size = width_face->font->pixel_size; + avgwidth = width_face->font->average_width; } else { @@ -3869,19 +3868,19 @@ return the font name used for CHARACTER. */) { struct frame *f = frame_or_selected_frame (frame, 1); int face_id = lookup_named_face (f, face, 1); - struct face *face = FACE_FROM_ID (f, face_id); + struct face *fface = FACE_FROM_ID (f, face_id); - if (! face) + if (! fface) return Qnil; #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f) && !NILP (character)) { CHECK_CHARACTER (character); - face_id = FACE_FOR_CHAR (f, face, XINT (character), -1, Qnil); - face = FACE_FROM_ID (f, face_id); + face_id = FACE_FOR_CHAR (f, fface, XINT (character), -1, Qnil); + fface = FACE_FROM_ID (f, face_id); } - return (face->font - ? face->font->props[FONT_NAME_INDEX] + return (fface->font + ? fface->font->props[FONT_NAME_INDEX] : Qnil); #else /* !HAVE_WINDOW_SYSTEM */ return build_string (FRAME_MSDOS_P (f) -- cgit v1.2.1 From c2ed9c8b0cf694c20eea63f31b7c276efa6a1008 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:21:25 -0800 Subject: * term.c (encode_terminal_code): Mark vars for gcc -Wuninitialized. --- src/ChangeLog | 1 + src/term.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6d22732b5e0..c6f973af8c7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -89,6 +89,7 @@ * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. + * term.c (encode_terminal_code): Likewise. * term.c (encode_terminal_code): Now static. Remove unused local. diff --git a/src/term.c b/src/term.c index e9e880a0c7f..e78e2e68814 100644 --- a/src/term.c +++ b/src/term.c @@ -533,8 +533,8 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi { if (src->type == COMPOSITE_GLYPH) { - struct composition *cmp; - Lisp_Object gstring; + struct composition *cmp IF_LINT (= NULL); + Lisp_Object gstring IF_LINT (= Qnil); int i; nbytes = buf - encode_terminal_src; @@ -595,7 +595,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi else if (! CHAR_GLYPH_PADDING_P (*src)) { GLYPH g; - int c; + int c IF_LINT (= 0); Lisp_Object string; string = Qnil; -- cgit v1.2.1 From 6b463e581fc2f176fd2ab5b06cff963e94218163 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:22:39 -0800 Subject: * xfaces.c (tty_defined_color, merge_face_heights): Now static. --- src/ChangeLog | 1 + src/xfaces.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c6f973af8c7..1f8e0f6b8e3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. + (tty_defined_color, merge_face_heights): Now static. * terminal.c (store_terminal_param): Now static. diff --git a/src/xfaces.c b/src/xfaces.c index d877d8525dd..d463175ed2c 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -1112,7 +1112,7 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor /* A version of defined_color for non-X frames. */ -int +static int tty_defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc) { @@ -2251,7 +2251,7 @@ set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object `relative' heights; the returned value is always an absolute height unless both FROM and TO are relative. */ -Lisp_Object +static Lisp_Object merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) { Lisp_Object result = invalid; -- cgit v1.2.1 From 5967d05138d7405e4b60153f98c8beaf40c7d6da Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:23:48 -0800 Subject: * xfaces.c (free_realized_faces_for_fontset): Remove; not used. --- src/ChangeLog | 1 + src/xfaces.c | 39 --------------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1f8e0f6b8e3..fb266a71a0f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. (tty_defined_color, merge_face_heights): Now static. + (free_realized_faces_for_fontset): Remove; not used. * terminal.c (store_terminal_param): Now static. diff --git a/src/xfaces.c b/src/xfaces.c index d463175ed2c..b49675a7d8e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4312,45 +4312,6 @@ free_realized_faces (struct face_cache *c) } -/* Free all realized faces that are using FONTSET on frame F. */ - -void -free_realized_faces_for_fontset (struct frame *f, int fontset) -{ - struct face_cache *cache = FRAME_FACE_CACHE (f); - struct face *face; - int i; - - /* We must block input here because we can't process X events safely - while only some faces are freed, or when the frame's current - matrix still references freed faces. */ - BLOCK_INPUT; - - for (i = 0; i < cache->used; i++) - { - face = cache->faces_by_id[i]; - if (face - && face->fontset == fontset) - { - uncache_face (cache, face); - free_realized_face (f, face); - } - } - - /* Must do a thorough redisplay the next time. Mark current - matrices as invalid because they will reference faces freed - above. This function is also called when a frame is destroyed. - In this case, the root window of F is nil. */ - if (WINDOWP (f->root_window)) - { - clear_current_matrices (f); - ++windows_or_buffers_changed; - } - - UNBLOCK_INPUT; -} - - /* Free all realized faces on FRAME or on all frames if FRAME is nil. This is done after attributes of a named face have been changed, because we can't tell which realized faces depend on that face. */ -- cgit v1.2.1 From 1e9966ea025891f948200db6ab85a7e7e169e502 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:25:19 -0800 Subject: * xfaces.c (Fx_list_fonts): Mark variable that gcc -Wuninitialized does not deduce is never used uninitialized. --- src/ChangeLog | 2 ++ src/xfaces.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fb266a71a0f..44782386684 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,8 @@ or move locals to avoid shadowing. (tty_defined_color, merge_face_heights): Now static. (free_realized_faces_for_fontset): Remove; not used. + (Fx_list_fonts): Mark variable that gcc -Wuninitialized + does not deduce is never used uninitialized. * terminal.c (store_terminal_param): Now static. diff --git a/src/xfaces.c b/src/xfaces.c index b49675a7d8e..ded871d1fdd 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -1720,7 +1720,7 @@ the WIDTH times as wide as FACE on FRAME. */) (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width) { struct frame *f; - int size, avgwidth; + int size, avgwidth IF_LINT (= 0); check_x (); CHECK_STRING (pattern); -- cgit v1.2.1 From 73719eba5cbda861e9a7cc296537cd03506418c1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:29:34 -0800 Subject: * xfaces.c (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used. (LFACEP): Define only if XASSERTS, as it's not needed otherwise. --- src/ChangeLog | 2 ++ src/xfaces.c | 16 ++-------------- 2 files changed, 4 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 44782386684..244a17a61d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,6 +6,8 @@ (free_realized_faces_for_fontset): Remove; not used. (Fx_list_fonts): Mark variable that gcc -Wuninitialized does not deduce is never used uninitialized. + (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used. + (LFACEP): Define only if XASSERTS, as it's not needed otherwise. * terminal.c (store_terminal_param): Now static. diff --git a/src/xfaces.c b/src/xfaces.c index ded871d1fdd..50bcab3c6a9 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -297,16 +297,6 @@ along with GNU Emacs. If not, see . */ #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) -/* Make a copy of string S on the stack using alloca. Value is a pointer - to the copy. */ - -#define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S)) - -/* Make a copy of the contents of Lisp string S on the stack using - alloca. Value is a pointer to the copy. */ - -#define LSTRDUPA(S) STRDUPA (SDATA ((S))) - /* Size of hash table of realized faces in face caches (should be a prime number). */ @@ -1837,6 +1827,7 @@ the WIDTH times as wide as FACE on FRAME. */) #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) #define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) +#if XASSERTS /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ @@ -1844,6 +1835,7 @@ the WIDTH times as wide as FACE on FRAME. */) (VECTORP (LFACE) \ && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ && EQ (AREF (LFACE, 0), Qface)) +#endif #if GLYPH_DEBUG @@ -5247,10 +5239,6 @@ be found. Value is ALIST. */) #ifdef HAVE_WINDOW_SYSTEM -/* Ignore the difference of font point size less than this value. */ - -#define FONT_POINT_SIZE_QUANTUM 5 - /* Return the fontset id of the base fontset name or alias name given by the fontset attribute of ATTRS. Value is -1 if the fontset attribute of ATTRS doesn't name a fontset. */ -- cgit v1.2.1 From 77f2391201c5014f9ec83250f753cad4de814c95 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 22:40:38 -0800 Subject: * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame): Remove unused functions. --- src/ChangeLog | 3 +++ src/xterm.c | 46 ---------------------------------------------- 2 files changed, 3 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 244a17a61d5..fcb3cbc5dee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-09 Paul Eggert + * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame): + Remove unused functions. + * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. (tty_defined_color, merge_face_heights): Now static. diff --git a/src/xterm.c b/src/xterm.c index 909b6978f5a..49553e3f1e0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1791,27 +1791,6 @@ x_copy_color (struct frame *f, long unsigned int pixel) } -/* Allocate color PIXEL on display DPY. PIXEL must already be allocated. - It's necessary to do this instead of just using PIXEL directly to - get color reference counts right. */ - -unsigned long -x_copy_dpy_color (Display *dpy, Colormap cmap, long unsigned int pixel) -{ - XColor color; - - color.pixel = pixel; - BLOCK_INPUT; - XQueryColor (dpy, cmap, &color); - XAllocColor (dpy, cmap, &color); - UNBLOCK_INPUT; -#ifdef DEBUG_X_COLORS - register_color (pixel); -#endif - return color.pixel; -} - - /* Brightness beyond which a color won't have its highlight brightness boosted. @@ -8862,31 +8841,6 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) UNBLOCK_INPUT; } -/* focus shifting, raising and lowering. */ - -void -x_focus_on_frame (struct frame *f) -{ -#if 0 - /* I don't think that the ICCCM allows programs to do things like this - without the interaction of the window manager. Whatever you end up - doing with this code, do it to x_unfocus_frame too. */ - XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - RevertToPointerRoot, CurrentTime); -#endif /* ! 0 */ -} - -void -x_unfocus_frame (struct frame *f) -{ -#if 0 - /* Look at the remarks in x_focus_on_frame. */ - if (FRAME_X_DISPLAY_INFO (f)->x_focus_frame == f) - XSetInputFocus (FRAME_X_DISPLAY (f), PointerRoot, - RevertToPointerRoot, CurrentTime); -#endif /* ! 0 */ -} - /* Raise frame F. */ void -- cgit v1.2.1 From e2b134730c43a1c4b9a20b0df859a84dbb26669c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 23:01:14 -0800 Subject: * xterm.h (x_mouse_leave): New decl. --- src/ChangeLog | 2 ++ src/xterm.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fcb3cbc5dee..667a7ba2b15 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-09 Paul Eggert + * xterm.h (x_mouse_leave): New decl. + * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame): Remove unused functions. diff --git a/src/xterm.h b/src/xterm.h index 48d68557796..2cfaef018b8 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -979,6 +979,7 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *); extern void x_query_colors (struct frame *f, XColor *, int); extern void x_query_color (struct frame *f, XColor *); extern void x_clear_area (Display *, Window, int, int, int, int, int); +extern void x_mouse_leave (struct x_display_info *); extern void set_vertical_scroll_bar (struct window *); extern int x_dispatch_event (XEvent *, Display *); -- cgit v1.2.1 From cdf4ba58eb200f81447bedabab41eeb84549061b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 23:02:55 -0800 Subject: * xterm.c: (x_shift_glyphs_for_insert, XTflash, XTring_bell): (x_calc_absolute_position): Now static. --- src/ChangeLog | 2 ++ src/xterm.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 667a7ba2b15..dd88e961a51 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,8 @@ * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame): Remove unused functions. + (x_shift_glyphs_for_insert, XTflash, XTring_bell): + (x_calc_absolute_position): Now static. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index 49553e3f1e0..beb215b5680 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2886,7 +2886,7 @@ x_draw_glyph_string (struct glyph_string *s) /* Shift display to make room for inserted glyphs. */ -void +static void x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) { XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), @@ -2990,7 +2990,7 @@ timeval_subtract (struct timeval *result, struct timeval x, struct timeval y) return x.tv_sec < y.tv_sec; } -void +static void XTflash (struct frame *f) { BLOCK_INPUT; @@ -3165,7 +3165,7 @@ XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) /* Make audible bell. */ -void +static void XTring_bell (struct frame *f) { if (FRAME_X_DISPLAY (f)) @@ -8098,7 +8098,7 @@ xim_close_dpy (struct x_display_info *dpyinfo) /* Calculate the absolute position in frame F from its current recorded position values and gravity. */ -void +static void x_calc_absolute_position (struct frame *f) { int flags = f->size_hint_flags; -- cgit v1.2.1 From 7411c6867f74428cf2441cb2b1bd5100185b9a03 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 23:05:07 -0800 Subject: * xterm.c (XTread_socket): Don't define label "out" unless it's used. --- src/ChangeLog | 1 + src/xterm.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dd88e961a51..f0c1db2ab73 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,6 +6,7 @@ Remove unused functions. (x_shift_glyphs_for_insert, XTflash, XTring_bell): (x_calc_absolute_position): Now static. + (XTread_socket): Don't define label "out" unless it's used. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index beb215b5680..4c7fc1b9b1e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7042,6 +7042,8 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold goto out; } + out:; + #else /* USE_GTK */ /* For GTK we must use the GTK event loop. But XEvents gets passed @@ -7068,8 +7070,6 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold } #endif /* USE_GTK */ - out:; - /* On some systems, an X bug causes Emacs to get no more events when the window is destroyed. Detect that. (1994.) */ if (! event_found) -- cgit v1.2.1 From 2b07bcffb0e2b6cef517406cbc979ac14e46cd8e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 23:07:42 -0800 Subject: * xterm.c: Don't declare local "event" unless it's used. --- src/ChangeLog | 1 + src/xterm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f0c1db2ab73..7f9e68e71e5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,7 @@ (x_shift_glyphs_for_insert, XTflash, XTring_bell): (x_calc_absolute_position): Now static. (XTread_socket): Don't define label "out" unless it's used. + Don't declare local "event" unless it's used. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index 4c7fc1b9b1e..f253ed0aa3f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6991,7 +6991,6 @@ static int XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) { int count = 0; - XEvent event; int event_found = 0; if (interrupt_input_blocked) @@ -7025,6 +7024,7 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold while (XPending (terminal->display_info.x->display)) { int finish; + XEvent event; XNextEvent (terminal->display_info.x->display, &event); -- cgit v1.2.1 From ed7bf3a5ee1e31dafbb2d285b39c8fe07fc06f7c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 23:11:42 -0800 Subject: * xterm.c (x_iconify_frame, x_free_frame_resources): Don't declare locals unless they are used. --- src/ChangeLog | 2 ++ src/xterm.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7f9e68e71e5..0a14f36dbe7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,8 @@ (x_calc_absolute_position): Now static. (XTread_socket): Don't define label "out" unless it's used. Don't declare local "event" unless it's used. + (x_iconify_frame, x_free_frame_resources): Don't declare locals + unless they are used. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index f253ed0aa3f..9220d84815c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9166,7 +9166,9 @@ x_make_frame_invisible (struct frame *f) void x_iconify_frame (struct frame *f) { +#ifdef USE_X_TOOLKIT int result; +#endif Lisp_Object type; /* Don't keep the highlight on an invisible frame. */ @@ -9293,9 +9295,11 @@ void x_free_frame_resources (struct frame *f) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; +#ifdef USE_X_TOOLKIT Lisp_Object bar; struct scroll_bar *b; - Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; +#endif BLOCK_INPUT; -- cgit v1.2.1 From 38d0b34afe4dedd8c80a25af2cd84d488733b6aa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Mar 2011 23:17:17 -0800 Subject: * xterm.c (XEMBED_VERSION, xembed_set_info): Don't define unless needed. (x_fatal_error_signal): Remove; not used. --- src/ChangeLog | 2 ++ src/xterm.c | 22 +++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0a14f36dbe7..cdabea5fcd2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -10,6 +10,8 @@ Don't declare local "event" unless it's used. (x_iconify_frame, x_free_frame_resources): Don't declare locals unless they are used. + (XEMBED_VERSION, xembed_set_info): Don't define unless needed. + (x_fatal_error_signal): Remove; not used. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index 9220d84815c..e64ab270929 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -279,10 +279,6 @@ Lisp_Object Qx_gtk_map_stock; /* Some functions take this as char *, not const char *. */ static char emacs_class[] = EMACS_CLASS; -/* XEmbed implementation. */ - -#define XEMBED_VERSION 0 - enum xembed_info { XEMBED_MAPPED = 1 << 0 @@ -7647,17 +7643,6 @@ x_connection_signal (int signalnum) /* If we don't have an argument, */ static char *error_msg; -/* Function installed as fatal_error_signal_hook in - x_connection_closed. Print the X error message, and exit normally, - instead of dumping core when XtCloseDisplay fails. */ - -static void -x_fatal_error_signal (void) -{ - fprintf (stderr, "%s\n", error_msg); - exit (70); -} - /* Handle the loss of connection to display DPY. ERROR_MESSAGE is the text of an error message that lead to the connection loss. */ @@ -8901,6 +8886,12 @@ XTframe_raise_lower (FRAME_PTR f, int raise_flag) /* XEmbed implementation. */ +#if defined USE_X_TOOLKIT || ! defined USE_GTK + +/* XEmbed implementation. */ + +#define XEMBED_VERSION 0 + static void xembed_set_info (struct frame *f, enum xembed_info flags) { @@ -8914,6 +8905,7 @@ xembed_set_info (struct frame *f, enum xembed_info flags) dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO, 32, PropModeReplace, (unsigned char *) data, 2); } +#endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */ static void xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) -- cgit v1.2.1 From a6067996d8aa14819a0cdfdb8596b3252f9f2caa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 01:12:38 -0800 Subject: * xterm.c: (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position): (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor): (x_error_catcher, x_connection_closed, x_error_handler): (x_error_quitter, xembed_send_message, x_iconify_frame): (my_log_handler): Rename locals to avoid shadowing. --- src/ChangeLog | 5 +++ src/xterm.c | 99 ++++++++++++++++++++++++++++++++--------------------------- 2 files changed, 58 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cdabea5fcd2..2dc9d34f290 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -12,6 +12,11 @@ unless they are used. (XEMBED_VERSION, xembed_set_info): Don't define unless needed. (x_fatal_error_signal): Remove; not used. + (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position): + (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor): + (x_error_catcher, x_connection_closed, x_error_handler): + (x_error_quitter, xembed_send_message, x_iconify_frame): + (my_log_handler): Rename locals to avoid shadowing. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index e64ab270929..c542f0d9f29 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2235,12 +2235,12 @@ x_draw_image_foreground (struct glyph_string *s) nothing here for mouse-face. */ if (s->hl == DRAW_CURSOR) { - int r = s->img->relief; - if (r < 0) r = -r; + int relief = s->img->relief; + if (relief < 0) relief = -relief; XDrawRectangle (s->display, s->window, s->gc, - x - r, y - r, - s->slice.width + r*2 - 1, - s->slice.height + r*2 - 1); + x - relief, y - relief, + s->slice.width + relief*2 - 1, + s->slice.height + relief*2 - 1); } } } @@ -3775,7 +3775,7 @@ redo_mouse_highlight (void) mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell the mouse is over. - Set *TIME to the server time-stamp for the time at which the mouse + Set *TIMESTAMP to the server time-stamp for the time at which the mouse was at this position. Don't store anything if we don't have a valid set of values to report. @@ -3784,14 +3784,16 @@ redo_mouse_highlight (void) movement. */ static void -XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) +XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, + enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, + long unsigned int *timestamp) { FRAME_PTR f1; BLOCK_INPUT; if (! NILP (last_mouse_scroll_bar) && insist == 0) - x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); + x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp); else { Window root; @@ -3964,7 +3966,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scrol *fp = f1; XSETINT (*x, win_x); XSETINT (*y, win_y); - *time = last_mouse_movement_time; + *timestamp = last_mouse_movement_time; } } } @@ -5516,7 +5518,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) on the scroll bar. */ static void -x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) +x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, + enum scroll_bar_part *part, Lisp_Object *x, + Lisp_Object *y, long unsigned int *timestamp) { struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); Window w = bar->x_window; @@ -5576,7 +5580,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_ last_mouse_scroll_bar = Qnil; } - *time = last_mouse_movement_time; + *timestamp = last_mouse_movement_time; UNBLOCK_INPUT; } @@ -5750,7 +5754,8 @@ static void xembed_send_message (struct frame *f, Time time, We return the number of characters stored into the buffer. */ static int -handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit) +handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, + int *finish, struct input_event *hold_quit) { union { struct input_event ie; @@ -5761,7 +5766,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, int nbytes = 0; struct frame *f = NULL; struct coding_system coding; - XEvent event = *eventp; + XEvent event = *eventptr; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; *finish = X_EVENT_NORMAL; @@ -6461,7 +6466,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, { /* Raw bytes, not keysym. */ register int i; - register int c; int nchars, len; for (i = 0, nchars = 0; i < nbytes; i++) @@ -6501,14 +6505,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, character events. */ for (i = 0; i < nbytes; i += len) { + int ch; if (nchars == nbytes) - c = copy_bufptr[i], len = 1; + ch = copy_bufptr[i], len = 1; else - c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); - inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) + ch = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); + inev.ie.kind = (SINGLE_BYTE_CHAR_P (ch) ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); - inev.ie.code = c; + inev.ie.code = ch; kbd_buffer_store_event_hold (&inev.ie, hold_quit); } @@ -6947,7 +6952,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, count++; } - *eventp = event; + *eventptr = event; return count; } @@ -7201,9 +7206,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text the bar might not be in the window. */ if (cursor_glyph->type == IMAGE_GLYPH) { - struct glyph_row *row; - row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); - draw_phys_cursor_glyph (w, row, DRAW_CURSOR); + struct glyph_row *r; + r = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); + draw_phys_cursor_glyph (w, r, DRAW_CURSOR); } else { @@ -7492,9 +7497,9 @@ static struct x_error_message_stack *x_error_message; x_catch_errors is in effect. */ static void -x_error_catcher (Display *display, XErrorEvent *error) +x_error_catcher (Display *display, XErrorEvent *event) { - XGetErrorText (display, error->error_code, + XGetErrorText (display, event->error_code, x_error_message->string, X_ERROR_MESSAGE_SIZE); } @@ -7651,7 +7656,7 @@ x_connection_closed (Display *dpy, const char *error_message) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); Lisp_Object frame, tail; - int index = SPECPDL_INDEX (); + int idx = SPECPDL_INDEX (); error_msg = (char *) alloca (strlen (error_message) + 1); strcpy (error_msg, error_message); @@ -7746,7 +7751,7 @@ For details, see etc/PROBLEMS.\n", sigunblock (sigmask (SIGALRM)); TOTALLY_UNBLOCK_INPUT; - unbind_to (index, Qnil); + unbind_to (idx, Qnil); clear_waiting_for_input (); /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, longjmp), because returning from this function would get us back into @@ -7762,12 +7767,12 @@ static void x_error_quitter (Display *, XErrorEvent *); It calls x_error_quitter or x_error_catcher. */ static int -x_error_handler (Display *display, XErrorEvent *error) +x_error_handler (Display *display, XErrorEvent *event) { if (x_error_message) - x_error_catcher (display, error); + x_error_catcher (display, event); else - x_error_quitter (display, error); + x_error_quitter (display, event); return 0; } @@ -7781,22 +7786,22 @@ x_error_handler (Display *display, XErrorEvent *error) after x_error_handler prevents inlining into the former. */ static void NO_INLINE -x_error_quitter (Display *display, XErrorEvent *error) +x_error_quitter (Display *display, XErrorEvent *event) { char buf[256], buf1[356]; /* Ignore BadName errors. They can happen because of fonts or colors that are not defined. */ - if (error->error_code == BadName) + if (event->error_code == BadName) return; /* Note that there is no real way portable across R3/R4 to get the original error handler. */ - XGetErrorText (display, error->error_code, buf, sizeof (buf)); + XGetErrorText (display, event->error_code, buf, sizeof (buf)); sprintf (buf1, "X protocol error: %s on protocol request %d", - buf, error->request_code); + buf, event->request_code); x_connection_closed (display, buf1); } @@ -8908,7 +8913,8 @@ xembed_set_info (struct frame *f, enum xembed_info flags) #endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */ static void -xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) +xembed_send_message (struct frame *f, Time t, enum xembed_message msg, + long int detail, long int data1, long int data2) { XEvent event; @@ -8916,8 +8922,8 @@ xembed_send_message (struct frame *f, Time time, enum xembed_message message, lo event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc; event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED; event.xclient.format = 32; - event.xclient.data.l[0] = time; - event.xclient.data.l[1] = message; + event.xclient.data.l[0] = t; + event.xclient.data.l[1] = msg; event.xclient.data.l[2] = detail; event.xclient.data.l[3] = data1; event.xclient.data.l[4] = data2; @@ -9243,19 +9249,19 @@ x_iconify_frame (struct frame *f) /* X11R4: send a ClientMessage to the window manager using the WM_CHANGE_STATE type. */ { - XEvent message; + XEvent msg; - message.xclient.window = FRAME_X_WINDOW (f); - message.xclient.type = ClientMessage; - message.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; - message.xclient.format = 32; - message.xclient.data.l[0] = IconicState; + msg.xclient.window = FRAME_X_WINDOW (f); + msg.xclient.type = ClientMessage; + msg.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; + msg.xclient.format = 32; + msg.xclient.data.l[0] = IconicState; if (! XSendEvent (FRAME_X_DISPLAY (f), DefaultRootWindow (FRAME_X_DISPLAY (f)), False, SubstructureRedirectMask | SubstructureNotifyMask, - &message)) + &msg)) { UNBLOCK_INPUT_RESIGNAL; error ("Can't notify window manager of iconification"); @@ -9747,10 +9753,11 @@ x_display_ok (const char *display) #ifdef USE_GTK static void -my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) +my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, + const gchar *msg, gpointer user_data) { - if (!strstr (message, "g_set_prgname")) - fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); + if (!strstr (msg, "g_set_prgname")) + fprintf (stderr, "%s-WARNING **: %s\n", log_domain, msg); } #endif -- cgit v1.2.1 From cfe0661dbe4551a93878428bc40c53adeb4864ae Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 9 Mar 2011 17:18:51 +0100 Subject: * src/search.c (compile_pattern_1): Remove unused argument. (compile_pattern): Don't pass it. --- src/ChangeLog | 10 ++++++++-- src/search.c | 8 ++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ff5ee064a92..c9133f2ea86 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-09 Juanma Barranquero + + * search.c (compile_pattern_1): Remove argument regp, unused since + revid:rms@gnu.org-19941211082627-3x1g1wyqkjmwloig. + (compile_pattern): Don't pass it. + 2011-03-08 Jan Djärv * xterm.h (DEFAULT_GDK_DISPLAY): New define. @@ -62,7 +68,7 @@ text field. After disabling it, set focus on the list control. (Fx_file_dialog): If only_dir_p is non-nil, set the text of the File Name text field to "Current Directory" if it does not already have - another value. (Bug#8181) + another value. (Bug#8181) 2011-03-07 Adrian Robert @@ -123,7 +129,7 @@ * xdisp.c (BUILD_GLYPHLESS_GLYPH_STRING): Omit unused local var. (produce_glyphless_glyph): Make a pointer "const" since it might point to immutable storage. - (update_window_cursor): Now static, since it's not used elsewhere. + (update_window_cursor): Now static, since it's not used elsewhere. (SKIP_GLYPHS): Removed unused macro. 2011-03-06 Michael Shields (tiny change) diff --git a/src/search.c b/src/search.c index 1e2036f6dc2..dceff94da72 100644 --- a/src/search.c +++ b/src/search.c @@ -114,17 +114,13 @@ matcher_overflow (void) PATTERN is the pattern to compile. CP is the place to put the result. TRANSLATE is a translation table for ignoring case, or nil for none. - REGP is the structure that says where to store the "register" - values that will result from matching this pattern. - If it is 0, we should compile the pattern not to record any - subexpression bounds. POSIX is nonzero if we want full backtracking (POSIX style) for this pattern. 0 means backtrack only enough to get a valid match. The behavior also depends on Vsearch_spaces_regexp. */ static void -compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, struct re_registers *regp, int posix) +compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, int posix) { char *val; reg_syntax_t old; @@ -247,7 +243,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra if (cp->next == 0) { compile_it: - compile_pattern_1 (cp, pattern, translate, regp, posix); + compile_pattern_1 (cp, pattern, translate, posix); break; } } -- cgit v1.2.1 From 28f1c698135e245c0e09e6c5314b4799aca9378d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 09:30:24 -0800 Subject: * xterm.c (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN. --- src/ChangeLog | 1 + src/xterm.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2dc9d34f290..3381fa28aca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -17,6 +17,7 @@ (x_error_catcher, x_connection_closed, x_error_handler): (x_error_quitter, xembed_send_message, x_iconify_frame): (my_log_handler): Rename locals to avoid shadowing. + (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index c542f0d9f29..e218eb95285 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -317,6 +317,7 @@ static void XTframe_up_to_date (struct frame *); static void XTset_terminal_modes (struct terminal *); static void XTreset_terminal_modes (struct terminal *); static void x_clear_frame (struct frame *); +static void x_ins_del_lines (struct frame *, int, int) NO_RETURN; static void frame_highlight (struct frame *); static void frame_unhighlight (struct frame *); static void x_new_focus_frame (struct x_display_info *, struct frame *); @@ -873,6 +874,7 @@ static void x_draw_glyph_string_foreground (struct glyph_string *); static void x_draw_composite_glyph_string_foreground (struct glyph_string *); static void x_draw_glyph_string_box (struct glyph_string *); static void x_draw_glyph_string (struct glyph_string *); +static void x_delete_glyphs (struct frame *, int) NO_RETURN; static void x_compute_glyph_string_overhangs (struct glyph_string *); static void x_set_cursor_gc (struct glyph_string *); static void x_set_mode_line_face_gc (struct glyph_string *); -- cgit v1.2.1 From 2a8fade06259290024cd7fe98fdeb8fd9709c90f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 09:39:28 -0800 Subject: * xterm.c (x_connection_closed): Tell GCC not to suggest NO_RETURN. --- src/ChangeLog | 1 + src/xterm.c | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3381fa28aca..13f1715d3ae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -18,6 +18,7 @@ (x_error_quitter, xembed_send_message, x_iconify_frame): (my_log_handler): Rename locals to avoid shadowing. (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN. + (x_connection_closed): Tell GCC not to suggest NO_RETURN. * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename or move locals to avoid shadowing. diff --git a/src/xterm.c b/src/xterm.c index e218eb95285..abedf3b3bce 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7755,6 +7755,10 @@ For details, see etc/PROBLEMS.\n", unbind_to (idx, Qnil); clear_waiting_for_input (); + + /* Tell GCC not to suggest attribute 'noreturn' for this function. */ + IF_LINT (if (! terminal_list) return; ) + /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, longjmp), because returning from this function would get us back into Xlib's code which will directly call `exit'. */ -- cgit v1.2.1 From f78faa98a289e2acfa6b448b5faf66331c346224 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 16:58:10 -0800 Subject: * xfns.c (x_decode_color, x_set_name, x_window): Now static. --- src/ChangeLog | 4 ++++ src/xfns.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 13f1715d3ae..b88e07e8356 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-10 Paul Eggert + + * xfns.c (x_decode_color, x_set_name, x_window): Now static. + 2011-03-09 Paul Eggert * xterm.h (x_mouse_leave): New decl. diff --git a/src/xfns.c b/src/xfns.c index deb0e192a54..d1907567737 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -648,7 +648,7 @@ x_defined_color (struct frame *f, const char *color_name, is a monochrome frame, return MONO_COLOR regardless of what ARG says. Signal an error if color can't be allocated. */ -int +static int x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color) { XColor cdef; @@ -1635,7 +1635,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name) suggesting a new name, which lisp code should override; if F->explicit_name is set, ignore the new name; otherwise, set it. */ -void +static void x_set_name (struct frame *f, Lisp_Object name, int explicit) { /* Make sure that requests from lisp code override requests from @@ -2620,7 +2620,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only) #else /* not USE_X_TOOLKIT */ #ifdef USE_GTK -void +static void x_window (FRAME_PTR f) { if (! xg_create_frame_widgets (f)) @@ -2660,7 +2660,7 @@ x_window (FRAME_PTR f) #else /*! USE_GTK */ /* Create and set up the X window for frame F. */ -void +static void x_window (struct frame *f) { XClassHint class_hints; -- cgit v1.2.1 From 6b43790020907a8199984a44f5624f842edea754 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 16:59:17 -0800 Subject: * xfns.c (Fx_create_frame): Add braces to silence GCC warning. --- src/ChangeLog | 1 + src/xfns.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b88e07e8356..4d9bd6234fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-10 Paul Eggert * xfns.c (x_decode_color, x_set_name, x_window): Now static. + (Fx_create_frame): Add braces to silence GCC warning. 2011-03-09 Paul Eggert diff --git a/src/xfns.c b/src/xfns.c index d1907567737..8ba91f9ffb8 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3448,8 +3448,9 @@ This function is an internal primitive--use `make-frame' instead. */) else if (! NILP (visibility)) x_make_frame_visible (f); else - /* Must have been Qnil. */ - ; + { + /* Must have been Qnil. */ + } } BLOCK_INPUT; -- cgit v1.2.1 From c0951e534c34cb4400bf9dcb18ae40b31a684bae Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:03:29 -0800 Subject: * xfns.c (Fx_file_dialog, Fx_select_font): Fix pointer signedness. --- src/ChangeLog | 1 + src/xfns.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4d9bd6234fa..3a870511bba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * xfns.c (x_decode_color, x_set_name, x_window): Now static. (Fx_create_frame): Add braces to silence GCC warning. + (Fx_file_dialog, Fx_select_font): Fix pointer signedness. 2011-03-09 Paul Eggert diff --git a/src/xfns.c b/src/xfns.c index 8ba91f9ffb8..45e0e13dcbc 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5566,11 +5566,11 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) BLOCK_INPUT; if (STRINGP (default_filename)) - cdef_file = SDATA (default_filename); + cdef_file = SSDATA (default_filename); else - cdef_file = SDATA (dir); + cdef_file = SSDATA (dir); - fn = xg_get_file_name (f, SDATA (prompt), cdef_file, + fn = xg_get_file_name (f, SSDATA (prompt), cdef_file, ! NILP (mustmatch), ! NILP (only_dir_p)); @@ -5626,12 +5626,12 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) XSETFONT (font, FRAME_FONT (f)); font_param = Ffont_get (font, intern (":name")); if (STRINGP (font_param)) - default_name = xstrdup (SDATA (font_param)); + default_name = xstrdup (SSDATA (font_param)); else { font_param = Fframe_parameter (frame, Qfont_param); if (STRINGP (font_param)) - default_name = xstrdup (SDATA (font_param)); + default_name = xstrdup (SSDATA (font_param)); } if (default_name == NULL && x_last_font_name != NULL) -- cgit v1.2.1 From 06b0c8a0ddcb60b00fcf60a3dcd8b7193bca3cc7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:06:01 -0800 Subject: * xfns.c: (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame): Remove unused locals. --- src/ChangeLog | 2 ++ src/xfns.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3a870511bba..51724faf9c7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,8 @@ * xfns.c (x_decode_color, x_set_name, x_window): Now static. (Fx_create_frame): Add braces to silence GCC warning. (Fx_file_dialog, Fx_select_font): Fix pointer signedness. + (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame): + Remove unused locals. 2011-03-09 Paul Eggert diff --git a/src/xfns.c b/src/xfns.c index 45e0e13dcbc..21453a8958a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -461,7 +461,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr) Window win = f->output_data.x->parent_desc; Atom actual_type; unsigned long actual_size, bytes_remaining; - int i, rc, actual_format; + int rc, actual_format; struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); long max_len = 400; Display *dpy = FRAME_X_DISPLAY (f); @@ -746,7 +746,6 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file) int xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data) { - int result = 0; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); if (!pixbuf) @@ -4578,7 +4577,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object text) { struct frame *f; - Lisp_Object frame, tem; + Lisp_Object frame; Lisp_Object name; long window_prompting = 0; int width, height; -- cgit v1.2.1 From 7e3ab3026e9b0f783b8aacead1fad668c792e8ab Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:28:06 -0800 Subject: * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros, so that the caller can use some name other than gcpro1. (GCPRO1, UNGCPRO): Reimplement in terms of the new macros. (Fx_create_frame, x_create_tip_frame, Fx_show_tip): (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing. Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR macros. --- src/ChangeLog | 7 +++++++ src/lisp.h | 15 +++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 51724faf9c7..33fa9806be2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,10 +1,17 @@ 2011-03-10 Paul Eggert + * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros, + so that the caller can use some name other than gcpro1. + (GCPRO1, UNGCPRO): Reimplement in terms of the new macros. * xfns.c (x_decode_color, x_set_name, x_window): Now static. (Fx_create_frame): Add braces to silence GCC warning. (Fx_file_dialog, Fx_select_font): Fix pointer signedness. (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame): Remove unused locals. + (Fx_create_frame, x_create_tip_frame, Fx_show_tip): + (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing. + Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR + macros. 2011-03-09 Paul Eggert diff --git a/src/lisp.h b/src/lisp.h index 1e8e01cf91f..fa8cb223a6a 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2150,12 +2150,15 @@ struct gcpro || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS) +#define GCPRO1(varname) GCPRO1_VAR (varname, gcpro1) +#define UNGCPRO UNGCPRO_VAR (gcpro1) + #if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS /* Do something silly with gcproN vars just so gcc shuts up. */ /* You get warnings from MIPSPro... */ -#define GCPRO1(varname) ((void) gcpro1) +#define GCPRO1_VAR(varname, gcpro1) ((void) gcpro1) #define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1)) #define GCPRO3(varname1, varname2, varname3) \ (((void) gcpro3, (void) gcpro2, (void) gcpro1)) @@ -2165,13 +2168,13 @@ struct gcpro (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) #define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define UNGCPRO ((void) 0) +#define UNGCPRO_VAR(gcpro1) ((void) 0) #else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ #ifndef DEBUG_GCPRO -#define GCPRO1(varname) \ +#define GCPRO1_VAR(varname, gcpro1) \ {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ gcprolist = &gcpro1; } @@ -2210,13 +2213,13 @@ struct gcpro gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ gcprolist = &gcpro6; } -#define UNGCPRO (gcprolist = gcpro1.next) +#define UNGCPRO_VAR(gcpro1) (gcprolist = gcpro1.next) #else extern int gcpro_level; -#define GCPRO1(varname) \ +#define GCPRO1_VAR(varname, gcpro1) \ {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ gcpro1.level = gcpro_level++; \ gcprolist = &gcpro1; } @@ -2266,7 +2269,7 @@ extern int gcpro_level; gcpro6.level = gcpro_level++; \ gcprolist = &gcpro6; } -#define UNGCPRO \ +#define UNGCPRO_VAR(gcpro1) \ ((--gcpro_level != gcpro1.level) \ ? (abort (), 0) \ : ((gcprolist = gcpro1.next), 0)) -- cgit v1.2.1 From 811e9bacd8e24097bc65f1dfa79a5f6ac51071d9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:30:22 -0800 Subject: * xselect.c (x_disown_buffer_selections): Remove; not used. --- src/ChangeLog | 2 ++ src/xselect.c | 20 -------------------- 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 33fa9806be2..5a84813fd80 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-10 Paul Eggert + * xselect.c (x_disown_buffer_selections): Remove; not used. + * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros, so that the caller can use some name other than gcpro1. (GCPRO1, UNGCPRO): Reimplement in terms of the new macros. diff --git a/src/xselect.c b/src/xselect.c index a502a74f904..9fedb7126e1 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2131,26 +2131,6 @@ Disowning it means there is no such selection. */) return Qt; } -/* Get rid of all the selections in buffer BUFFER. - This is used when we kill a buffer. */ - -void -x_disown_buffer_selections (Lisp_Object buffer) -{ - Lisp_Object tail; - struct buffer *buf = XBUFFER (buffer); - - for (tail = Vselection_alist; CONSP (tail); tail = XCDR (tail)) - { - Lisp_Object elt, value; - elt = XCAR (tail); - value = XCDR (elt); - if (CONSP (value) && MARKERP (XCAR (value)) - && XMARKER (XCAR (value))->buffer == buf) - Fx_disown_selection_internal (XCAR (elt), Qnil); - } -} - DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, 0, 1, 0, doc: /* Whether the current Emacs process owns the given X Selection. -- cgit v1.2.1 From 7b83e2f1ffb02ad6965a47e249b35189f15b56cf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:31:57 -0800 Subject: * xselect.c (TRACE3) [!defined TRACE_SELECTION]: Remove; not used. --- src/ChangeLog | 1 + src/xselect.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5a84813fd80..b25fcc36799 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-10 Paul Eggert * xselect.c (x_disown_buffer_selections): Remove; not used. + (TRACE3) [!defined TRACE_SELECTION]: Remove; not used. * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros, so that the caller can use some name other than gcpro1. diff --git a/src/xselect.c b/src/xselect.c index 9fedb7126e1..27517f8252d 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -97,7 +97,6 @@ static Lisp_Object clean_local_selection_data (Lisp_Object); #define TRACE0(fmt) (void) 0 #define TRACE1(fmt, a0) (void) 0 #define TRACE2(fmt, a0, a1) (void) 0 -#define TRACE3(fmt, a0, a1) (void) 0 #endif -- cgit v1.2.1 From aa0daa9f93d94c229512e8cb0f0dc7c48c2b3e41 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:36:58 -0800 Subject: * xselect.c (x_own_selection, Fx_disown_selection_internal): Rename locals to avoid shadowing. (x_handle_dnd_message): Remove local to avoid shadowing. --- src/ChangeLog | 3 +++ src/xselect.c | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b25fcc36799..40c502a7970 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,9 @@ * xselect.c (x_disown_buffer_selections): Remove; not used. (TRACE3) [!defined TRACE_SELECTION]: Remove; not used. + (x_own_selection, Fx_disown_selection_internal): Rename locals + to avoid shadowing. + (x_handle_dnd_message): Remove local to avoid shadowing. * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros, so that the caller can use some name other than gcpro1. diff --git a/src/xselect.c b/src/xselect.c index 27517f8252d..5254fa96838 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -329,7 +329,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) struct frame *sf = SELECTED_FRAME (); Window selecting_window; Display *display; - Time time = last_event_timestamp; + Time timestamp = last_event_timestamp; Atom selection_atom; struct x_display_info *dpyinfo; @@ -345,7 +345,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) BLOCK_INPUT; x_catch_errors (display); - XSetSelectionOwner (display, selection_atom, selecting_window, time); + XSetSelectionOwner (display, selection_atom, selecting_window, timestamp); x_check_errors (display, "Can't set selection: %s"); x_uncatch_errors (); UNBLOCK_INPUT; @@ -356,7 +356,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) Lisp_Object selection_data; Lisp_Object prev_value; - selection_time = long_to_cons ((unsigned long) time); + selection_time = long_to_cons ((unsigned long) timestamp); selection_data = list4 (selection_name, selection_value, selection_time, selected_frame); prev_value = assq_no_quit (selection_name, Vselection_alist); @@ -2084,7 +2084,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, Sx_disown_selection_internal, 1, 2, 0, doc: /* If we own the selection SELECTION, disown it. Disowning it means there is no such selection. */) - (Lisp_Object selection, Lisp_Object time) + (Lisp_Object selection, Lisp_Object time_object) { Time timestamp; Atom selection_atom; @@ -2103,10 +2103,10 @@ Disowning it means there is no such selection. */) display = FRAME_X_DISPLAY (sf); dpyinfo = FRAME_X_DISPLAY_INFO (sf); CHECK_SYMBOL (selection); - if (NILP (time)) + if (NILP (time_object)) timestamp = last_event_timestamp; else - timestamp = cons_to_long (time); + timestamp = cons_to_long (time_object); if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil; /* Don't disown the selection when we're not the owner. */ @@ -2434,7 +2434,6 @@ x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, struct x_disp if (event->format == 32 && event->format < BITS_PER_LONG) { - int i; for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */ idata[i] = (int) event->data.l[i]; data = (unsigned char *) idata; -- cgit v1.2.1 From b47160217819ef2408f1115d7f812c16d06dcbcb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:40:21 -0800 Subject: * xrdb.c: Include "xterm.h", to check x_load_resources's interface. --- src/ChangeLog | 2 ++ src/xrdb.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 40c502a7970..e3eb8fe02a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-10 Paul Eggert + * xrdb.c: Include "xterm.h", to check x_load_resources's interface. + * xselect.c (x_disown_buffer_selections): Remove; not used. (TRACE3) [!defined TRACE_SELECTION]: Remove; not used. (x_own_selection, Fx_disown_selection_internal): Rename locals diff --git a/src/xrdb.c b/src/xrdb.c index 9fb3f3474fb..63e5851979c 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -28,6 +28,12 @@ along with GNU Emacs. If not, see . */ #include #include +#include "lisp.h" + +/* This may include sys/types.h, and that somehow loses + if this is not done before the other system files. */ +#include "xterm.h" + #include #include #include @@ -38,8 +44,6 @@ along with GNU Emacs. If not, see . */ #endif #include -#include "lisp.h" - #ifdef USE_MOTIF /* For Vdouble_click_time. */ #include "keyboard.h" -- cgit v1.2.1 From a5c0af8162783a5db690752861fdd7430fde351a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:41:18 -0800 Subject: * fontset.c (free_realized_fontset): Now static. --- src/ChangeLog | 2 ++ src/fontset.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e3eb8fe02a0..0b7f7e798a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-10 Paul Eggert + * fontset.c (free_realized_fontset): Now static. + * xrdb.c: Include "xterm.h", to check x_load_resources's interface. * xselect.c (x_disown_buffer_selections): Remove; not used. diff --git a/src/fontset.c b/src/fontset.c index f297fd10a71..345d991d05d 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -836,7 +836,7 @@ fontset_ascii (int id) return elt; } -void +static void free_realized_fontset (FRAME_PTR f, Lisp_Object fontset) { Lisp_Object tail; -- cgit v1.2.1 From 7519b8cd68973132dba3fa8dd4ecde8daa8cff71 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:43:19 -0800 Subject: * fontset.c (Fset_fontset_font): Rename local to avoid shadowing. --- src/ChangeLog | 1 + src/fontset.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0b7f7e798a5..5dda0430849 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-10 Paul Eggert * fontset.c (free_realized_fontset): Now static. + (Fset_fontset_font): Rename local to avoid shadowing. * xrdb.c: Include "xterm.h", to check x_load_resources's interface. diff --git a/src/fontset.c b/src/fontset.c index 345d991d05d..d732820c28a 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1583,14 +1583,14 @@ appended. By default, FONT-SPEC overrides the previous settings. */) if (ascii_changed) { - Lisp_Object tail, frame, alist; + Lisp_Object tail, fr, alist; int fontset_id = XINT (FONTSET_ID (fontset)); FONTSET_ASCII (fontset) = fontname; name = FONTSET_NAME (fontset); - FOR_EACH_FRAME (tail, frame) + FOR_EACH_FRAME (tail, fr) { - FRAME_PTR f = XFRAME (frame); + FRAME_PTR f = XFRAME (fr); Lisp_Object font_object; struct face *face; @@ -1607,7 +1607,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) { update_auto_fontset_alist (font_object, fontset); alist = Fcons (Fcons (Qfont, Fcons (name, font_object)), Qnil); - Fmodify_frame_parameters (frame, alist); + Fmodify_frame_parameters (fr, alist); } } } -- cgit v1.2.1 From cc6e5db1ae708b81f02945f6c6dbe11e92fa1d46 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:44:38 -0800 Subject: * fontset.c (fontset_font): Mark local as initialized. --- src/ChangeLog | 1 + src/fontset.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5dda0430849..7d4d5e00df1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * fontset.c (free_realized_fontset): Now static. (Fset_fontset_font): Rename local to avoid shadowing. + (fontset_font): Mark local as initialized. * xrdb.c: Include "xterm.h", to check x_load_resources's interface. diff --git a/src/fontset.c b/src/fontset.c index d732820c28a..3c156691b1b 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -713,7 +713,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa static Lisp_Object fontset_font (Lisp_Object fontset, int c, struct face *face, int id) { - Lisp_Object rfont_def, default_rfont_def; + Lisp_Object rfont_def, default_rfont_def IF_LINT (= Qnil); Lisp_Object base_fontset; /* Try a font-group of FONTSET. */ -- cgit v1.2.1 From a9a06e0b10b7583e73ffebd7111937516264c4d5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:48:47 -0800 Subject: * fontset.c (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused. --- src/ChangeLog | 1 + src/fontset.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7d4d5e00df1..094343b2d56 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * fontset.c (free_realized_fontset): Now static. (Fset_fontset_font): Rename local to avoid shadowing. (fontset_font): Mark local as initialized. + (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused. * xrdb.c: Include "xterm.h", to check x_load_resources's interface. diff --git a/src/fontset.c b/src/fontset.c index 3c156691b1b..b5d8a0db434 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -233,14 +233,14 @@ fontset_id_valid_p (int id) /* Macros to access special values of (base) FONTSET. */ #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] -#define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] +/* #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] */ /* Macros to access special values of (realized) FONTSET. */ #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] #define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] #define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] -#define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] +/* #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] */ #define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] /* For both base and realized fontset. */ @@ -266,7 +266,6 @@ fontset_id_valid_p (int id) ASET ((rfont_def), 0, make_number (face_id)) #define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1) #define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1)) -#define RFONT_DEF_REPERTORY(rfont_def) FONT_DEF_REPERTORY (AREF (rfont_def, 1)) #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) #define RFONT_DEF_SET_OBJECT(rfont_def, object) \ ASET ((rfont_def), 2, (object)) -- cgit v1.2.1 From 58d2d479084c072255e11fbb3f03afaaa3fcdfa2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 17:58:37 -0800 Subject: * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip): (Fx_backspace_delete_keys_p): Use them to avoid shadowing, and rename vars to avoid shadowing. (x_decode_color, x_set_name, x_window): Now static. --- src/ChangeLog | 5 ++++- src/xfns.c | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 094343b2d56..719984f5038 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -16,7 +16,10 @@ * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros, so that the caller can use some name other than gcpro1. (GCPRO1, UNGCPRO): Reimplement in terms of the new macros. - * xfns.c (x_decode_color, x_set_name, x_window): Now static. + * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip): + (Fx_backspace_delete_keys_p): + Use them to avoid shadowing, and rename vars to avoid shadowing. + (x_decode_color, x_set_name, x_window): Now static. (Fx_create_frame): Add braces to silence GCC warning. (Fx_file_dialog, Fx_select_font): Fix pointer signedness. (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame): diff --git a/src/xfns.c b/src/xfns.c index 21453a8958a..3f0bd2a7d6a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3183,7 +3183,7 @@ This function is an internal primitive--use `make-frame' instead. */) to get the color reference counts right, so initialize them! */ { Lisp_Object black; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; /* Function x_decode_color can signal an error. Make sure to initialize color slots so that we won't try @@ -3196,7 +3196,7 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_data.x->mouse_pixel = -1; black = build_string ("black"); - GCPRO1 (black); + GCPRO1_VAR (black, inner_gcpro1); FRAME_FOREGROUND_PIXEL (f) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); FRAME_BACKGROUND_PIXEL (f) @@ -3209,7 +3209,7 @@ This function is an internal primitive--use `make-frame' instead. */) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); f->output_data.x->mouse_pixel = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro1); } /* Specify the parent under which to make this X window. */ @@ -4651,7 +4651,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, to get the color reference counts right, so initialize them! */ { Lisp_Object black; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; /* Function x_decode_color can signal an error. Make sure to initialize color slots so that we won't try @@ -4664,7 +4664,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, f->output_data.x->mouse_pixel = -1; black = build_string ("black"); - GCPRO1 (black); + GCPRO1_VAR (black, inner_gcpro1); FRAME_FOREGROUND_PIXEL (f) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); FRAME_BACKGROUND_PIXEL (f) @@ -4677,7 +4677,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); f->output_data.x->mouse_pixel = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro1); } /* Set the name; the functions to which we pass f expect the name to @@ -5035,7 +5035,7 @@ Text larger than the specified size is clipped. */) && !NILP (Fequal (last_string, string)) && !NILP (Fequal (last_parms, parms))) { - struct frame *f = XFRAME (tip_frame); + struct frame *tip_f = XFRAME (tip_frame); /* Only DX and DY have changed. */ if (!NILP (tip_timer)) @@ -5046,9 +5046,9 @@ Text larger than the specified size is clipped. */) } BLOCK_INPUT; - compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); - XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), + FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); + XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f), root_x, root_y); UNBLOCK_INPUT; goto start_timer; @@ -5694,7 +5694,7 @@ present and mapped to the usual X keysyms. */) struct frame *f = check_x_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); Lisp_Object have_keys; - int major, minor, op, event, error; + int major, minor, op, event, error_code; BLOCK_INPUT; @@ -5710,7 +5710,7 @@ present and mapped to the usual X keysyms. */) /* Check that the server supports XKB. */ major = XkbMajorVersion; minor = XkbMinorVersion; - if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor)) + if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor)) { UNBLOCK_INPUT; return Qlambda; -- cgit v1.2.1 From 524c7aa6108b4178ca8436db8022686d180a5ca5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 18:01:53 -0800 Subject: * alloc.c (mark_fringe_data): Move decl from here ... * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here, to check its interface. (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM. --- src/ChangeLog | 5 +++++ src/alloc.c | 4 ---- src/lisp.h | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 719984f5038..55e003142d4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-03-10 Paul Eggert + * alloc.c (mark_fringe_data): Move decl from here ... + * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here, + to check its interface. + (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM. + * fontset.c (free_realized_fontset): Now static. (Fset_fontset_font): Rename local to avoid shadowing. (fontset_font): Mark local as initialized. diff --git a/src/alloc.c b/src/alloc.c index 8632897606a..6c92f36ca7d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -276,10 +276,6 @@ static void gc_sweep (void); static void mark_glyph_matrix (struct glyph_matrix *); static void mark_face_cache (struct face_cache *); -#ifdef HAVE_WINDOW_SYSTEM -extern void mark_fringe_data (void); -#endif /* HAVE_WINDOW_SYSTEM */ - static struct Lisp_String *allocate_string (void); static void compact_small_strings (void); static void free_large_strings (void); diff --git a/src/lisp.h b/src/lisp.h index fa8cb223a6a..113585320af 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2540,7 +2540,10 @@ extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y); /* Defined in fringe.c */ extern void syms_of_fringe (void); extern void init_fringe (void); +#ifdef HAVE_WINDOW_SYSTEM +extern void mark_fringe_data (void); extern void init_fringe_once (void); +#endif /* HAVE_WINDOW_SYSTEM */ /* Defined in image.c */ extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; -- cgit v1.2.1 From bf60f6168239d399ac5522025e7dd1bcf18afe24 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2011 18:02:40 -0800 Subject: * fringe.c (destroy_fringe_bitmap, init_fringe_bitmap): Now static. --- src/ChangeLog | 2 ++ src/fringe.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 55e003142d4..b6ab1e18dcc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-10 Paul Eggert + * fringe.c (destroy_fringe_bitmap, init_fringe_bitmap): Now static. + * alloc.c (mark_fringe_data): Move decl from here ... * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here, to check its interface. diff --git a/src/fringe.c b/src/fringe.c index d42d6467f31..84606a2c767 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -1380,7 +1380,7 @@ compute_fringe_widths (struct frame *f, int redraw) /* Free resources used by a user-defined bitmap. */ -void +static void destroy_fringe_bitmap (int n) { struct fringe_bitmap **fbp; @@ -1448,7 +1448,7 @@ static const unsigned char swap_nibble[16] = { 0x3, 0xb, 0x7, 0xf}; /* 0011 1011 0111 1111 */ #endif /* HAVE_X_WINDOWS */ -void +static void init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p) { if (once_p || fb->dynamic) @@ -1831,4 +1831,3 @@ w32_reset_fringes (void) #endif /* HAVE_NTGUI */ #endif /* HAVE_WINDOW_SYSTEM */ - -- cgit v1.2.1 From 500188f4835ff80e19e7b3207160f37f5807aa52 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 13:46:21 -0800 Subject: * fringe.c (update_window_fringes): Initialize top_row_ends_at_zv_p and bot_row_ends_at_zv_p, with a FIXME comment. --- src/ChangeLog | 2 ++ src/fringe.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b6ab1e18dcc..a1c4b0fd967 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2011-03-10 Paul Eggert * fringe.c (destroy_fringe_bitmap, init_fringe_bitmap): Now static. + (update_window_fringes): Initialize top_row_ends_at_zv_p and + bot_row_ends_at_zv_p, with a FIXME comment. * alloc.c (mark_fringe_data): Move decl from here ... * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here, diff --git a/src/fringe.c b/src/fringe.c index 84606a2c767..a980bdf146f 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -913,7 +913,10 @@ update_window_fringes (struct window *w, int keep_current_p) int bitmap_cache[MAX_BITMAP_CACHE]; int top_ind_rn, bot_ind_rn; int top_ind_min_y, bot_ind_max_y; - int top_row_ends_at_zv_p, bot_row_ends_at_zv_p; + + /* FIXME: Do these need to be initialized? If not, please change + their "= 0"s to "IF_LINT (= 0)"s. Either way, please explain. */ + int top_row_ends_at_zv_p = 0, bot_row_ends_at_zv_p = 0; if (w->pseudo_window_p) return 0; -- cgit v1.2.1 From c40f8d15c0e2fa6468df9c5d8d5797e4d98c074b Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 11 Mar 2011 01:19:57 +0100 Subject: * .gdbinit (pwinx, xbuffer): Fix access to buffer name. --- src/.gdbinit | 4 ++-- src/ChangeLog | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/.gdbinit b/src/.gdbinit index 3072dc956b9..2cf5663df91 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -392,7 +392,7 @@ define pwinx printf "Window %d ", $int xgetptr $w->buffer set $tem = (struct buffer *) $ptr - xgetptr $tem->name + xgetptr $tem->name_ printf "%s", ((struct Lisp_String *) $ptr)->data printf "\n" xgetptr $w->start @@ -938,7 +938,7 @@ end define xbuffer xgetptr $ print (struct buffer *) $ptr - xgetptr $->name + xgetptr $->name_ output ((struct Lisp_String *) $ptr)->data echo \n end diff --git a/src/ChangeLog b/src/ChangeLog index c9133f2ea86..c4af193d1b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-11 Andreas Schwab + + * .gdbinit (pwinx, xbuffer): Fix access to buffer name. + 2011-03-09 Juanma Barranquero * search.c (compile_pattern_1): Remove argument regp, unused since -- cgit v1.2.1 From c47cbdfd2e29e350b3b7736cc1a66fcae8a99830 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Fri, 11 Mar 2011 10:43:49 +0900 Subject: * src/unexmacosx.c (copy_data_segment): Also copy __got section. (Bug#8223) --- src/ChangeLog | 5 +++++ src/unexmacosx.c | 1 + 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 12ea037ee91..1d974876c52 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-11 YAMAMOTO Mitsuharu + + * unexmacosx.c (copy_data_segment): Also copy __got section. + (Bug#8223) + 2011-03-07 Chong Yidong * Version 23.3 released. diff --git a/src/unexmacosx.c b/src/unexmacosx.c index df4c0da4cb1..d6f170c9127 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -822,6 +822,7 @@ copy_data_segment (struct load_command *lc) } else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 + || strncmp (sectp->sectname, "__got", 16) == 0 || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0 || strncmp (sectp->sectname, "__dyld", 16) == 0 || strncmp (sectp->sectname, "__const", 16) == 0 -- cgit v1.2.1 From 126bc0dcacb6704b8db9e82c4af3eedd1b239715 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Fri, 11 Mar 2011 12:56:20 +0900 Subject: * src/fringe.c (update_window_fringes): Remove unused variables. --- src/ChangeLog | 2 ++ src/fringe.c | 8 -------- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1d974876c52..a4a80cbf9f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-11 YAMAMOTO Mitsuharu + * fringe.c (update_window_fringes): Remove unused variables. + * unexmacosx.c (copy_data_segment): Also copy __got section. (Bug#8223) diff --git a/src/fringe.c b/src/fringe.c index 4a6d898d97f..861aa6e9487 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -991,18 +991,10 @@ update_window_fringes (w, keep_current_p) y < yb && rn < nrows; y += row->height, ++rn) { - unsigned indicate_bob_p, indicate_top_line_p; - unsigned indicate_eob_p, indicate_bottom_line_p; - row = w->desired_matrix->rows + rn; if (!row->enabled_p) row = w->current_matrix->rows + rn; - indicate_bob_p = row->indicate_bob_p; - indicate_top_line_p = row->indicate_top_line_p; - indicate_eob_p = row->indicate_eob_p; - indicate_bottom_line_p = row->indicate_bottom_line_p; - row->indicate_bob_p = row->indicate_top_line_p = 0; row->indicate_eob_p = row->indicate_bottom_line_p = 0; -- cgit v1.2.1 From 4b1ec8634128e4389f400e948337f2839be44d8f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 22:06:36 -0800 Subject: * fringe.c (update_window_fringes): Mark locals as initialized --- src/ChangeLog | 8 ++++---- src/fringe.c | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a1c4b0fd967..280434d0860 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,8 @@ -2011-03-10 Paul Eggert +2011-03-11 Paul Eggert - * fringe.c (destroy_fringe_bitmap, init_fringe_bitmap): Now static. - (update_window_fringes): Initialize top_row_ends_at_zv_p and - bot_row_ends_at_zv_p, with a FIXME comment. + * fringe.c (update_window_fringes): Mark locals as initialized + (Bug#8227). + (destroy_fringe_bitmap, init_fringe_bitmap): Now static. * alloc.c (mark_fringe_data): Move decl from here ... * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here, diff --git a/src/fringe.c b/src/fringe.c index a980bdf146f..8e2f4eb8d24 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -913,10 +913,7 @@ update_window_fringes (struct window *w, int keep_current_p) int bitmap_cache[MAX_BITMAP_CACHE]; int top_ind_rn, bot_ind_rn; int top_ind_min_y, bot_ind_max_y; - - /* FIXME: Do these need to be initialized? If not, please change - their "= 0"s to "IF_LINT (= 0)"s. Either way, please explain. */ - int top_row_ends_at_zv_p = 0, bot_row_ends_at_zv_p = 0; + int top_row_ends_at_zv_p IF_LINT (= 0), bot_row_ends_at_zv_p IF_LINT (= 0); if (w->pseudo_window_p) return 0; -- cgit v1.2.1 From 40714c5307985eba0f220d208537e211222c104e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 22:23:26 -0800 Subject: * fringe.c: Add comment. --- src/fringe.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/fringe.c b/src/fringe.c index 8e2f4eb8d24..82fc38aee8a 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -913,6 +913,11 @@ update_window_fringes (struct window *w, int keep_current_p) int bitmap_cache[MAX_BITMAP_CACHE]; int top_ind_rn, bot_ind_rn; int top_ind_min_y, bot_ind_max_y; + + /* top_ind_rn is set to a nonnegative value whenver + row->indicate_bob_p is set, so it's OK that top_row_ends_at_zv_p + is not initialized here. Similarly for bot_ind_rn, + row->indicate_eob_p and bot_row_ends_at_zv_p. */ int top_row_ends_at_zv_p IF_LINT (= 0), bot_row_ends_at_zv_p IF_LINT (= 0); if (w->pseudo_window_p) -- cgit v1.2.1 From 53df7c11622bd13fd4336bdecfe7537ace3e2767 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 22:41:50 -0800 Subject: Add bug#s. --- src/ChangeLog | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 280434d0860..e29de95e82f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -38,8 +38,6 @@ Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR macros. -2011-03-09 Paul Eggert - * xterm.h (x_mouse_leave): New decl. * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame): @@ -80,7 +78,7 @@ since it's unused otherwise. * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff. - Add a FIXME comment, since the code still doesn't look right. + Add a FIXME, since the code still doesn't look right. (Bug#8215) (Fcurrent_bidi_paragraph_direction): Simplify slightly; this avoids a gcc -Wuninitialized diagnostic. (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs): @@ -108,7 +106,7 @@ and to avoid gcc -Wuninitialized warning. (load_charset_map): Mark variables that gcc -Wuninitialized does not deduce are never used uninitialized. - (load_charset): Abort instead of using uninitialized var. + (load_charset): Abort instead of using uninitialized var (Bug#8229). * coding.c (coding_set_source, coding_set_destination): Use "else { /* comment */ }" rather than "else /* comment */;" @@ -130,7 +128,7 @@ -Wuninitialized does not deduce are never used uninitialized. (detect_coding_iso_2022): Initialize a local variable that might be used uninitialized. Leave a FIXME because it's not clear that - this initialization is needed. + this initialization is needed. (Bug#8211) (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT): (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P): (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER): -- cgit v1.2.1 From ce0ad53d442b9e87050d276e4efbcd733c51a9d8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 23:42:54 -0800 Subject: * image.c (clear_image_cache): Now static. 2011-03-11 Paul Eggert --- src/ChangeLog | 4 ++++ src/image.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3a6b09dfb1f..0b3d7069cc9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-11 Paul Eggert + + * image.c (clear_image_cache): Now static. + 2011-03-11 Paul Eggert Fix some minor problems found by GCC 4.5.2's static checks. diff --git a/src/image.c b/src/image.c index c7820c3a7fe..31c8d5bcf6c 100644 --- a/src/image.c +++ b/src/image.c @@ -1493,7 +1493,7 @@ free_image_cache (struct frame *f) If image-cache-eviction-delay is non-nil, this frees images in the cache which weren't displayed for at least that many seconds. */ -void +static void clear_image_cache (struct frame *f, Lisp_Object filter) { struct image_cache *c = FRAME_IMAGE_CACHE (f); -- cgit v1.2.1 From d5d5a6173b3bd4c68354b6dceab58ac8e25a0deb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 23:50:08 -0800 Subject: * image.c (DIM, HAVE_STDLIB_H_1): Remove unused macros. --- src/ChangeLog | 1 + src/image.c | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0b3d7069cc9..d1e2fea4edb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-11 Paul Eggert * image.c (clear_image_cache): Now static. + (DIM, HAVE_STDLIB_H_1): Remove unused macros. 2011-03-11 Paul Eggert diff --git a/src/image.c b/src/image.c index 31c8d5bcf6c..e25cef52957 100644 --- a/src/image.c +++ b/src/image.c @@ -550,10 +550,6 @@ x_create_bitmap_mask (struct frame *f, int id) Image types ***********************************************************************/ -/* Value is the number of elements of vector VECTOR. */ - -#define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) - /* List of supported image types. Use define_image_type to add new types. Use lookup_image_type to find a type for a given symbol. */ @@ -6032,7 +6028,6 @@ jpeg_image_p (Lisp_Object object) /* Work around a warning about HAVE_STDLIB_H being redefined in jconfig.h. */ #ifdef HAVE_STDLIB_H -#define HAVE_STDLIB_H_1 #undef HAVE_STDLIB_H #endif /* HAVE_STLIB_H */ -- cgit v1.2.1 From e22cffbc1c9ff76a9870311fb6b9fcd49d013933 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 23:54:50 -0800 Subject: * image.c (xpm_load): Redo to avoid "discards qualifiers" gcc warning. --- src/ChangeLog | 1 + src/image.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d1e2fea4edb..158c5ff5330 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * image.c (clear_image_cache): Now static. (DIM, HAVE_STDLIB_H_1): Remove unused macros. + (xpm_load): Redo to avoid "discards qualifiers" gcc warning. 2011-03-11 Paul Eggert diff --git a/src/image.c b/src/image.c index e25cef52957..4befadd44ef 100644 --- a/src/image.c +++ b/src/image.c @@ -3425,11 +3425,12 @@ xpm_load (struct frame *f, struct image *img) { Lisp_Object name; Lisp_Object color; + char *empty_string = (char *) ""; if (!CONSP (XCAR (tail))) { - xpm_syms[i].name = ""; - xpm_syms[i].value = ""; + xpm_syms[i].name = empty_string; + xpm_syms[i].value = empty_string; continue; } name = XCAR (XCAR (tail)); @@ -3440,14 +3441,14 @@ xpm_load (struct frame *f, struct image *img) strcpy (xpm_syms[i].name, SSDATA (name)); } else - xpm_syms[i].name = ""; + xpm_syms[i].name = empty_string; if (STRINGP (color)) { xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); strcpy (xpm_syms[i].value, SSDATA (color)); } else - xpm_syms[i].value = ""; + xpm_syms[i].value = empty_string; } } -- cgit v1.2.1 From 77a765fd789f80afbe170bf640794a4b25968ea6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 10 Mar 2011 23:59:36 -0800 Subject: * image.c (x_edge_detection): Remove unnecessary cast that gcc -Wbad-function-cast diagnoses. --- src/ChangeLog | 2 ++ src/image.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 158c5ff5330..cb535bad8a4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,8 @@ * image.c (clear_image_cache): Now static. (DIM, HAVE_STDLIB_H_1): Remove unused macros. (xpm_load): Redo to avoid "discards qualifiers" gcc warning. + (x_edge_detection): Remove unnecessary cast that + gcc -Wbad-function-cast diagnoses. 2011-03-11 Paul Eggert diff --git a/src/image.c b/src/image.c index 4befadd44ef..810bd4be989 100644 --- a/src/image.c +++ b/src/image.c @@ -4687,7 +4687,7 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix, color_adjust = make_number (0xffff / 2); if (i == 9 && NUMBERP (color_adjust)) - x_detect_edges (f, img, trans, (int) XFLOATINT (color_adjust)); + x_detect_edges (f, img, trans, XFLOATINT (color_adjust)); } -- cgit v1.2.1 From 2037898d7ada760ef84df072d05addf826710f65 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Mar 2011 00:01:09 -0800 Subject: * image.c (gif_load): Fix pointer signedness. --- src/ChangeLog | 1 + src/image.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cb535bad8a4..7170fcc162a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,7 @@ (xpm_load): Redo to avoid "discards qualifiers" gcc warning. (x_edge_detection): Remove unnecessary cast that gcc -Wbad-function-cast diagnoses. + (gif_load): Fix pointer signedness. 2011-03-11 Paul Eggert diff --git a/src/image.c b/src/image.c index 810bd4be989..383e154b265 100644 --- a/src/image.c +++ b/src/image.c @@ -7127,7 +7127,7 @@ gif_load (struct frame *f, struct image *img) } /* Open the GIF file. */ - gif = fn_DGifOpenFileName (SDATA (file)); + gif = fn_DGifOpenFileName (SSDATA (file)); if (gif == NULL) { image_error ("Cannot open `%s'", file, Qnil); -- cgit v1.2.1 From 6ae141d682670b1d21abd86fd530cca016f73985 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Mar 2011 00:20:11 -0800 Subject: * image.c: (clear_image_cache, xbm_read_bitmap_data, x_detect_edges): (jpeg_load, gif_load): Rename locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/image.c | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7170fcc162a..c99d3626e05 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,6 +6,8 @@ (x_edge_detection): Remove unnecessary cast that gcc -Wbad-function-cast diagnoses. (gif_load): Fix pointer signedness. + (clear_image_cache, xbm_read_bitmap_data, x_detect_edges): + (jpeg_load, gif_load): Rename locals to avoid shadowing. 2011-03-11 Paul Eggert diff --git a/src/image.c b/src/image.c index 383e154b265..1f2a4609536 100644 --- a/src/image.c +++ b/src/image.c @@ -1557,9 +1557,9 @@ clear_image_cache (struct frame *f, Lisp_Object filter) FOR_EACH_FRAME (tail, frame) { - struct frame *f = XFRAME (frame); - if (FRAME_IMAGE_CACHE (f) == c) - clear_current_matrices (f); + struct frame *fr = XFRAME (frame); + if (FRAME_IMAGE_CACHE (fr) == c) + clear_current_matrices (fr); } ++windows_or_buffers_changed; @@ -2651,11 +2651,11 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e if (LA1 == XBM_TK_NUMBER) { - char *p = strrchr (buffer, '_'); - p = p ? p + 1 : buffer; - if (strcmp (p, "width") == 0) + char *q = strrchr (buffer, '_'); + q = q ? q + 1 : buffer; + if (strcmp (q, "width") == 0) *width = value; - else if (strcmp (p, "height") == 0) + else if (strcmp (q, "height") == 0) *height = value; } expect (XBM_TK_NUMBER); @@ -4604,14 +4604,14 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus for (x = 1; x < img->width - 1; ++x, ++p) { - int r, g, b, y1, x1; + int r, g, b, yy, xx; r = g = b = i = 0; - for (y1 = y - 1; y1 < y + 2; ++y1) - for (x1 = x - 1; x1 < x + 2; ++x1, ++i) + for (yy = y - 1; yy < y + 2; ++yy) + for (xx = x - 1; xx < x + 2; ++xx, ++i) if (matrix[i]) { - XColor *t = COLOR (colors, x1, y1); + XColor *t = COLOR (colors, xx, yy); r += matrix[i] * t->red; g += matrix[i] * t->green; b += matrix[i] * t->blue; @@ -6364,10 +6364,10 @@ jpeg_load (struct frame *f, struct image *img) if (rc == 1) { /* Called from my_error_exit. Display a JPEG error. */ - char buffer[JMSG_LENGTH_MAX]; - cinfo.err->format_message ((j_common_ptr) &cinfo, buffer); + char buf[JMSG_LENGTH_MAX]; + cinfo.err->format_message ((j_common_ptr) &cinfo, buf); image_error ("Error reading JPEG image `%s': %s", img->spec, - build_string (buffer)); + build_string (buf)); } /* Close the input file and destroy the JPEG object. */ @@ -7300,9 +7300,9 @@ gif_load (struct frame *f, struct image *img) for (x = 0; x < image_width; x++) { - int i = raster[(y * image_width) + x]; + int c = raster[(y * image_width) + x]; XPutPixel (ximg, x + img->corners[LEFT_CORNER], - row + img->corners[TOP_CORNER], pixel_colors[i]); + row + img->corners[TOP_CORNER], pixel_colors[c]); } row += interlace_increment[pass]; @@ -7313,9 +7313,9 @@ gif_load (struct frame *f, struct image *img) for (y = 0; y < image_height; ++y) for (x = 0; x < image_width; ++x) { - int i = raster[y * image_width + x]; + int c = raster[y * image_width + x]; XPutPixel (ximg, x + img->corners[LEFT_CORNER], - y + img->corners[TOP_CORNER], pixel_colors[i]); + y + img->corners[TOP_CORNER], pixel_colors[c]); } } -- cgit v1.2.1 From 7ef4b50c04d80cbc2b247f997e9133fbce70be05 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 11 Mar 2011 11:41:56 +0200 Subject: Fix MS-Windows build broken by 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. src/term.c (encode_terminal_code): Now external again, used by w32console.c and msdos.c. src/termhooks.h (encode_terminal_code): Declare prototype. src/msdos.c (encode_terminal_code): Don't declare prototype. src/makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. --- src/ChangeLog | 12 ++++++++++++ src/makefile.w32-in | 2 ++ src/msdos.c | 1 + src/term.c | 2 +- src/termhooks.h | 3 +++ 5 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3a6b09dfb1f..ebbef39c29d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2011-03-11 Eli Zaretskii + + * termhooks.h (encode_terminal_code): Declare prototype. + + * msdos.c (encode_terminal_code): Don't declare prototype. + + * term.c (encode_terminal_code): Now external again, used by + w32console.c and msdos.c. + + * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend + on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. + 2011-03-11 Paul Eggert Fix some minor problems found by GCC 4.5.2's static checks. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 7a702fd45bf..81f758f1b5f 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -1466,6 +1466,7 @@ $(BLD)/term.$(O) : \ $(SRC)/termchar.h \ $(SRC)/termhooks.h \ $(SRC)/termopts.h \ + $(SRC)/tparam.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -1498,6 +1499,7 @@ $(BLD)/textprop.$(O) : \ $(BLD)/tparam.$(O) : \ $(SRC)/tparam.c \ + $(SRC)/tparam.h \ $(CONFIG_H) \ $(LISP_H) diff --git a/src/msdos.c b/src/msdos.c index 261a09ac859..5d50749cb7e 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -844,6 +844,7 @@ IT_set_face (int face) extern unsigned char *encode_terminal_code (struct glyph *, int, struct coding_system *); + static void IT_write_glyphs (struct frame *f, struct glyph *str, int str_len) { diff --git a/src/term.c b/src/term.c index e78e2e68814..e84bbe125f8 100644 --- a/src/term.c +++ b/src/term.c @@ -501,7 +501,7 @@ static int encode_terminal_dst_size; Set CODING->produced to the byte-length of the resulting byte sequence, and return a pointer to that byte sequence. */ -static unsigned char * +unsigned char * encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) { struct glyph *src_end = src + src_len; diff --git a/src/termhooks.h b/src/termhooks.h index b147f6ed0a1..0ccd2dac9e1 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -654,6 +654,9 @@ extern void delete_terminal (struct terminal *); /* The initial terminal device, created by initial_term_init. */ extern struct terminal *initial_terminal; +extern unsigned char *encode_terminal_code (struct glyph *, int, + struct coding_system *); + #ifdef HAVE_GPM extern void close_gpm (int gpm_fd); #endif -- cgit v1.2.1 From 1e048ad1a60374ff026f021fe836c4f77a3fca60 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Fri, 11 Mar 2011 16:42:12 +0100 Subject: Backport 2011-03-08T01:52:20Z!lekktu@gmail.com from trunk. * src/w32xfns.c (select_palette): Check success of RealizePalette against GDI_ERROR, not zero. --- src/ChangeLog | 6 ++++++ src/w32xfns.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a4a80cbf9f5..75958169951 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-11 Juanma Barranquero + + Backport revno:103582 from trunk. + * w32xfns.c (select_palette): Check success of RealizePalette against + GDI_ERROR, not zero. + 2011-03-11 YAMAMOTO Mitsuharu * fringe.c (update_window_fringes): Remove unused variables. diff --git a/src/w32xfns.c b/src/w32xfns.c index 83ffc1c8b5f..0472138e117 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -98,7 +98,7 @@ select_palette (FRAME_PTR f, HDC hdc) else f->output_data.w32->old_palette = NULL; - if (RealizePalette (hdc)) + if (RealizePalette (hdc) != GDI_ERROR) { Lisp_Object frame, framelist; FOR_EACH_FRAME (framelist, frame) -- cgit v1.2.1 From ef1fd07e4e728fcbf60ce87f1434f5fd46862262 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 11 Mar 2011 09:49:16 -0700 Subject: * buffer.c (syms_of_buffer): Remove obsolete comment. --- src/ChangeLog | 4 ++++ src/buffer.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ebbef39c29d..4b54abe08dd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-11 Tom Tromey + + * buffer.c (syms_of_buffer): Remove obsolete comment. + 2011-03-11 Eli Zaretskii * termhooks.h (encode_terminal_code): Declare prototype. diff --git a/src/buffer.c b/src/buffer.c index c95fbb5f516..448c9236387 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5332,9 +5332,6 @@ syms_of_buffer (void) Fput (Qprotected_field, Qerror_message, make_pure_c_string ("Attempt to modify a protected field")); - /* All these use DEFVAR_LISP_NOPRO because the slots in - buffer_defaults will all be marked via Vbuffer_defaults. */ - DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", mode_line_format, doc: /* Default value of `mode-line-format' for buffers that don't override it. -- cgit v1.2.1 From 8be6f3188dd265704c5d19d09e84a36c5e33d403 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Mar 2011 12:24:09 -0800 Subject: Move 'make_time' to be next to its inverse 'lisp_time_argument'. * dired.c (make_time): Move to ... * editfns.c (make_time): ... here. * systime.h: Note the move. --- src/ChangeLog | 7 +++++++ src/dired.c | 7 ------- src/editfns.c | 13 +++++++++++++ src/systime.h | 5 +---- 4 files changed, 21 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4b54abe08dd..85100149c92 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-03-11 Paul Eggert + + Move 'make_time' to be next to its inverse 'lisp_time_argument'. + * dired.c (make_time): Move to ... + * editfns.c (make_time): ... here. + * systime.h: Note the move. + 2011-03-11 Tom Tromey * buffer.c (syms_of_buffer): Remove obsolete comment. diff --git a/src/dired.c b/src/dired.c index 96063680d4d..d201418d78b 100644 --- a/src/dired.c +++ b/src/dired.c @@ -848,13 +848,6 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad return value; } -Lisp_Object -make_time (time_t time) -{ - return Fcons (make_number (time >> 16), - Fcons (make_number (time & 0177777), Qnil)); -} - static char * stat_uname (struct stat *st) { diff --git a/src/editfns.c b/src/editfns.c index 28690e7c76d..ec477f0e010 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1476,6 +1476,19 @@ on systems that do not provide resolution finer than a second. */) } +/* Make a Lisp list that represents the time T. */ +Lisp_Object +make_time (time_t t) +{ + return Fcons (make_number (t >> 16), + Fcons (make_number (t & 0177777), Qnil)); +} + +/* Decode a Lisp list SPECIFIED_TIME that represents a time. + If SPECIFIED_TIME is nil, use the current time. + Set *RESULT to seconds since the Epoch. + If USEC is not null, set *USEC to the microseconds component. + Return nonzero if successful. */ int lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) { diff --git a/src/systime.h b/src/systime.h index eae302904fa..cb1ea230f7d 100644 --- a/src/systime.h +++ b/src/systime.h @@ -144,10 +144,8 @@ extern void set_waiting_for_input (EMACS_TIME *); happen when this files is used outside the src directory). Use GCPRO1 to determine if lisp.h was included. */ #ifdef GCPRO1 -/* defined in dired.c */ -extern Lisp_Object make_time (time_t); - /* defined in editfns.c*/ +extern Lisp_Object make_time (time_t); extern int lisp_time_argument (Lisp_Object, time_t *, int *); #endif @@ -172,4 +170,3 @@ extern int lisp_time_argument (Lisp_Object, time_t *, int *); #define EMACS_TIME_LE(T1, T2) (EMACS_TIME_CMP (T1, T2) <= 0) #endif /* EMACS_SYSTIME_H */ - -- cgit v1.2.1 From fe31d94c97a6a3702e301a14b84c1f293afe5efd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Mar 2011 12:31:59 -0800 Subject: * editfns.c (time_overflow): New function, refactoring common code. (Fformat_time_string, Fdecode_time, Fencode_time): (Fcurrent_time_string): Use it. --- src/ChangeLog | 4 ++++ src/editfns.c | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 85100149c92..a0c4941ec1c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-11 Paul Eggert + * editfns.c (time_overflow): New function, refactoring common code. + (Fformat_time_string, Fdecode_time, Fencode_time): + (Fcurrent_time_string): Use it. + Move 'make_time' to be next to its inverse 'lisp_time_argument'. * dired.c (make_time): Move to ... * editfns.c (make_time): ... here. diff --git a/src/editfns.c b/src/editfns.c index ec477f0e010..fe8541f718e 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -87,6 +87,7 @@ extern char **environ; extern Lisp_Object w32_get_internal_run_time (void); #endif +static void time_overflow (void) NO_RETURN; static int tm_diff (struct tm *, struct tm *); static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, EMACS_INT *, Lisp_Object, EMACS_INT *); @@ -1476,6 +1477,13 @@ on systems that do not provide resolution finer than a second. */) } +/* Report a time value that is out of range for Emacs. */ +static void +time_overflow (void) +{ + error ("Specified time is not representable"); +} + /* Make a Lisp list that represents the time T. */ Lisp_Object make_time (time_t t) @@ -1687,7 +1695,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) tm = ut ? gmtime (&value) : localtime (&value); UNBLOCK_INPUT; if (! tm) - error ("Specified time is not representable"); + time_overflow (); synchronize_system_time_locale (); @@ -1746,7 +1754,7 @@ DOW and ZONE.) */) decoded_time = localtime (&time_spec); UNBLOCK_INPUT; if (! decoded_time) - error ("Specified time is not representable"); + time_overflow (); XSETFASTINT (list_args[0], decoded_time->tm_sec); XSETFASTINT (list_args[1], decoded_time->tm_min); XSETFASTINT (list_args[2], decoded_time->tm_hour); @@ -1859,7 +1867,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) } if (time == (time_t) -1) - error ("Specified time is not representable"); + time_overflow (); return make_time (time); } @@ -1894,7 +1902,7 @@ but this is considered obsolete. */) tm = localtime (&value); UNBLOCK_INPUT; if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm)))) - error ("Specified time is not representable"); + time_overflow (); /* Remove the trailing newline. */ tem[strlen (tem) - 1] = '\0'; -- cgit v1.2.1 From b8d9bd41b7daaa35de8335b20af145a808ae9b07 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Mar 2011 22:49:53 -0800 Subject: Improve quality of tests for time stamp overflow. For example, without this patch (encode-time 0 0 0 1 1 1152921504606846976) returns the obviously-bogus value (-948597 62170) on my RHEL 5.5 x86-64 host. With it, it reports time overflow. * deps.mk (editfns.o): Depend on ../lib/intprops.h. * editfns.c: Include limits.h and intprops.h. (TIME_T_MIN, TIME_T_MAX): New macros. (time_overflow): Move earlier, to before first use. (hi_time, lo_time): New functions, for an accurate test for out-of-range times. (Fcurrent_time, Fget_internal_run_time, make_time): Use them. (Fget_internal_run_time): Don't assume time_t fits in int. (make_time): Use list2 instead of Fcons twice. (Fdecode_time): More accurate test for out-of-range times. (check_tm_member): New function. (Fencode_time): Use it, to test for out-of-range times. --- src/ChangeLog | 19 ++++++++++++ src/deps.mk | 3 +- src/editfns.c | 99 ++++++++++++++++++++++++++++++++++++++++++----------------- 3 files changed, 92 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a0c4941ec1c..b3362b9fbca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2011-03-12 Paul Eggert + + Improve quality of tests for time stamp overflow. For example, + without this patch (encode-time 0 0 0 1 1 1152921504606846976) + returns the obviously-bogus value (-948597 62170) on my RHEL 5.5 + x86-64 host. With it, it reports time overflow. + * deps.mk (editfns.o): Depend on ../lib/intprops.h. + * editfns.c: Include limits.h and intprops.h. + (TIME_T_MIN, TIME_T_MAX): New macros. + (time_overflow): Move earlier, to before first use. + (hi_time, lo_time): New functions, for an accurate test for + out-of-range times. + (Fcurrent_time, Fget_internal_run_time, make_time): Use them. + (Fget_internal_run_time): Don't assume time_t fits in int. + (make_time): Use list2 instead of Fcons twice. + (Fdecode_time): More accurate test for out-of-range times. + (check_tm_member): New function. + (Fencode_time): Use it, to test for out-of-range times. + 2011-03-11 Paul Eggert * editfns.c (time_overflow): New function, refactoring common code. diff --git a/src/deps.mk b/src/deps.mk index 2b162b07bb8..fba856c1be3 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -87,7 +87,8 @@ dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ lisp.h $(config_h) editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ - coding.h frame.h blockinput.h atimer.h ../lib/unistd.h ../lib/strftime.h \ + coding.h frame.h blockinput.h atimer.h \ + ../lib/intprops.h ../lib/strftime.h ../lib/unistd.h \ lisp.h globals.h $(config_h) emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \ diff --git a/src/editfns.c b/src/editfns.c index fe8541f718e..4e8ac316a8a 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -45,6 +45,8 @@ along with GNU Emacs. If not, see . */ #endif #include +#include +#include #include #include "intervals.h" @@ -1415,6 +1417,44 @@ DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, return make_number (getpid ()); } + + +#ifndef TIME_T_MIN +# define TIME_T_MIN TYPE_MINIMUM (time_t) +#endif +#ifndef TIME_T_MAX +# define TIME_T_MAX TYPE_MAXIMUM (time_t) +#endif + +/* Report that a time value is out of range for Emacs. */ +static void +time_overflow (void) +{ + error ("Specified time is not representable"); +} + +/* Return the upper part of the time T (everything but the bottom 16 bits), + making sure that it is representable. */ +static EMACS_INT +hi_time (time_t t) +{ + time_t hi = t >> 16; + if (((TYPE_SIGNED (time_t) + && TIME_T_MIN >> 16 < MOST_NEGATIVE_FIXNUM + && hi < MOST_NEGATIVE_FIXNUM) + || (MOST_POSITIVE_FIXNUM < TIME_T_MAX >> 16 + && MOST_POSITIVE_FIXNUM < hi))) + time_overflow (); + return hi; +} + +/* Return the bottom 16 bits of the time T. */ +static EMACS_INT +lo_time (time_t t) +{ + return t & ((1 << 16) - 1); +} + DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0, doc: /* Return the current time, as the number of seconds since 1970-01-01 00:00:00. The time is returned as a list of three integers. The first has the @@ -1429,8 +1469,8 @@ resolution finer than a second. */) EMACS_TIME t; EMACS_GET_TIME (t); - return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), - make_number ((EMACS_SECS (t) >> 0) & 0xffff), + return list3 (make_number (hi_time (EMACS_SECS (t))), + make_number (lo_time (EMACS_SECS (t))), make_number (EMACS_USECS (t))); } @@ -1449,7 +1489,8 @@ on systems that do not provide resolution finer than a second. */) { #ifdef HAVE_GETRUSAGE struct rusage usage; - int secs, usecs; + time_t secs; + int usecs; if (getrusage (RUSAGE_SELF, &usage) < 0) /* This shouldn't happen. What action is appropriate? */ @@ -1464,8 +1505,8 @@ on systems that do not provide resolution finer than a second. */) secs++; } - return list3 (make_number ((secs >> 16) & 0xffff), - make_number ((secs >> 0) & 0xffff), + return list3 (make_number (hi_time (secs)), + make_number (lo_time (secs)), make_number (usecs)); #else /* ! HAVE_GETRUSAGE */ #ifdef WINDOWSNT @@ -1477,19 +1518,12 @@ on systems that do not provide resolution finer than a second. */) } -/* Report a time value that is out of range for Emacs. */ -static void -time_overflow (void) -{ - error ("Specified time is not representable"); -} - /* Make a Lisp list that represents the time T. */ Lisp_Object make_time (time_t t) { - return Fcons (make_number (t >> 16), - Fcons (make_number (t & 0177777), Qnil)); + return list2 (make_number (hi_time (t)), + make_number (lo_time (t))); } /* Decode a Lisp list SPECIFIED_TIME that represents a time. @@ -1753,7 +1787,9 @@ DOW and ZONE.) */) BLOCK_INPUT; decoded_time = localtime (&time_spec); UNBLOCK_INPUT; - if (! decoded_time) + if (! (decoded_time + && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= decoded_time->tm_year + && decoded_time->tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) time_overflow (); XSETFASTINT (list_args[0], decoded_time->tm_sec); XSETFASTINT (list_args[1], decoded_time->tm_min); @@ -1778,6 +1814,20 @@ DOW and ZONE.) */) return Flist (9, list_args); } +/* Return OBJ - OFFSET, checking that OBJ is a valid fixnum and that + the result is representable as an int. Assume OFFSET is small and + nonnegative. */ +static int +check_tm_member (Lisp_Object obj, int offset) +{ + EMACS_INT n; + CHECK_NUMBER (obj); + n = XINT (obj); + if (! (INT_MIN + offset <= n && n - offset <= INT_MAX)) + time_overflow (); + return n - offset; +} + DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0, doc: /* Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time. This is the reverse operation of `decode-time', which see. @@ -1806,19 +1856,12 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) struct tm tm; Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); - CHECK_NUMBER (args[0]); /* second */ - CHECK_NUMBER (args[1]); /* minute */ - CHECK_NUMBER (args[2]); /* hour */ - CHECK_NUMBER (args[3]); /* day */ - CHECK_NUMBER (args[4]); /* month */ - CHECK_NUMBER (args[5]); /* year */ - - tm.tm_sec = XINT (args[0]); - tm.tm_min = XINT (args[1]); - tm.tm_hour = XINT (args[2]); - tm.tm_mday = XINT (args[3]); - tm.tm_mon = XINT (args[4]) - 1; - tm.tm_year = XINT (args[5]) - TM_YEAR_BASE; + tm.tm_sec = check_tm_member (args[0], 0); + tm.tm_min = check_tm_member (args[1], 0); + tm.tm_hour = check_tm_member (args[2], 0); + tm.tm_mday = check_tm_member (args[3], 0); + tm.tm_mon = check_tm_member (args[4], 1); + tm.tm_year = check_tm_member (args[5], TM_YEAR_BASE); tm.tm_isdst = -1; if (CONSP (zone)) -- cgit v1.2.1 From 7ac80be95aaa92eacb454d4fa6aa3d2f56058978 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Mar 2011 12:51:31 +0200 Subject: Fix compilation warnings on MS-DOS due to constifying of pointers in xmenu.c. src/msdos.c (XMenuAddPane): 3rd argument is `const char *' now. Adapt all references accordingly. src/msdos.h (XMenuAddPane): 3rd argument is `const char *' now. --- src/ChangeLog | 7 +++++++ src/msdos.c | 6 +++--- src/msdos.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4b54abe08dd..8534c3b455f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-03-12 Eli Zaretskii + + * msdos.c (XMenuAddPane): 3rd argument is `const char *' now. + Adapt all references accordingly. + + * msdos.h (XMenuAddPane): 3rd argument is `const char *' now. + 2011-03-11 Tom Tromey * buffer.c (syms_of_buffer): Remove obsolete comment. diff --git a/src/msdos.c b/src/msdos.c index 5d50749cb7e..b0bf5c4fdd9 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2999,17 +2999,17 @@ XMenuCreate (Display *foo1, Window foo2, char *foo3) to do. */ int -XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable) +XMenuAddPane (Display *foo, XMenu *menu, const char *txt, int enable) { int len; - char *p; + const char *p; if (!enable) abort (); IT_menu_make_room (menu); menu->submenu[menu->count] = IT_menu_create (); - menu->text[menu->count] = txt; + menu->text[menu->count] = (char *)txt; menu->panenumber[menu->count] = ++menu->panecount; menu->help_text[menu->count] = NULL; menu->count++; diff --git a/src/msdos.h b/src/msdos.h index 4bbe9b134de..5051f2f3837 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -105,7 +105,7 @@ typedef struct x_menu_struct } XMenu; XMenu *XMenuCreate (Display *, Window, char *); -int XMenuAddPane (Display *, XMenu *, char *, int); +int XMenuAddPane (Display *, XMenu *, const char *, int); int XMenuAddSelection (Display *, XMenu *, int, int, char *, int, char *); void XMenuLocate (Display *, XMenu *, int, int, int, int, int *, int *, int *, int *); -- cgit v1.2.1 From 058e5dad0e18c6c67cf8ad7681f98f0768b60f31 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Mar 2011 14:03:24 +0200 Subject: Make termcap.c implementations consistent with tparam.h prototypes. src/termcap.c [MSDOS]: Include "msdos.h. (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent): Constify `char *' arguments and their references according to prototypes in tparam.h. src/deps.mk (termcap.o): Depend on tparam.h and msdos.h. --- src/ChangeLog | 7 +++++++ src/deps.mk | 2 +- src/termcap.c | 18 +++++++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8534c3b455f..9e4023e996a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2011-03-12 Eli Zaretskii + * termcap.c [MSDOS]: Include "msdos.h. + (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent): + Constify `char *' arguments and their references according to + prototypes in tparam.h. + + * deps.mk (termcap.o): Depend on tparam.h. + * msdos.c (XMenuAddPane): 3rd argument is `const char *' now. Adapt all references accordingly. diff --git a/src/deps.mk b/src/deps.mk index 2b162b07bb8..d3a21cfe628 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -191,7 +191,7 @@ term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h -termcap.o: termcap.c lisp.h $(config_h) +termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h) terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ msdos.h diff --git a/src/termcap.c b/src/termcap.c index 69ce56d93b3..27a20a67ae1 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -25,6 +25,10 @@ Boston, MA 02110-1301, USA. */ #include #include "lisp.h" +#include "tparam.h" +#ifdef MSDOS +#include "msdos.h" +#endif #ifndef NULL #define NULL (char *) 0 @@ -65,7 +69,7 @@ static char *tgetst1 (char *ptr, char **area); 0 if not found. */ static char * -find_capability (register char *bp, register char *cap) +find_capability (register char *bp, register const char *cap) { for (; *bp; bp++) if (bp[0] == ':' @@ -76,7 +80,7 @@ find_capability (register char *bp, register char *cap) } int -tgetnum (char *cap) +tgetnum (const char *cap) { register char *ptr = find_capability (term_entry, cap); if (!ptr || ptr[-1] != '#') @@ -85,7 +89,7 @@ tgetnum (char *cap) } int -tgetflag (char *cap) +tgetflag (const char *cap) { register char *ptr = find_capability (term_entry, cap); return ptr && ptr[-1] == ':'; @@ -97,7 +101,7 @@ tgetflag (char *cap) If AREA is null, space is allocated with `malloc'. */ char * -tgetstr (char *cap, char **area) +tgetstr (const char *cap, char **area) { register char *ptr = find_capability (term_entry, cap); if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) @@ -263,7 +267,7 @@ tgetst1 (char *ptr, char **area) char PC; void -tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) +tputs (register const char *str, int nlines, int (*outfun) (int)) { register int padcount = 0; register int speed; @@ -355,7 +359,7 @@ valid_filename_p (fn) in it, and some other value otherwise. */ int -tgetent (char *bp, char *name) +tgetent (char *bp, const char *name) { register char *termcap_name; register int fd; @@ -442,7 +446,7 @@ tgetent (char *bp, char *name) buf.size = BUFSIZE; /* Add 1 to size to ensure room for terminating null. */ buf.beg = (char *) xmalloc (buf.size + 1); - term = indirect ? indirect : name; + term = indirect ? indirect : (char *)name; if (!bp) { -- cgit v1.2.1 From ecb0f94d1879163e49de80fe46dd2bee94615331 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Mar 2011 14:05:05 +0200 Subject: src/ChangeLog: Fix last entry for deps.mk. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9e4023e996a..5976265ef85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,7 +5,7 @@ Constify `char *' arguments and their references according to prototypes in tparam.h. - * deps.mk (termcap.o): Depend on tparam.h. + * deps.mk (termcap.o): Depend on tparam.h and msdos.h. * msdos.c (XMenuAddPane): 3rd argument is `const char *' now. Adapt all references accordingly. -- cgit v1.2.1 From 803110b53623077719e4a9d301e416f31007c946 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 12 Mar 2011 14:52:25 -0800 Subject: * editfns.c (hi_time): Do not overparenthesize. --- src/editfns.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/editfns.c b/src/editfns.c index 4e8ac316a8a..e55502bdb89 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1439,11 +1439,11 @@ static EMACS_INT hi_time (time_t t) { time_t hi = t >> 16; - if (((TYPE_SIGNED (time_t) - && TIME_T_MIN >> 16 < MOST_NEGATIVE_FIXNUM - && hi < MOST_NEGATIVE_FIXNUM) - || (MOST_POSITIVE_FIXNUM < TIME_T_MAX >> 16 - && MOST_POSITIVE_FIXNUM < hi))) + if ((TYPE_SIGNED (time_t) + && TIME_T_MIN >> 16 < MOST_NEGATIVE_FIXNUM + && hi < MOST_NEGATIVE_FIXNUM) + || (MOST_POSITIVE_FIXNUM < TIME_T_MAX >> 16 + && MOST_POSITIVE_FIXNUM < hi)) time_overflow (); return hi; } -- cgit v1.2.1 From 313c1e544ab88d0ca95015b30e23dfbabe36a2ac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 12 Mar 2011 22:27:18 -0800 Subject: * editfns.c (lisp_time_argument): Check for time stamp overflow. --- src/ChangeLog | 4 ++++ src/editfns.c | 33 ++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b3362b9fbca..546b02d2a96 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-13 Paul Eggert + + * editfns.c (lisp_time_argument): Check for time stamp overflow. + 2011-03-12 Paul Eggert Improve quality of tests for time stamp overflow. For example, diff --git a/src/editfns.c b/src/editfns.c index e55502bdb89..d92d3482d09 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1439,12 +1439,17 @@ static EMACS_INT hi_time (time_t t) { time_t hi = t >> 16; - if ((TYPE_SIGNED (time_t) - && TIME_T_MIN >> 16 < MOST_NEGATIVE_FIXNUM - && hi < MOST_NEGATIVE_FIXNUM) - || (MOST_POSITIVE_FIXNUM < TIME_T_MAX >> 16 - && MOST_POSITIVE_FIXNUM < hi)) + + /* Check for overflow, helping the compiler for common cases where + no runtime check is needed, and taking care not to convert + negative numbers to unsigned before comparing them. */ + if (! ((! TYPE_SIGNED (time_t) + || MOST_NEGATIVE_FIXNUM <= TIME_T_MIN >> 16 + || MOST_NEGATIVE_FIXNUM <= hi) + && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM + || hi <= MOST_POSITIVE_FIXNUM))) time_overflow (); + return hi; } @@ -1551,6 +1556,7 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) else { Lisp_Object high, low; + EMACS_INT hi; high = Fcar (specified_time); CHECK_NUMBER (high); low = Fcdr (specified_time); @@ -1574,8 +1580,21 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) else if (usec) *usec = 0; CHECK_NUMBER (low); - *result = (XINT (high) << 16) + (XINT (low) & 0xffff); - return *result >> 16 == XINT (high); + hi = XINT (high); + + /* Check for overflow, helping the compiler for common cases + where no runtime check is needed, and taking care not to + convert negative numbers to unsigned before comparing them. */ + if (! ((TYPE_SIGNED (time_t) + ? (TIME_T_MIN >> 16 <= MOST_NEGATIVE_FIXNUM + || TIME_T_MIN >> 16 <= hi) + : 0 <= hi) + && (MOST_POSITIVE_FIXNUM <= TIME_T_MAX >> 16 + || hi <= TIME_T_MAX >> 16))) + return 0; + + *result = (hi << 16) + (XINT (low) & 0xffff); + return 1; } } -- cgit v1.2.1 From f0c77cd1b28a5ee9de06eef06c768fe34d7f0140 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 12 Mar 2011 23:50:17 -0800 Subject: * image.c (four_corners_best): Mark locals as initialized. (gif_load): Initialize transparent_p to zero (Bug#8238). Mark another local as initialized. --- src/ChangeLog | 6 ++++++ src/image.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c99d3626e05..2a2ef75a316 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-13 Paul Eggert + + * image.c (four_corners_best): Mark locals as initialized. + (gif_load): Initialize transparent_p to zero (Bug#8238). + Mark another local as initialized. + 2011-03-11 Paul Eggert * image.c (clear_image_cache): Now static. diff --git a/src/image.c b/src/image.c index 1f2a4609536..a4be1d1b898 100644 --- a/src/image.c +++ b/src/image.c @@ -1137,7 +1137,7 @@ static RGB_PIXEL_COLOR four_corners_best (XImagePtr_or_DC ximg, int *corners, unsigned long width, unsigned long height) { - RGB_PIXEL_COLOR corner_pixels[4], best; + RGB_PIXEL_COLOR corner_pixels[4], best IF_LINT (= 0); int i, best_count; if (corners && corners[BOT_CORNER] >= 0) @@ -7103,7 +7103,7 @@ gif_load (struct frame *f, struct image *img) Lisp_Object file, specified_file; Lisp_Object specified_data; int rc, width, height, x, y, i; - boolean transparent_p; + boolean transparent_p = 0; XImagePtr ximg; ColorMapObject *gif_color_map; unsigned long pixel_colors[256]; @@ -7112,7 +7112,7 @@ gif_load (struct frame *f, struct image *img) int ino, image_height, image_width; gif_memory_source memsrc; unsigned char *raster; - unsigned int transparency_color_index; + unsigned int transparency_color_index IF_LINT (= 0); specified_file = image_spec_value (img->spec, QCfile, NULL); specified_data = image_spec_value (img->spec, QCdata, NULL); -- cgit v1.2.1 From ec6cf4c6ff2e43e3f42a2efe2759bc0c18b680cb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 00:04:44 -0800 Subject: * image.c (my_png_error, my_error_exit): Mark with NO_RETURN. --- src/ChangeLog | 1 + src/image.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2a2ef75a316..45ee0125eeb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * image.c (four_corners_best): Mark locals as initialized. (gif_load): Initialize transparent_p to zero (Bug#8238). Mark another local as initialized. + (my_png_error, my_error_exit): Mark with NO_RETURN. 2011-03-11 Paul Eggert diff --git a/src/image.c b/src/image.c index a4be1d1b898..7584f9bb2c0 100644 --- a/src/image.c +++ b/src/image.c @@ -5530,6 +5530,7 @@ init_png_functions (Lisp_Object libraries) /* Error and warning handlers installed when the PNG library is initialized. */ +static void my_png_error (png_struct *, const char *) NO_RETURN; static void my_png_error (png_struct *png_ptr, const char *msg) { @@ -6104,6 +6105,7 @@ struct my_jpeg_error_mgr }; +static void my_error_exit (j_common_ptr) NO_RETURN; static void my_error_exit (j_common_ptr cinfo) { -- cgit v1.2.1 From 41729b81ac6a60b482aafe7ddc48a43225874818 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 00:05:40 -0800 Subject: * xgselect.c (xg_select): Remove unused var. --- src/ChangeLog | 2 ++ src/xgselect.c | 17 ++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 45ee0125eeb..5c9efee320f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-13 Paul Eggert + * xgselect.c (xg_select): Remove unused var. + * image.c (four_corners_best): Mark locals as initialized. (gif_load): Initialize transparent_p to zero (Bug#8238). Mark another local as initialized. diff --git a/src/xgselect.c b/src/xgselect.c index 359a8fbc89b..96d763ff088 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -38,7 +38,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, GMainContext *context = g_main_context_default (); int have_wfds = wfds != NULL; int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0; - int prio, i, nfds, tmo_in_millisec; + int i, nfds, tmo_in_millisec; if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds)); else FD_ZERO (&all_rfds); @@ -49,9 +49,9 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, g_main_context_pending (context); do { - if (n_gfds > gfds_size) + if (n_gfds > gfds_size) { - while (n_gfds > gfds_size) + while (n_gfds > gfds_size) gfds_size *= 2; xfree (gfds); gfds = xmalloc (sizeof (*gfds) * gfds_size); @@ -64,7 +64,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, gfds_size); } while (n_gfds > gfds_size); - for (i = 0; i < n_gfds; ++i) + for (i = 0; i < n_gfds; ++i) { if (gfds[i].events & G_IO_IN) { @@ -87,7 +87,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, else { EMACS_TIME difference; - + EMACS_SUB_TIME (difference, tmo, *timeout); if (EMACS_TIME_NEG_P (difference)) our_tmo = 1; } @@ -100,7 +100,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, if (nfds < 0) retval = nfds; - else if (nfds > 0) + else if (nfds > 0) { for (i = 0; i < max_fds+1; ++i) { @@ -127,7 +127,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, if (our_fds > 0 || (nfds == 0 && our_tmo)) { - + /* If Gtk+ is in use eventually gtk_main_iteration will be called, unless retval is zero. */ #ifdef USE_GTK @@ -137,7 +137,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, g_main_context_dispatch (context); /* To not have to recalculate timeout, return like this. */ - if (retval == 0) + if (retval == 0) { retval = -1; errno = EINTR; @@ -156,4 +156,3 @@ xgselect_initialize (void) gfds = xmalloc (sizeof (*gfds)*gfds_size); #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ } - -- cgit v1.2.1 From 7c86ee9804efc475aa261c8eab8ca9b629657e29 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 00:14:30 -0800 Subject: * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char * to unsigned char * to avoid compiler diagnostic. --- src/ChangeLog | 3 +++ src/gtkutil.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5c9efee320f..2d88ba25092 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-13 Paul Eggert + * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char * + to unsigned char * to avoid compiler diagnostic. + * xgselect.c (xg_select): Remove unused var. * image.c (four_corners_best): Mark locals as initialized. diff --git a/src/gtkutil.c b/src/gtkutil.c index b1ea6336eb6..8ab41fdefd1 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -76,7 +76,7 @@ along with GNU Emacs. If not, see . */ #ifndef HAVE_GTK3 #define gdk_window_get_screen(w) gdk_drawable_get_screen (w) #define gdk_window_get_geometry(w, a, b, c, d) \ - gdk_window_get_geometry (w, a, b, c, d, 0) + gdk_window_get_geometry (w, a, b, c, d, 0) #define gdk_x11_window_lookup_for_display(d, w) \ gdk_xid_table_lookup_for_display (d, w) #define GDK_KEY_g GDK_g @@ -258,7 +258,7 @@ xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix) ~0, XYPixmap); if (!xim) return 0; - tmp_buf = gdk_pixbuf_new_from_data (xim->data, + tmp_buf = gdk_pixbuf_new_from_data ((guchar *) xim->data, GDK_COLORSPACE_RGB, FALSE, xim->bitmap_unit, @@ -287,7 +287,7 @@ xg_get_pixbuf_from_pix_and_mask (FRAME_PTR f, width = gdk_pixbuf_get_width (icon_buf); height = gdk_pixbuf_get_height (icon_buf); - + if (mask) { GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask); @@ -393,7 +393,7 @@ xg_get_image_for_pixmap (FRAME_PTR f, Gtk+ assumes the pixmap is always there. */ icon_buf = xg_get_pixbuf_from_pix_and_mask (f, img->pixmap, img->mask); - if (icon_buf) + if (icon_buf) { if (! old_widget) old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); -- cgit v1.2.1 From b0afc268e8513939e5fc0551f33aec6884e7a4e6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 00:15:55 -0800 Subject: * gtkutil.c (xg_free_frame_widgets): Make it clear that a local variable is needed only if USE_GTK_TOOLTIP. --- src/ChangeLog | 2 ++ src/gtkutil.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2d88ba25092..269285d32b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char * to unsigned char * to avoid compiler diagnostic. + (xg_free_frame_widgets): Make it clear that a local variable is + needed only if USE_GTK_TOOLTIP. * xgselect.c (xg_select): Remove unused var. diff --git a/src/gtkutil.c b/src/gtkutil.c index 8ab41fdefd1..04b8a64c995 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1188,7 +1188,9 @@ xg_free_frame_widgets (FRAME_PTR f) { if (FRAME_GTK_OUTER_WIDGET (f)) { +#ifdef USE_GTK_TOOLTIP struct x_output *x = f->output_data.x; +#endif gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f)); FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ FRAME_GTK_OUTER_WIDGET (f) = 0; -- cgit v1.2.1 From 1e5524e7cfe4ec2ad1841c28495dce4ecc5f487e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 00:31:16 -0800 Subject: * gtkutil.c (int_gtk_range_get_value): New function, which avoids a diagnostic from gcc -Wbad-function-cast. (xg_set_toolkit_scroll_bar_thumb): Use it. (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid diagnostic from gcc -Wbad-function-cast. --- src/ChangeLog | 5 +++++ src/gtkutil.c | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 269285d32b0..454b6fba129 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,11 @@ to unsigned char * to avoid compiler diagnostic. (xg_free_frame_widgets): Make it clear that a local variable is needed only if USE_GTK_TOOLTIP. + (int_gtk_range_get_value): New function, which avoids a diagnostic + from gcc -Wbad-function-cast. + (xg_set_toolkit_scroll_bar_thumb): Use it. + (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid + diagnostic from gcc -Wbad-function-cast. * xgselect.c (xg_select): Remove unused var. diff --git a/src/gtkutil.c b/src/gtkutil.c index 04b8a64c995..b66a9a9c555 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -84,6 +84,13 @@ along with GNU Emacs. If not, see . */ #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) +/* Get the current value of the range, truncated to an integer. */ +static int +int_gtk_range_get_value (GtkRange *range) +{ + return gtk_range_get_value (range); +} + /*********************************************************************** Display handling functions @@ -3562,7 +3569,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, changed = 1; } - if (changed || (int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) + if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) { BLOCK_INPUT; @@ -3570,7 +3577,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, ignore_gtk_scrollbar to make the callback do nothing */ xg_ignore_gtk_scrollbar = 1; - if ((int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) + if (int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); else if (changed) gtk_adjustment_changed (adj); @@ -3666,8 +3673,8 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) { /* The EMACS_INT cast avoids a warning. */ int idx = (int) (EMACS_INT) client_data; - int mod = (int) (EMACS_INT) g_object_get_data (G_OBJECT (w), - XG_TOOL_BAR_LAST_MODIFIER); + gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER); + int mod = (int) (EMACS_INT) gmod; FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); Lisp_Object key, frame; @@ -4218,9 +4225,9 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, } else { - Pixmap old_img - = (Pixmap) g_object_get_data (G_OBJECT (wimage), - XG_TOOL_BAR_IMAGE_DATA); + gpointer gold_img = g_object_get_data (G_OBJECT (wimage), + XG_TOOL_BAR_IMAGE_DATA); + Pixmap old_img = (Pixmap) gold_img; if (old_img != img->pixmap) return 1; } -- cgit v1.2.1 From 65dc836c9eb47c01affa6c8819f177c9f68aca67 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 00:39:13 -0800 Subject: * gtkutil.c: (get_utf8_string, xg_get_file_with_chooser): Rename locals to avoid shadowing. (create_dialog): Move locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/gtkutil.c | 46 ++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 454b6fba129..45f9918c864 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,9 @@ (xg_set_toolkit_scroll_bar_thumb): Use it. (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid diagnostic from gcc -Wbad-function-cast. + (get_utf8_string, xg_get_file_with_chooser): + Rename locals to avoid shadowing. + (create_dialog): Move locals to avoid shadowing. * xgselect.c (xg_select): Remove unused var. diff --git a/src/gtkutil.c b/src/gtkutil.c index b66a9a9c555..2eb088b9ee3 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -492,22 +492,22 @@ get_utf8_string (const char *str) gsize bytes_written; unsigned char *p = (unsigned char *)str; char *cp, *up; - GError *error = NULL; + GError *err = NULL; while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read, - &bytes_written, &error)) - && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) + &bytes_written, &err)) + && err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) { ++nr_bad; p += bytes_written+1; - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } - if (error) + if (err) { - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } if (cp) g_free (cp); @@ -515,16 +515,16 @@ get_utf8_string (const char *str) p = (unsigned char *)str; while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read, - &bytes_written, &error)) - && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) + &bytes_written, &err)) + && err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) { strncpy (up, (char *)p, bytes_written); sprintf (up + bytes_written, "\\%03o", p[bytes_written]); up[bytes_written+4] = '\0'; up += bytes_written+4; p += bytes_written+1; - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } if (cp) @@ -532,10 +532,10 @@ get_utf8_string (const char *str) strcat (utf8_str, cp); g_free (cp); } - if (error) + if (err) { - g_error_free (error); - error = NULL; + g_error_free (err); + err = NULL; } } return utf8_str; @@ -1415,8 +1415,6 @@ create_dialog (widget_value *wv, GtkDialog *wd = GTK_DIALOG (wdialog); GtkBox *cur_box = GTK_BOX (gtk_dialog_get_action_area (wd)); widget_value *item; - GtkWidget *wvbox; - GtkWidget *whbox_up; GtkWidget *whbox_down; /* If the number of buttons is greater than 4, make two rows of buttons @@ -1432,8 +1430,8 @@ create_dialog (widget_value *wv, if (make_two_rows) { - wvbox = gtk_vbox_new (TRUE, button_spacing); - whbox_up = gtk_hbox_new (FALSE, 0); + GtkWidget *wvbox = gtk_vbox_new (TRUE, button_spacing); + GtkWidget *whbox_up = gtk_hbox_new (FALSE, 0); whbox_down = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (cur_box, wvbox, FALSE, FALSE, 0); @@ -1702,7 +1700,7 @@ xg_get_file_with_chooser (FRAME_PTR f, int mustmatch_p, int only_dir_p, xg_get_file_func *func) { - char message[1024]; + char msgbuf[1024]; GtkWidget *filewin, *wtoggle, *wbox, *wmessage; GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)); @@ -1738,16 +1736,16 @@ xg_get_file_with_chooser (FRAME_PTR f, if (x_gtk_file_dialog_help_text) { - message[0] = '\0'; + msgbuf[0] = '\0'; /* Gtk+ 2.10 has the file name text entry box integrated in the dialog. Show the C-l help text only for versions < 2.10. */ if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE) - strcat (message, "\nType C-l to display a file name text entry box.\n"); - strcat (message, "\nIf you don't like this file selector, use the " + strcat (msgbuf, "\nType C-l to display a file name text entry box.\n"); + strcat (msgbuf, "\nIf you don't like this file selector, use the " "corresponding\nkey binding or customize " "use-file-dialog to turn it off."); - wmessage = gtk_label_new (message); + wmessage = gtk_label_new (msgbuf); gtk_widget_show (wmessage); } -- cgit v1.2.1 From 01e0b5adf4e35c2b00705c212b853936fe218cac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 00:42:12 -0800 Subject: * gtkutil.c (gdk_window_get_screen): Make it clear that this macro is needed only if USE_GTK_TOOLTIP. --- src/ChangeLog | 2 ++ src/gtkutil.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 45f9918c864..0097626c463 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,8 @@ to unsigned char * to avoid compiler diagnostic. (xg_free_frame_widgets): Make it clear that a local variable is needed only if USE_GTK_TOOLTIP. + (gdk_window_get_screen): Make it clear that this macro is needed + only if USE_GTK_TOOLTIP. (int_gtk_range_get_value): New function, which avoids a diagnostic from gcc -Wbad-function-cast. (xg_set_toolkit_scroll_bar_thumb): Use it. diff --git a/src/gtkutil.c b/src/gtkutil.c index 2eb088b9ee3..754f61e366d 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -74,7 +74,9 @@ along with GNU Emacs. If not, see . */ #endif #ifndef HAVE_GTK3 +#ifdef USE_GTK_TOOLTIP #define gdk_window_get_screen(w) gdk_drawable_get_screen (w) +#endif #define gdk_window_get_geometry(w, a, b, c, d) \ gdk_window_get_geometry (w, a, b, c, d, 0) #define gdk_x11_window_lookup_for_display(d, w) \ -- cgit v1.2.1 From d251f04bea68e68d2598f0aa7464ecc26b26103e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 13 Mar 2011 19:49:38 +0200 Subject: MS-Windows followup for 2011-03-13T06:43:00Z!eggert@cs.ucla.edu. src/makefile.w32-in ($(BLD)/editfns.$(O)): Depend on $(EMACS_ROOT)/lib/intprops.h. --- src/ChangeLog | 5 +++++ src/makefile.w32-in | 1 + 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e840bb3c036..3d5f3e0c387 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-13 Eli Zaretskii + + * makefile.w32-in ($(BLD)/editfns.$(O)): Depend on + $(EMACS_ROOT)/lib/intprops.h. + 2011-03-13 Paul Eggert Fix more problems found by GCC 4.5.2's static checks. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 81f758f1b5f..9916a884292 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -727,6 +727,7 @@ $(BLD)/editfns.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(EMACS_ROOT)/lib/strftime.h \ + $(EMACS_ROOT)/lib/intprops.h \ $(LISP_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ -- cgit v1.2.1 From cffc6f3bd9b5dbb9825502928bd9dd58ddbac02e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 13 Mar 2011 18:25:16 -0400 Subject: Fix BUF_* macros to handle indirect buffers properly (Bug#8219). * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). These macros can no longer be used for assignment. * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign struct members directly, instead of using BUF_BEGV etc. (record_buffer_markers, fetch_buffer_markers): New functions for recording and fetching special buffer markers. (set_buffer_internal_1, set_buffer_temp): Use them. * lread.c (unreadchar): Use SET_BUF_PT_BOTH. * insdel.c (adjust_point): Use SET_BUF_PT_BOTH. * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH. (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH. * xdisp.c (hscroll_window_tree): (reconsider_clip_changes): Use PT instead of BUF_PT. --- src/ChangeLog | 22 +++++++ src/buffer.c | 187 +++++++++++++++++++++++++------------------------------- src/buffer.h | 45 +++++++++----- src/insdel.c | 4 +- src/intervals.c | 16 ++--- src/lread.c | 4 +- src/xdisp.c | 4 +- 7 files changed, 146 insertions(+), 136 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3d5f3e0c387..bad9b8dd4b7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2011-03-13 Chong Yidong + + * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) + (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). + These macros can no longer be used for assignment. + + * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign + struct members directly, instead of using BUF_BEGV etc. + (record_buffer_markers, fetch_buffer_markers): New functions for + recording and fetching special buffer markers. + (set_buffer_internal_1, set_buffer_temp): Use them. + + * lread.c (unreadchar): Use SET_BUF_PT_BOTH. + + * insdel.c (adjust_point): Use SET_BUF_PT_BOTH. + + * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH. + (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH. + + * xdisp.c (hscroll_window_tree): + (reconsider_clip_changes): Use PT instead of BUF_PT. + 2011-03-13 Eli Zaretskii * makefile.w32-in ($(BLD)/editfns.$(O)): Depend on diff --git a/src/buffer.c b/src/buffer.c index 448c9236387..01940728275 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -330,15 +330,17 @@ even if it is dead. The return value is never nil. */) if (! BUF_BEG_ADDR (b)) buffer_memory_full (); - BUF_PT (b) = BEG; + b->pt = BEG; + b->begv = BEG; + b->zv = BEG; + b->pt_byte = BEG_BYTE; + b->begv_byte = BEG_BYTE; + b->zv_byte = BEG_BYTE; + BUF_GPT (b) = BEG; - BUF_BEGV (b) = BEG; - BUF_ZV (b) = BEG; - BUF_Z (b) = BEG; - BUF_PT_BYTE (b) = BEG_BYTE; BUF_GPT_BYTE (b) = BEG_BYTE; - BUF_BEGV_BYTE (b) = BEG_BYTE; - BUF_ZV_BYTE (b) = BEG_BYTE; + + BUF_Z (b) = BEG; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; BUF_CHARS_MODIFF (b) = 1; @@ -489,6 +491,53 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) BVAR (to, local_var_alist) = buffer_lisp_local_variables (from); } + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, update these markers. */ + +static void +record_buffer_markers (struct buffer *b) +{ + if (! NILP (BVAR (b, pt_marker))) + { + Lisp_Object buffer; + + eassert (!NILP (BVAR (b, begv_marker))); + eassert (!NILP (BVAR (b, zv_marker))); + + XSETBUFFER (buffer, b); + set_marker_both (BVAR (b, pt_marker), buffer, b->pt, b->pt_byte); + set_marker_both (BVAR (b, begv_marker), buffer, b->begv, b->begv_byte); + set_marker_both (BVAR (b, zv_marker), buffer, b->zv, b->zv_byte); + } +} + + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, fetch these values into B->begv etc. */ + +static void +fetch_buffer_markers (struct buffer *b) +{ + if (! NILP (BVAR (b, pt_marker))) + { + Lisp_Object m; + + eassert (!NILP (BVAR (b, begv_marker))); + eassert (!NILP (BVAR (b, zv_marker))); + + m = BVAR (b, pt_marker); + SET_BUF_PT_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = BVAR (b, begv_marker); + SET_BUF_BEGV_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = BVAR (b, zv_marker); + SET_BUF_ZV_BOTH (b, marker_position (m), marker_byte_position (m)); + } +} + + DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 2, 3, "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", @@ -527,12 +576,12 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Use the base buffer's text object. */ b->text = b->base_buffer->text; - BUF_BEGV (b) = BUF_BEGV (b->base_buffer); - BUF_ZV (b) = BUF_ZV (b->base_buffer); - BUF_PT (b) = BUF_PT (b->base_buffer); - BUF_BEGV_BYTE (b) = BUF_BEGV_BYTE (b->base_buffer); - BUF_ZV_BYTE (b) = BUF_ZV_BYTE (b->base_buffer); - BUF_PT_BYTE (b) = BUF_PT_BYTE (b->base_buffer); + b->pt = b->base_buffer->pt; + b->begv = b->base_buffer->begv; + b->zv = b->base_buffer->zv; + b->pt_byte = b->base_buffer->pt_byte; + b->begv_byte = b->base_buffer->begv_byte; + b->zv_byte = b->base_buffer->zv_byte; b->newline_cache = 0; b->width_run_cache = 0; @@ -562,24 +611,23 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Make sure the base buffer has markers for its narrowing. */ if (NILP (BVAR (b->base_buffer, pt_marker))) { + eassert (NILP (BVAR (b, begv_marker))); + eassert (NILP (BVAR (b, zv_marker))); + BVAR (b->base_buffer, pt_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, - BUF_PT (b->base_buffer), - BUF_PT_BYTE (b->base_buffer)); - } - if (NILP (BVAR (b->base_buffer, begv_marker))) - { + b->base_buffer->pt, + b->base_buffer->pt_byte); + BVAR (b->base_buffer, begv_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, - BUF_BEGV (b->base_buffer), - BUF_BEGV_BYTE (b->base_buffer)); - } - if (NILP (BVAR (b->base_buffer, zv_marker))) - { + b->base_buffer->begv, + b->base_buffer->begv_byte); + BVAR (b->base_buffer, zv_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, - BUF_ZV (b->base_buffer), - BUF_ZV_BYTE (b->base_buffer)); + b->base_buffer->zv, + b->base_buffer->zv_byte); XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } @@ -587,11 +635,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */) { /* Give the indirect buffer markers for its narrowing. */ BVAR (b, pt_marker) = Fmake_marker (); - set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); + set_marker_both (BVAR (b, pt_marker), buf, b->pt, b->pt_byte); BVAR (b, begv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + set_marker_both (BVAR (b, begv_marker), buf, b->begv, b->begv_byte); BVAR (b, zv_marker) = Fmake_marker (); - set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + set_marker_both (BVAR (b, zv_marker), buf, b->zv, b->zv_byte); XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else @@ -1796,27 +1844,7 @@ set_buffer_internal_1 (register struct buffer *b) /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (BVAR (old_buf, pt_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, pt_marker), obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, begv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, begv_marker), obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, zv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, zv_marker), obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } + record_buffer_markers (old_buf); } /* Get the undo list from the base buffer, so that it appears @@ -1826,21 +1854,7 @@ set_buffer_internal_1 (register struct buffer *b) /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (BVAR (b, pt_marker))) - { - BUF_PT (b) = marker_position (BVAR (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); - } - if (! NILP (BVAR (b, begv_marker))) - { - BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); - } - if (! NILP (BVAR (b, zv_marker))) - { - BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); - } + fetch_buffer_markers (b); /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ @@ -1876,50 +1890,13 @@ set_buffer_temp (struct buffer *b) old_buf = current_buffer; current_buffer = b; - if (old_buf) - { - /* If the old current buffer has markers to record PT, BEGV and ZV - when it is not current, update them now. */ - if (! NILP (BVAR (old_buf, pt_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, pt_marker), obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, begv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, begv_marker), obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (BVAR (old_buf, zv_marker))) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (BVAR (old_buf, zv_marker), obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } - } + /* If the old current buffer has markers to record PT, BEGV and ZV + when it is not current, update them now. */ + record_buffer_markers (old_buf); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (BVAR (b, pt_marker))) - { - BUF_PT (b) = marker_position (BVAR (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); - } - if (! NILP (BVAR (b, begv_marker))) - { - BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); - } - if (! NILP (BVAR (b, zv_marker))) - { - BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); - } + fetch_buffer_markers (b); } DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, diff --git a/src/buffer.h b/src/buffer.h index 65c7168d60a..0975d2e3adc 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -107,27 +107,46 @@ along with GNU Emacs. If not, see . */ #define BUF_BEG(buf) (BEG) #define BUF_BEG_BYTE(buf) (BEG_BYTE) -/* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: - on indirect (or base) buffers, that value is only correct if that buffer - is the current_buffer, or if the buffer's text hasn't been modified (via - an indirect buffer) since it was last current. */ +/* The BUF_BEGV[_BYTE], BUF_ZV[_BYTE], and BUF_PT[_BYTE] macros cannot + be used for assignment; use SET_BUF_* macros below for that. */ /* Position of beginning of accessible range of buffer. */ -#define BUF_BEGV(buf) ((buf)->begv) -#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) +#define BUF_BEGV(buf) \ + (buf == current_buffer ? BEGV \ + : NILP (BVAR (buf, begv_marker)) ? buf->begv \ + : marker_position (BVAR (buf, begv_marker))) + +#define BUF_BEGV_BYTE(buf) \ + (buf == current_buffer ? BEGV_BYTE \ + : NILP (BVAR (buf, begv_marker)) ? buf->begv_byte \ + : marker_byte_position (BVAR (buf, begv_marker))) /* Position of point in buffer. */ -#define BUF_PT(buf) ((buf)->pt) -#define BUF_PT_BYTE(buf) ((buf)->pt_byte) +#define BUF_PT(buf) \ + (buf == current_buffer ? PT \ + : NILP (BVAR (buf, pt_marker)) ? buf->pt \ + : marker_position (BVAR (buf, pt_marker))) + +#define BUF_PT_BYTE(buf) \ + (buf == current_buffer ? PT_BYTE \ + : NILP (BVAR (buf, pt_marker)) ? buf->pt_byte \ + : marker_byte_position (BVAR (buf, pt_marker))) + +/* Position of end of accessible range of buffer. */ +#define BUF_ZV(buf) \ + (buf == current_buffer ? ZV \ + : NILP (BVAR (buf, zv_marker)) ? buf->zv \ + : marker_position (BVAR (buf, zv_marker))) + +#define BUF_ZV_BYTE(buf) \ + (buf == current_buffer ? ZV_BYTE \ + : NILP (BVAR (buf, zv_marker)) ? buf->zv_byte \ + : marker_byte_position (BVAR (buf, zv_marker))) /* Position of gap in buffer. */ #define BUF_GPT(buf) ((buf)->text->gpt) #define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) -/* Position of end of accessible range of buffer. */ -#define BUF_ZV(buf) ((buf)->zv) -#define BUF_ZV_BYTE(buf) ((buf)->zv_byte) - /* Position of end of buffer. */ #define BUF_Z(buf) ((buf)->text->z) #define BUF_Z_BYTE(buf) ((buf)->text->z_byte) @@ -235,8 +254,6 @@ extern void enlarge_buffer_text (struct buffer *, EMACS_INT); /* Macros for setting the BEGV, ZV or PT of a given buffer. - SET_BUF_PT* seet to be redundant. Get rid of them? - The ..._BOTH macros take both a charpos and a bytepos, which must correspond to each other. diff --git a/src/insdel.c b/src/insdel.c index 7fcf9522a33..bdf6aff1717 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -411,9 +411,7 @@ adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes) { - BUF_PT (current_buffer) += nchars; - BUF_PT_BYTE (current_buffer) += nbytes; - + SET_BUF_PT_BOTH (current_buffer, PT + nchars, PT_BYTE + nbytes); /* In a single-byte buffer, the two positions must be equal. */ eassert (PT_BYTE >= PT && PT_BYTE - PT <= ZV_BYTE - ZV); } diff --git a/src/intervals.c b/src/intervals.c index 6aee6e9d7fa..12b2789cc77 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -1892,8 +1892,7 @@ temp_set_point_both (struct buffer *buffer, if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer)) abort (); - BUF_PT_BYTE (buffer) = bytepos; - BUF_PT (buffer) = charpos; + SET_BUF_PT_BOTH (buffer, charpos, bytepos); } /* Set point "temporarily", without checking any text properties. */ @@ -2312,10 +2311,9 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer, old_zv = BUF_ZV (buffer); old_begv_byte = BUF_BEGV_BYTE (buffer); old_zv_byte = BUF_ZV_BYTE (buffer); - BUF_BEGV (buffer) = BUF_BEG (buffer); - BUF_ZV (buffer) = BUF_Z (buffer); - BUF_BEGV_BYTE (buffer) = BUF_BEG_BYTE (buffer); - BUF_ZV_BYTE (buffer) = BUF_Z_BYTE (buffer); + + SET_BUF_BEGV_BOTH (buffer, BUF_BEG (buffer), BUF_BEG_BYTE (buffer)); + SET_BUF_ZV_BOTH (buffer, BUF_Z (buffer), BUF_Z_BYTE (buffer)); XSETFASTINT (lispy_position, position); XSETBUFFER (lispy_buffer, buffer); @@ -2329,10 +2327,8 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer, if (NILP (prop)) prop = get_pos_property (lispy_position, type, lispy_buffer); - BUF_BEGV (buffer) = old_begv; - BUF_ZV (buffer) = old_zv; - BUF_BEGV_BYTE (buffer) = old_begv_byte; - BUF_ZV_BYTE (buffer) = old_zv_byte; + SET_BUF_BEGV_BOTH (buffer, old_begv, old_begv_byte); + SET_BUF_ZV_BOTH (buffer, old_zv, old_zv_byte); /* Use the local map only if it is valid. */ prop = get_keymap (prop, 0, 0); diff --git a/src/lread.c b/src/lread.c index 8a5f6ecd691..3c5b627f98c 100644 --- a/src/lread.c +++ b/src/lread.c @@ -368,15 +368,15 @@ unreadchar (Lisp_Object readcharfun, int c) else if (BUFFERP (readcharfun)) { struct buffer *b = XBUFFER (readcharfun); + EMACS_INT charpos = BUF_PT (b); EMACS_INT bytepos = BUF_PT_BYTE (b); - BUF_PT (b)--; if (! NILP (BVAR (b, enable_multibyte_characters))) BUF_DEC_POS (b, bytepos); else bytepos--; - BUF_PT_BYTE (b) = bytepos; + SET_BUF_PT_BOTH (b, charpos - 1, bytepos); } else if (MARKERP (readcharfun)) { diff --git a/src/xdisp.c b/src/xdisp.c index f2477a2eca5..a7955f41e0c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10909,7 +10909,7 @@ hscroll_window_tree (Lisp_Object window) current_buffer = XBUFFER (w->buffer); if (w == XWINDOW (selected_window)) - pt = BUF_PT (current_buffer); + pt = PT; else { pt = marker_position (w->pointm); @@ -11347,7 +11347,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b) EMACS_INT pt; if (w == XWINDOW (selected_window)) - pt = BUF_PT (current_buffer); + pt = PT; else pt = marker_position (w->pointm); -- cgit v1.2.1 From 59d6fe8344313c6e31a06b7ebd666e9f7be27ff2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 20:21:32 -0700 Subject: * dbusbind.c: Pointer signedness fixes. (xd_signature, xd_append_arg, xd_initialize): (Fdbus_call_method, Fdbus_call_method_asynchronously): (Fdbus_method_return_internal, Fdbus_method_error_internal): (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service): (Fdbus_register_signal): Use SSDATA when the context wants char *. --- src/ChangeLog | 9 +++++++++ src/dbusbind.c | 45 ++++++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bad9b8dd4b7..b062bfdf06d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2011-03-14 Paul Eggert + + * dbusbind.c: Pointer signedness fixes. + (xd_signature, xd_append_arg, xd_initialize): + (Fdbus_call_method, Fdbus_call_method_asynchronously): + (Fdbus_method_return_internal, Fdbus_method_error_internal): + (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service): + (Fdbus_register_signal): Use SSDATA when the context wants char *. + 2011-03-13 Chong Yidong * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) diff --git a/src/dbusbind.c b/src/dbusbind.c index 7e5104026cd..bf19605a346 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -325,7 +325,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis if ((subtype == DBUS_TYPE_SIGNATURE) && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) - strcpy (x, SDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); + strcpy (x, SSDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); while (!NILP (elt)) { @@ -531,7 +531,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) but by not encoding it, we guarantee it's valid utf-8, even if it contains eight-bit-bytes. Of course, you can still send manually-crafted junk by passing a unibyte string. */ - char *val = SDATA (object); + char *val = SSDATA (object); XD_DEBUG_MESSAGE ("%c %s", dtype, val); if (!dbus_message_iter_append_basic (iter, dtype, &val)) XD_SIGNAL2 (build_string ("Unable to append argument"), object); @@ -569,7 +569,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) { - strcpy (signature, SDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); + strcpy (signature, SSDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); object = CDR_SAFE (XD_NEXT_VALUE (object)); } @@ -789,7 +789,7 @@ xd_initialize (Lisp_Object bus, int raise_error) dbus_error_init (&derror); if (STRINGP (bus)) - connection = dbus_connection_open (SDATA (bus), &derror); + connection = dbus_connection_open (SSDATA (bus), &derror); else if (EQ (bus, QCdbus_system_bus)) connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); @@ -1089,10 +1089,10 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI connection = xd_initialize (bus, TRUE); /* Create the message. */ - dmessage = dbus_message_new_method_call (SDATA (service), - SDATA (path), - SDATA (interface), - SDATA (method)); + dmessage = dbus_message_new_method_call (SSDATA (service), + SSDATA (path), + SSDATA (interface), + SSDATA (method)); UNGCPRO; if (dmessage == NULL) XD_SIGNAL1 (build_string ("Unable to create a new message")); @@ -1272,10 +1272,10 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE connection = xd_initialize (bus, TRUE); /* Create the message. */ - dmessage = dbus_message_new_method_call (SDATA (service), - SDATA (path), - SDATA (interface), - SDATA (method)); + dmessage = dbus_message_new_method_call (SSDATA (service), + SSDATA (path), + SSDATA (interface), + SSDATA (method)); if (dmessage == NULL) XD_SIGNAL1 (build_string ("Unable to create a new message")); @@ -1386,7 +1386,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); if ((dmessage == NULL) || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) - || (!dbus_message_set_destination (dmessage, SDATA (service)))) + || (!dbus_message_set_destination (dmessage, SSDATA (service)))) { UNGCPRO; XD_SIGNAL1 (build_string ("Unable to create a return message")); @@ -1475,7 +1475,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) if ((dmessage == NULL) || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)) || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) - || (!dbus_message_set_destination (dmessage, SDATA (service)))) + || (!dbus_message_set_destination (dmessage, SSDATA (service)))) { UNGCPRO; XD_SIGNAL1 (build_string ("Unable to create a error message")); @@ -1591,9 +1591,9 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) connection = xd_initialize (bus, TRUE); /* Create the message. */ - dmessage = dbus_message_new_signal (SDATA (path), - SDATA (interface), - SDATA (signal)); + dmessage = dbus_message_new_signal (SSDATA (path), + SSDATA (interface), + SSDATA (signal)); UNGCPRO; if (dmessage == NULL) XD_SIGNAL1 (build_string ("Unable to create a new message")); @@ -1745,11 +1745,11 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus) /* key has the structure (UNAME SERVICE PATH HANDLER). */ if (((uname == NULL) || (NILP (CAR_SAFE (key))) - || (strcmp (uname, SDATA (CAR_SAFE (key))) == 0)) + || (strcmp (uname, SSDATA (CAR_SAFE (key))) == 0)) && ((path == NULL) || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) || (strcmp (path, - SDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) + SSDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) == 0)) && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key))))))) { @@ -1921,7 +1921,7 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) /* Request the known name from the bus. */ dbus_error_init (&derror); - result = dbus_bus_request_name (connection, SDATA (service), flags, + result = dbus_bus_request_name (connection, SSDATA (service), flags, &derror); if (dbus_error_is_set (&derror)) XD_ERROR (derror); @@ -2019,8 +2019,8 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG name of "org.freedesktop.DBus" is that string itself. */ if ((STRINGP (service)) && (SBYTES (service) > 0) - && (strcmp (SDATA (service), DBUS_SERVICE_DBUS) != 0) - && (strncmp (SDATA (service), ":", 1) != 0)) + && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0) + && (strncmp (SSDATA (service), ":", 1) != 0)) { uname = call2 (intern ("dbus-get-name-owner"), bus, service); /* When there is no unique name, we mark it with an empty @@ -2350,4 +2350,3 @@ be called when the D-Bus reply message arrives. */); } #endif /* HAVE_DBUS */ - -- cgit v1.2.1 From 78320123c17531bc27b47fb56d170029ca734fec Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 20:23:23 -0700 Subject: * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning if GCC considers string literals to be constants. --- src/ChangeLog | 3 +++ src/dbusbind.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b062bfdf06d..8a053f05c9d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,9 @@ (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service): (Fdbus_register_signal): Use SSDATA when the context wants char *. + * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning + if GCC considers string literals to be constants. + 2011-03-13 Chong Yidong * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) diff --git a/src/dbusbind.c b/src/dbusbind.c index bf19605a346..7bb4e551da5 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -936,7 +936,7 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); /* We do not want to abort. */ - putenv ("DBUS_FATAL_WARNINGS=0"); + putenv ((char *) "DBUS_FATAL_WARNINGS=0"); /* Return. */ return Qnil; -- cgit v1.2.1 From 49cebccaa79dea62a1acaae65e525551fa5fe2c8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 20:25:51 -0700 Subject: * dbusbind.c (Fdbus_register_service, Fdbus_register_method): Remove unused vars. --- src/ChangeLog | 1 + src/dbusbind.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8a053f05c9d..030cde063a2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,7 @@ * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning if GCC considers string literals to be constants. + (Fdbus_register_service, Fdbus_register_method): Remove unused vars. 2011-03-13 Chong Yidong diff --git a/src/dbusbind.c b/src/dbusbind.c index 7bb4e551da5..2c8de20a4d4 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -1888,7 +1888,6 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) (int nargs, register Lisp_Object *args) { Lisp_Object bus, service; - struct gcpro gcpro1, gcpro2; DBusConnection *connection; unsigned int i; unsigned int value; @@ -2122,7 +2121,6 @@ discovering the still incomplete interface.*/) Lisp_Object dont_register_service) { Lisp_Object key, key1, value; - DBusError derror; Lisp_Object args[2] = { bus, service }; /* Check parameters. */ -- cgit v1.2.1 From 022e70d41f75a0c790abd8519df0101ee896ab5a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 20:31:16 -0700 Subject: * lisp.h (fatal_error_signal): Add decl, since it's exported. --- src/ChangeLog | 2 ++ src/lisp.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 030cde063a2..da1b852f459 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-14 Paul Eggert + * lisp.h (fatal_error_signal): Add decl, since it's exported. + * dbusbind.c: Pointer signedness fixes. (xd_signature, xd_append_arg, xd_initialize): (Fdbus_call_method, Fdbus_call_method_asynchronously): diff --git a/src/lisp.h b/src/lisp.h index 113585320af..54bab53b1c3 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3193,6 +3193,7 @@ extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; extern Lisp_Object Qfile_name_handler_alist; extern void (*fatal_error_signal_hook) (void); +extern SIGTYPE fatal_error_signal (int); EXFUN (Fkill_emacs, 1) NO_RETURN; #if HAVE_SETLOCALE void fixup_locale (void); -- cgit v1.2.1 From 603935076c44ddba546c2f8f0e70d9a664f9aac2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 20:35:14 -0700 Subject: Rewrite to avoid "/*" in comment. --- src/emacs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/emacs.c b/src/emacs.c index 4455e6b4d9f..8b5daf8c7c6 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2380,7 +2380,7 @@ Special values: Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix, hpux, irix, usg-unix-v) indicates some sort of Unix system. */); Vsystem_type = intern_c_string (SYSTEM_TYPE); - /* Above values are from SYSTEM_TYPE in src/s/*.h. */ + /* The above values are from SYSTEM_TYPE in include files under src/s. */ DEFVAR_LISP ("system-configuration", Vsystem_configuration, doc: /* Value is string indicating configuration Emacs was built for. -- cgit v1.2.1 From 74f10ca71b51e3df88317eab85ad64504f69cc40 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 20:43:36 -0700 Subject: * emacs.c (init_cmdargs): Rename local to avoid shadowing. --- src/ChangeLog | 2 ++ src/emacs.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index da1b852f459..951732a1306 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-14 Paul Eggert + * emacs.c (init_cmdargs): Rename local to avoid shadowing. + * lisp.h (fatal_error_signal): Add decl, since it's exported. * dbusbind.c: Pointer signedness fixes. diff --git a/src/emacs.c b/src/emacs.c index 8b5daf8c7c6..0b508fb5be7 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -382,7 +382,7 @@ static void init_cmdargs (int argc, char **argv, int skip_args) { register int i; - Lisp_Object name, dir, tem; + Lisp_Object name, dir, handler; int count = SPECPDL_INDEX (); Lisp_Object raw_name; @@ -393,8 +393,8 @@ init_cmdargs (int argc, char **argv, int skip_args) /* Add /: to the front of the name if it would otherwise be treated as magic. */ - tem = Ffind_file_name_handler (raw_name, Qt); - if (! NILP (tem)) + handler = Ffind_file_name_handler (raw_name, Qt); + if (! NILP (handler)) raw_name = concat2 (build_string ("/:"), raw_name); Vinvocation_name = Ffile_name_nondirectory (raw_name); @@ -411,8 +411,8 @@ init_cmdargs (int argc, char **argv, int skip_args) { /* Add /: to the front of the name if it would otherwise be treated as magic. */ - tem = Ffind_file_name_handler (found, Qt); - if (! NILP (tem)) + handler = Ffind_file_name_handler (found, Qt); + if (! NILP (handler)) found = concat2 (build_string ("/:"), found); Vinvocation_directory = Ffile_name_directory (found); } -- cgit v1.2.1 From 244fc23d16bd60d159ee359a2f9eadff8b9fe8d3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 20:49:40 -0700 Subject: * emacs.c (DEFINE_DUMMY_FUNCTION): New macro. (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main): Use it. --- src/ChangeLog | 3 +++ src/emacs.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 951732a1306..76da9676289 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,9 @@ 2011-03-14 Paul Eggert * emacs.c (init_cmdargs): Rename local to avoid shadowing. + (DEFINE_DUMMY_FUNCTION): New macro. + (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main): + Use it. * lisp.h (fatal_error_signal): Add decl, since it's exported. diff --git a/src/emacs.c b/src/emacs.c index 0b508fb5be7..54e59a3f3c8 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -547,21 +547,22 @@ static char dump_tz[] = "UtC0"; Provide dummy definitions to avoid error. (We don't have any real constructors or destructors.) */ #ifdef __GNUC__ + +/* Define a dummy function F. Declare F too, to pacify gcc + -Wmissing-prototypes. */ +#define DEFINE_DUMMY_FUNCTION(f) void f (void); void f (void) {} + #ifndef GCC_CTORS_IN_LIBC -void __do_global_ctors (void) -{} -void __do_global_ctors_aux (void) -{} -void __do_global_dtors (void) -{} +DEFINE_DUMMY_FUNCTION (__do_global_ctors) +DEFINE_DUMMY_FUNCTION (__do_global_ctors_aux) +DEFINE_DUMMY_FUNCTION (__do_global_dtors) /* GNU/Linux has a bug in its library; avoid an error. */ #ifndef GNU_LINUX char * __CTOR_LIST__[2] = { (char *) (-1), 0 }; #endif char * __DTOR_LIST__[2] = { (char *) (-1), 0 }; #endif /* GCC_CTORS_IN_LIBC */ -void __main (void) -{} +DEFINE_DUMMY_FUNCTION (__main) #endif /* __GNUC__ */ #endif /* ORDINARY_LINK */ -- cgit v1.2.1 From c03cd23f455776f4fdf68966f6ac01e99f054d1e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 22:36:36 -0700 Subject: * emacs.c (main): Add casts to avoid warnings if GCC considers string literals to be constants. --- src/ChangeLog | 2 ++ src/emacs.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 76da9676289..3acc86015b4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,8 @@ (DEFINE_DUMMY_FUNCTION): New macro. (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main): Use it. + (main): Add casts to avoid warnings + if GCC considers string literals to be constants. * lisp.h (fatal_error_signal): Add decl, since it's exported. diff --git a/src/emacs.c b/src/emacs.c index 54e59a3f3c8..c49e38f7a67 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -949,7 +949,7 @@ main (int argc, char **argv) /* Convert --script to -scriptload, un-skip it, and sort again so that it will be handled in proper sequence. */ /* FIXME broken for --script=FILE - is that supposed to work? */ - argv[skip_args - 1] = "-scriptload"; + argv[skip_args - 1] = (char *) "-scriptload"; skip_args -= 2; sort_args (argc, argv); } @@ -1348,7 +1348,7 @@ main (int argc, char **argv) for (j = 0; j < count_before + 1; j++) new[j] = argv[j]; - new[count_before + 1] = "-d"; + new[count_before + 1] = (char *) "-d"; new[count_before + 2] = displayname; for (j = count_before + 2; j count_before && argv[count_before + 1][1] == '-') - argv[count_before + 1] = "-d"; + argv[count_before + 1] = (char *) "-d"; if (! no_site_lisp) { -- cgit v1.2.1 From 4752793e2266f5a6b25732fc38c502687f07a7eb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 22:48:15 -0700 Subject: * lisp.h (force_auto_save_soon): New decl. --- src/ChangeLog | 2 ++ src/lisp.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3acc86015b4..39af059f197 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-14 Paul Eggert + * lisp.h (force_auto_save_soon): New decl. + * emacs.c (init_cmdargs): Rename local to avoid shadowing. (DEFINE_DUMMY_FUNCTION): New macro. (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main): diff --git a/src/lisp.h b/src/lisp.h index 54bab53b1c3..541302cb56b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3141,6 +3141,7 @@ extern void cmd_error_internal (Lisp_Object, const char *); extern Lisp_Object command_loop_1 (void); extern Lisp_Object recursive_edit_1 (void); extern void record_auto_save (void); +extern void force_auto_save_soon (void); extern void init_keyboard (void); extern void syms_of_keyboard (void); extern void keys_of_keyboard (void); -- cgit v1.2.1 From a053e86cc52840a18124d78a63c720769e111ba3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 22:49:51 -0700 Subject: * keyboard.h (make_ctrl_char): New decl. --- src/ChangeLog | 2 ++ src/keyboard.h | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 39af059f197..749f1baf590 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-14 Paul Eggert + * keyboard.h (make_ctrl_char): New decl. + * lisp.h (force_auto_save_soon): New decl. * emacs.c (init_cmdargs): Rename local to avoid shadowing. diff --git a/src/keyboard.h b/src/keyboard.h index 10bf16d5c5c..9f8f1ff7476 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -90,7 +90,7 @@ struct kboard /* User-supplied table to translate input characters through. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); - + /* Last command that may be repeated by `repeat'. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); @@ -140,12 +140,12 @@ struct kboard /* Keymap mapping keys to alternative preferred forms. See the DEFVAR for more documentation. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); - + /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. See the DEFVAR for more documentation. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); - + /* Minibufferless frames on this display use this frame's minibuffer. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); @@ -494,6 +494,7 @@ extern int input_polling_used (void); extern void clear_input_pending (void); extern int requeued_events_pending_p (void); extern void bind_polling_period (int); +extern int make_ctrl_char (int); extern void stuff_buffered_input (Lisp_Object); extern void clear_waiting_for_input (void); extern void swallow_events (int); @@ -517,4 +518,3 @@ extern void add_user_signal (int, const char *); extern int tty_read_avail_input (struct terminal *, int, struct input_event *); extern EMACS_TIME timer_check (int); - -- cgit v1.2.1 From 2f2650daaab043eb8f7fb16fd10575552a7cd378 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 22:51:17 -0700 Subject: * keyboard.c: Declare functions static if they are not used elsewhere. (echo_char, echo_dash, cmd_error, top_level_2): (poll_for_input, handle_async_input): Now static. --- src/ChangeLog | 4 ++++ src/keyboard.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 749f1baf590..a90b5f6e247 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-14 Paul Eggert + * keyboard.c: Declare functions static if they are not used elsewhere. + (echo_char, echo_dash, cmd_error, top_level_2): + (poll_for_input, handle_async_input): Now static. + * keyboard.h (make_ctrl_char): New decl. * lisp.h (force_auto_save_soon): New decl. diff --git a/src/keyboard.c b/src/keyboard.c index e9c6d508fa2..c1a61ac0a29 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -451,7 +451,7 @@ static int store_user_signal_events (void); C can be a character, which is printed prettily ("M-C-x" and all that jazz), or a symbol, whose name is printed. */ -void +static void echo_char (Lisp_Object c) { if (current_kboard->immediate_echo) @@ -538,7 +538,7 @@ echo_char (Lisp_Object c) /* Temporarily add a dash to the end of the echo string if it's not empty, so that it serves as a mini-prompt for the very next character. */ -void +static void echo_dash (void) { /* Do nothing if not echoing at all. */ @@ -967,7 +967,7 @@ restore_kboard_configuration (Lisp_Object was_locked) /* Handle errors that are not handled at inner levels by printing an error message and returning to the editor command loop. */ -Lisp_Object +static Lisp_Object cmd_error (Lisp_Object data) { Lisp_Object old_level, old_length; @@ -1132,7 +1132,7 @@ command_loop_2 (Lisp_Object ignore) return Qnil; } -Lisp_Object +static Lisp_Object top_level_2 (void) { return Feval (Vtop_level); @@ -1885,7 +1885,7 @@ poll_for_input_1 (void) /* Timer callback function for poll_timer. TIMER is equal to poll_timer. */ -void +static void poll_for_input (struct atimer *timer) { if (poll_suppress_count == 0) @@ -7056,7 +7056,7 @@ tty_read_avail_input (struct terminal *terminal, return nread; } -void +static void handle_async_input (void) { interrupt_input_pending = 0; -- cgit v1.2.1 From da2f2dd9c2fac1bb1e3d5e5c4a3b38cad3c20ad5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Mar 2011 22:55:38 -0700 Subject: * keyboard.h (mark_kboards): Move decl here ... * alloc.c (mark_kboards): ... from here. --- src/ChangeLog | 2 ++ src/alloc.c | 1 - src/keyboard.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a90b5f6e247..9cddd389b58 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,8 @@ (poll_for_input, handle_async_input): Now static. * keyboard.h (make_ctrl_char): New decl. + (mark_kboards): Move decl here ... + * alloc.c (mark_kboards): ... from here. * lisp.h (force_auto_save_soon): New decl. diff --git a/src/alloc.c b/src/alloc.c index 6c92f36ca7d..d6b64de5af9 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -270,7 +270,6 @@ Lisp_Object Qpost_gc_hook; static void mark_buffer (Lisp_Object); static void mark_terminals (void); -extern void mark_kboards (void); extern void mark_backtrace (void); static void gc_sweep (void); static void mark_glyph_matrix (struct glyph_matrix *); diff --git a/src/keyboard.h b/src/keyboard.h index 9f8f1ff7476..765979b3997 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -518,3 +518,4 @@ extern void add_user_signal (int, const char *); extern int tty_read_avail_input (struct terminal *, int, struct input_event *); extern EMACS_TIME timer_check (int); +extern void mark_kboards (void); -- cgit v1.2.1 From 69a058fab1a6396629f783e70b36bd3a7825c54e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:15:30 -0700 Subject: * keyboard.c: (read_char, kbd_buffer_get_event, make_lispy_position): (make_lispy_event, make_lispy_movement, apply_modifiers): (decode_keyboard_code, tty_read_avail_input, menu_bar_items): (parse_tool_bar_item, read_key_sequence, Fread_key_sequence): (Fread_key_sequence_vector): Rename locals to avoid shadowing. --- src/ChangeLog | 5 ++ src/keyboard.c | 213 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 112 insertions(+), 106 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9cddd389b58..896f3ea4be0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,11 @@ * keyboard.c: Declare functions static if they are not used elsewhere. (echo_char, echo_dash, cmd_error, top_level_2): (poll_for_input, handle_async_input): Now static. + (read_char, kbd_buffer_get_event, make_lispy_position): + (make_lispy_event, make_lispy_movement, apply_modifiers): + (decode_keyboard_code, tty_read_avail_input, menu_bar_items): + (parse_tool_bar_item, read_key_sequence, Fread_key_sequence): + (Fread_key_sequence_vector): Rename locals to avoid shadowing. * keyboard.h (make_ctrl_char): New decl. (mark_kboards): Move decl here ... diff --git a/src/keyboard.c b/src/keyboard.c index c1a61ac0a29..a3083be2aee 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2184,7 +2184,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event int *used_mouse_menu, struct timeval *end_time) { volatile Lisp_Object c; - int count, jmpcount; + int jmpcount; jmp_buf local_getcjmp; jmp_buf save_jump; volatile int key_already_recorded = 0; @@ -2461,21 +2461,21 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); if (kb != current_kboard) { - Lisp_Object link = KVAR (kb, kbd_queue); + Lisp_Object last = KVAR (kb, kbd_queue); /* We shouldn't get here if we were in single-kboard mode! */ if (single_kboard) abort (); - if (CONSP (link)) + if (CONSP (last)) { - while (CONSP (XCDR (link))) - link = XCDR (link); - if (!NILP (XCDR (link))) + while (CONSP (XCDR (last))) + last = XCDR (last); + if (!NILP (XCDR (last))) abort (); } - if (!CONSP (link)) + if (!CONSP (last)) KVAR (kb, kbd_queue) = Fcons (c, Qnil); else - XSETCDR (link, Fcons (c, Qnil)); + XSETCDR (last, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; current_kboard = kb; /* This is going to exit from read_char @@ -2712,18 +2712,18 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (! NILP (c) && (kb != current_kboard)) { - Lisp_Object link = KVAR (kb, kbd_queue); - if (CONSP (link)) + Lisp_Object last = KVAR (kb, kbd_queue); + if (CONSP (last)) { - while (CONSP (XCDR (link))) - link = XCDR (link); - if (!NILP (XCDR (link))) + while (CONSP (XCDR (last))) + last = XCDR (last); + if (!NILP (XCDR (last))) abort (); } - if (!CONSP (link)) + if (!CONSP (last)) KVAR (kb, kbd_queue) = Fcons (c, Qnil); else - XSETCDR (link, Fcons (c, Qnil)); + XSETCDR (last, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; c = Qnil; if (single_kboard) @@ -2912,7 +2912,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event { Lisp_Object keys; int key_count, key_count_reset; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; int count = SPECPDL_INDEX (); /* Save the echo status. */ @@ -2940,7 +2940,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event keys = Fcopy_sequence (this_command_keys); else keys = Qnil; - GCPRO1 (keys); + GCPRO1_VAR (keys, inner_gcpro1); /* Clear out this_command_keys. */ this_command_key_count = 0; @@ -2978,7 +2978,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (saved_immediate_echo) echo_now (); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro1); /* The input method can return no events. */ if (! CONSP (tem)) @@ -3000,16 +3000,16 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) { /* (help-echo FRAME HELP WINDOW OBJECT POS). */ - Lisp_Object help, object, position, window, tem; + Lisp_Object help, object, position, window, htem; - tem = Fcdr (XCDR (c)); - help = Fcar (tem); - tem = Fcdr (tem); - window = Fcar (tem); - tem = Fcdr (tem); - object = Fcar (tem); - tem = Fcdr (tem); - position = Fcar (tem); + htem = Fcdr (XCDR (c)); + help = Fcar (htem); + htem = Fcdr (htem); + window = Fcar (htem); + htem = Fcdr (htem); + object = Fcar (htem); + htem = Fcdr (htem); + position = Fcar (htem); show_help_echo (help, window, object, position, 0); @@ -3051,7 +3051,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (!NILP (Vhelp_form) && help_char_p (c)) { Lisp_Object tem0; - count = SPECPDL_INDEX (); + int count = SPECPDL_INDEX (); help_form_saved_window_configs = Fcons (Fcurrent_window_configuration (Qnil), @@ -4024,7 +4024,7 @@ kbd_buffer_get_event (KBOARD **kbp, Lisp_Object bar_window; enum scroll_bar_part part; Lisp_Object x, y; - unsigned long time; + unsigned long t; *kbp = current_kboard; /* Note that this uses F to determine which terminal to look at. @@ -4035,7 +4035,7 @@ kbd_buffer_get_event (KBOARD **kbp, /* XXX Can f or mouse_position_hook be NULL here? */ if (f && FRAME_TERMINAL (f)->mouse_position_hook) (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window, - &part, &x, &y, &time); + &part, &x, &y, &t); obj = Qnil; @@ -4059,7 +4059,7 @@ kbd_buffer_get_event (KBOARD **kbp, /* If we didn't decide to make a switch-frame event, go ahead and return a mouse-motion event. */ if (!NILP (x) && NILP (obj)) - obj = make_lispy_movement (f, bar_window, part, x, y, time); + obj = make_lispy_movement (f, bar_window, part, x, y, t); } #endif /* HAVE_MOUSE || HAVE GPM */ else @@ -5037,7 +5037,7 @@ int double_click_count; static Lisp_Object make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, - unsigned long time) + unsigned long t) { enum window_part part; Lisp_Object posn = Qnil; @@ -5218,7 +5218,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, Fcons (posn, Fcons (Fcons (make_number (xret), make_number (yret)), - Fcons (make_number (time), + Fcons (make_number (t), extra_info)))); } @@ -5642,19 +5642,19 @@ make_lispy_event (struct input_event *event) /* On window-system frames, use the value of double-click-fuzz as is. On other frames, interpret it as a multiple of 1/8 characters. */ - struct frame *f; + struct frame *fr; int fuzz; int symbol_num; int is_double; if (WINDOWP (event->frame_or_window)) - f = XFRAME (XWINDOW (event->frame_or_window)->frame); + fr = XFRAME (XWINDOW (event->frame_or_window)->frame); else if (FRAMEP (event->frame_or_window)) - f = XFRAME (event->frame_or_window); + fr = XFRAME (event->frame_or_window); else abort (); - fuzz = FRAME_WINDOW_P (f) + fuzz = FRAME_WINDOW_P (fr) ? double_click_fuzz : double_click_fuzz / 8; if (event->modifiers & up_modifier) @@ -5927,7 +5927,7 @@ make_lispy_event (struct input_event *event) static Lisp_Object make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, - Lisp_Object x, Lisp_Object y, unsigned long time) + Lisp_Object x, Lisp_Object y, unsigned long t) { /* Is it a scroll bar movement? */ if (frame && ! NILP (bar_window)) @@ -5939,7 +5939,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa Fcons (list5 (bar_window, Qvertical_scroll_bar, Fcons (x, y), - make_number (time), + make_number (t), part_sym), Qnil)); } @@ -5947,7 +5947,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa else { Lisp_Object position; - position = make_lispy_position (frame, x, y, time); + position = make_lispy_position (frame, x, y, t); return list2 (Qmouse_movement, position); } } @@ -6236,7 +6236,7 @@ DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers, static Lisp_Object apply_modifiers (int modifiers, Lisp_Object base) { - Lisp_Object cache, index, entry, new_symbol; + Lisp_Object cache, idx, entry, new_symbol; /* Mask out upper bits. We don't know where this value's been. */ modifiers &= INTMASK; @@ -6246,8 +6246,8 @@ apply_modifiers (int modifiers, Lisp_Object base) /* The click modifier never figures into cache indices. */ cache = Fget (base, Qmodifier_cache); - XSETFASTINT (index, (modifiers & ~click_modifier)); - entry = assq_no_quit (index, cache); + XSETFASTINT (idx, (modifiers & ~click_modifier)); + entry = assq_no_quit (idx, cache); if (CONSP (entry)) new_symbol = XCDR (entry); @@ -6260,14 +6260,14 @@ apply_modifiers (int modifiers, Lisp_Object base) SBYTES (SYMBOL_NAME (base))); /* Add the new symbol to the base's cache. */ - entry = Fcons (index, new_symbol); + entry = Fcons (idx, new_symbol); Fput (base, Qmodifier_cache, Fcons (entry, cache)); /* We have the parsing info now for free, so we could add it to the caches: - XSETFASTINT (index, modifiers); + XSETFASTINT (idx, modifiers); Fput (new_symbol, Qevent_symbol_element_mask, - Fcons (base, Fcons (index, Qnil))); + Fcons (base, Fcons (idx, Qnil))); Fput (new_symbol, Qevent_symbol_elements, Fcons (base, lispy_modifier_list (modifiers))); Sadly, this is only correct if `base' is indeed a base event, @@ -6821,16 +6821,17 @@ decode_keyboard_code (struct tty_display_info *tty, return; for (i = 0, p = coding->destination; i < coding->produced_char; i++) { - struct input_event buf; + struct input_event event_buf; - EVENT_INIT (buf); - buf.code = STRING_CHAR_ADVANCE (p); - buf.kind = (ASCII_CHAR_P (buf.code) - ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); + EVENT_INIT (event_buf); + event_buf.code = STRING_CHAR_ADVANCE (p); + event_buf.kind = + (ASCII_CHAR_P (event_buf.code) + ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); /* See the comment in tty_read_avail_input. */ - buf.frame_or_window = tty->top_frame; - buf.arg = Qnil; - kbd_buffer_store_event (&buf); + event_buf.frame_or_window = tty->top_frame; + event_buf.arg = Qnil; + kbd_buffer_store_event (&event_buf); } } @@ -6890,11 +6891,11 @@ tty_read_avail_input (struct terminal *terminal, if (gpm_tty == tty) { Gpm_Event event; - struct input_event hold_quit; + struct input_event gpm_hold_quit; int gpm, fd = gpm_fd; - EVENT_INIT (hold_quit); - hold_quit.kind = NO_EVENT; + EVENT_INIT (gpm_hold_quit); + gpm_hold_quit.kind = NO_EVENT; /* gpm==1 if event received. gpm==0 if the GPM daemon has closed the connection, in which case @@ -6903,13 +6904,13 @@ tty_read_avail_input (struct terminal *terminal, select masks. gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ while (gpm = Gpm_GetEvent (&event), gpm == 1) { - nread += handle_one_term_event (tty, &event, &hold_quit); + nread += handle_one_term_event (tty, &event, &gpm_hold_quit); } if (gpm == 0) /* Presumably the GPM daemon has closed the connection. */ close_gpm (fd); - if (hold_quit.kind != NO_EVENT) - kbd_buffer_store_event (&hold_quit); + if (gpm_hold_quit.kind != NO_EVENT) + kbd_buffer_store_event (&gpm_hold_quit); if (nread) return nread; } @@ -7329,8 +7330,6 @@ menu_bar_items (Lisp_Object old) int mapno; Lisp_Object oquit; - int i; - /* In order to build the menus, we need to call the keymap accessors. They all call QUIT. But this function is called during redisplay, during which a quit is fatal. So inhibit @@ -7432,15 +7431,18 @@ menu_bar_items (Lisp_Object old) } /* Add nil, nil, nil, nil at the end. */ - i = menu_bar_items_index; - if (i + 4 > XVECTOR (menu_bar_items_vector)->size) - menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); - /* Add this item. */ - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; - menu_bar_items_index = i; + { + int i = menu_bar_items_index; + if (i + 4 > XVECTOR (menu_bar_items_vector)->size) + menu_bar_items_vector = + larger_vector (menu_bar_items_vector, 2 * i, Qnil); + /* Add this item. */ + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; + menu_bar_items_index = i; + } Vinhibit_quit = oquit; return menu_bar_items_vector; @@ -8112,12 +8114,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) /* Process the rest of the properties. */ for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item))) { - Lisp_Object key, value; + Lisp_Object ikey, value; - key = XCAR (item); + ikey = XCAR (item); value = XCAR (XCDR (item)); - if (EQ (key, QCenable)) + if (EQ (ikey, QCenable)) { /* `:enable FORM'. */ if (!NILP (Venable_disabled_menus_and_buttons)) @@ -8125,20 +8127,20 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) else PROP (TOOL_BAR_ITEM_ENABLED_P) = value; } - else if (EQ (key, QCvisible)) + else if (EQ (ikey, QCvisible)) { /* `:visible FORM'. If got a visible property and that evaluates to nil then ignore this item. */ if (NILP (menu_item_eval_property (value))) return 0; } - else if (EQ (key, QChelp)) + else if (EQ (ikey, QChelp)) /* `:help HELP-STRING'. */ PROP (TOOL_BAR_ITEM_HELP) = value; - else if (EQ (key, QCvert_only)) + else if (EQ (ikey, QCvert_only)) /* `:vert-only t/nil'. */ PROP (TOOL_BAR_ITEM_VERT_ONLY) = value; - else if (EQ (key, QClabel)) + else if (EQ (ikey, QClabel)) { const char *bad_label = "!!?GARBLED ITEM?!!"; /* `:label LABEL-STRING'. */ @@ -8147,10 +8149,10 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) : make_string (bad_label, strlen (bad_label)); have_label = 1; } - else if (EQ (key, QCfilter)) + else if (EQ (ikey, QCfilter)) /* ':filter FORM'. */ filter = value; - else if (EQ (key, QCbutton) && CONSP (value)) + else if (EQ (ikey, QCbutton) && CONSP (value)) { /* `:button (TYPE . SELECTED)'. */ Lisp_Object type, selected; @@ -8163,13 +8165,13 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) PROP (TOOL_BAR_ITEM_TYPE) = type; } } - else if (EQ (key, QCimage) + else if (EQ (ikey, QCimage) && (CONSP (value) || (VECTORP (value) && XVECTOR (value)->size == 4))) /* Value is either a single image specification or a vector of 4 such specifications for the different button states. */ PROP (TOOL_BAR_ITEM_IMAGES) = value; - else if (EQ (key, Qrtl)) + else if (EQ (ikey, Qrtl)) /* ':rtl STRING' */ PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value; } @@ -8178,35 +8180,34 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) if (!have_label) { /* Try to make one from caption and key. */ - Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY); - Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION); - const char *label = SYMBOLP (key) ? SSDATA (SYMBOL_NAME (key)) : ""; - const char *caption = STRINGP (capt) ? SSDATA (capt) : ""; + Lisp_Object tkey = PROP (TOOL_BAR_ITEM_KEY); + Lisp_Object tcapt = PROP (TOOL_BAR_ITEM_CAPTION); + const char *label = SYMBOLP (tkey) ? SSDATA (SYMBOL_NAME (tkey)) : ""; + const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : ""; EMACS_INT max_lbl = 2 * tool_bar_max_label_size; char *buf = (char *) xmalloc (max_lbl + 1); Lisp_Object new_lbl; - size_t caption_len = strlen (caption); + size_t caption_len = strlen (capt); - if (caption_len <= max_lbl && caption[0] != '\0') + if (caption_len <= max_lbl && capt[0] != '\0') { - strcpy (buf, caption); + strcpy (buf, capt); while (caption_len > 0 && buf[caption_len - 1] == '.') caption_len--; buf[caption_len] = '\0'; - label = caption = buf; + label = capt = buf; } if (strlen (label) <= max_lbl && label[0] != '\0') { - int i; + int j; if (label != buf) strcpy (buf, label); - for (i = 0; buf[i] != '\0'; ++i) - if (buf[i] == '-') - buf[i] = ' '; + for (j = 0; buf[j] != '\0'; ++j) + if (buf[j] == '-') + buf[j] = ' '; label = buf; - } else label = ""; @@ -8958,9 +8959,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, int junk; #endif - struct gcpro gcpro1; + struct gcpro outer_gcpro1; - GCPRO1 (fake_prefixed_keys); + GCPRO1_VAR (fake_prefixed_keys, outer_gcpro1); raw_keybuf_count = 0; last_nonmenu_event = Qnil; @@ -9254,7 +9255,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (EQ (key, Qt)) { unbind_to (count, Qnil); - UNGCPRO; + UNGCPRO_VAR (outer_gcpro1); return -1; } @@ -9937,7 +9938,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, add_command_key (keybuf[t]); } - UNGCPRO; + UNGCPRO_VAR (outer_gcpro1); return t; } @@ -9984,11 +9985,11 @@ is nil, then the event will be put off until after the current key sequence. sequences, where they wouldn't conflict with ordinary bindings. See `function-key-map' for more details. -The optional fifth argument COMMAND-LOOP, if non-nil, means +The optional fifth argument CMD-LOOP, if non-nil, means that this key sequence is being read by something that will read commands one after another. It should be nil if the caller will read just one key sequence. */) - (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) + (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop) { Lisp_Object keybuf[30]; register int i; @@ -10000,9 +10001,9 @@ will read just one key sequence. */) QUIT; specbind (Qinput_method_exit_on_first_char, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); specbind (Qinput_method_use_echo_area, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); @@ -10045,7 +10046,7 @@ will read just one key sequence. */) DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, Sread_key_sequence_vector, 1, 5, 0, doc: /* Like `read-key-sequence' but always return a vector. */) - (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) + (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop) { Lisp_Object keybuf[30]; register int i; @@ -10057,9 +10058,9 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, QUIT; specbind (Qinput_method_exit_on_first_char, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); specbind (Qinput_method_use_echo_area, - (NILP (command_loop) ? Qt : Qnil)); + (NILP (cmd_loop) ? Qt : Qnil)); memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); -- cgit v1.2.1 From 560a553af5dacb11317afda073344fdbe17fdf17 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:19:28 -0700 Subject: * keyboard.c (read_key_sequence): Mark locals as initialized. --- src/ChangeLog | 1 + src/keyboard.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 896f3ea4be0..c4b4b4b5494 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,7 @@ (decode_keyboard_code, tty_read_avail_input, menu_bar_items): (parse_tool_bar_item, read_key_sequence, Fread_key_sequence): (Fread_key_sequence_vector): Rename locals to avoid shadowing. + (read_key_sequence): Mark locals as initialized. * keyboard.h (make_ctrl_char): New decl. (mark_kboards): Move decl here ... diff --git a/src/keyboard.c b/src/keyboard.c index a3083be2aee..5680f32502c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8866,7 +8866,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, /* The length of the echo buffer when we started reading, and the length of this_command_keys when we started reading. */ - int echo_start; + int echo_start IF_LINT (= 0); int keys_start; /* The number of keymaps we're scanning right now, and the number of @@ -8944,7 +8944,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, Lisp_Object first_event; #endif - Lisp_Object original_uppercase; + Lisp_Object original_uppercase IF_LINT (= Qnil); int original_uppercase_position = -1; /* Gets around Microsoft compiler limitations. */ @@ -9123,7 +9123,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, while those allow us to restart the entire key sequence, echo_local_start and keys_local_start allow us to throw away just one key. */ - int echo_local_start, keys_local_start, local_first_binding; + int echo_local_start IF_LINT (= 0); + int keys_local_start, local_first_binding; eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); eassert (indec.start <= indec.end); -- cgit v1.2.1 From 3ac946723de017fa8d2cf55510b3f0ff931f1237 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:25:21 -0700 Subject: * keyboard.c (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN. --- src/ChangeLog | 1 + src/keyboard.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c4b4b4b5494..1cdeefff899 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,7 @@ (parse_tool_bar_item, read_key_sequence, Fread_key_sequence): (Fread_key_sequence_vector): Rename locals to avoid shadowing. (read_key_sequence): Mark locals as initialized. + (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN. * keyboard.h (make_ctrl_char): New decl. (mark_kboards): Move decl here ... diff --git a/src/keyboard.c b/src/keyboard.c index 5680f32502c..afa78184179 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1169,6 +1169,7 @@ This also exits all active minibuffers. */) Fthrow (Qtop_level, Qnil); } +Lisp_Object Fexit_recursive_edit (void) NO_RETURN; DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", doc: /* Exit from the innermost recursive edit or minibuffer. */) (void) @@ -1179,6 +1180,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, error ("No recursive edit is in progress"); } +Lisp_Object Fabort_recursive_edit (void) NO_RETURN; DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", doc: /* Abort the command that requested this recursive edit or minibuffer input. */) (void) -- cgit v1.2.1 From c8a06054fc9dfb6dcb8c8a77a09657a10212cf4e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:28:09 -0700 Subject: * keyboard.c (read_char): Mark local as initialized. --- src/ChangeLog | 2 +- src/keyboard.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1cdeefff899..685ba3c7e9a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,7 +8,7 @@ (decode_keyboard_code, tty_read_avail_input, menu_bar_items): (parse_tool_bar_item, read_key_sequence, Fread_key_sequence): (Fread_key_sequence_vector): Rename locals to avoid shadowing. - (read_key_sequence): Mark locals as initialized. + (read_key_sequence, read_char): Mark locals as initialized. (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN. * keyboard.h (make_ctrl_char): New decl. diff --git a/src/keyboard.c b/src/keyboard.c index afa78184179..05b6abe97b3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2694,7 +2694,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (NILP (c)) { - KBOARD *kb; + KBOARD *kb IF_LINT (= NULL); if (end_time) { -- cgit v1.2.1 From 38fc62d95ae8078bedac4a99eb7ea8856f86032e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:32:56 -0700 Subject: * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal): (copy_keymap_item, append_key, push_text_char_description): Now static. --- src/ChangeLog | 4 ++++ src/keymap.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 685ba3c7e9a..9f770df40ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-14 Paul Eggert + * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal): + (copy_keymap_item, append_key, push_text_char_description): + Now static. + * keyboard.c: Declare functions static if they are not used elsewhere. (echo_char, echo_dash, cmd_error, top_level_2): (poll_for_input, handle_async_input): Now static. diff --git a/src/keymap.c b/src/keymap.c index 4459ef07d68..cbb6adf3a0b 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -255,7 +255,7 @@ get_keymap (Lisp_Object object, int error, int autoload) /* Return the parent map of KEYMAP, or nil if it has none. We assume that KEYMAP is a valid keymap. */ -Lisp_Object +static Lisp_Object keymap_parent (Lisp_Object keymap, int autoload) { Lisp_Object list; @@ -283,7 +283,7 @@ If KEYMAP has no parent, return nil. */) } /* Check whether MAP is one of MAPS parents. */ -int +static int keymap_memberp (Lisp_Object map, Lisp_Object maps) { if (NILP (map)) return 0; @@ -598,7 +598,7 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val) /* Call FUN for every binding in MAP and stop at (and return) the parent. FUN is called with 4 arguments: FUN (KEY, BINDING, ARGS, DATA). */ -Lisp_Object +static Lisp_Object map_keymap_internal (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, @@ -960,7 +960,7 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def) EXFUN (Fcopy_keymap, 1); -Lisp_Object +static Lisp_Object copy_keymap_item (Lisp_Object elt) { Lisp_Object res, tem; @@ -1337,7 +1337,7 @@ define_as_prefix (Lisp_Object keymap, Lisp_Object c) /* Append a key to the end of a key sequence. We always make a vector. */ -Lisp_Object +static Lisp_Object append_key (Lisp_Object key_sequence, Lisp_Object key) { Lisp_Object args[2]; @@ -2439,7 +2439,7 @@ around function keys and event symbols. */) return Qnil; } -char * +static char * push_text_char_description (register unsigned int c, register char *p) { if (c >= 0200) -- cgit v1.2.1 From 1004a21a8f2488da573e0340873cbdeac3ac2001 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:40:57 -0700 Subject: * keymap.c (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily. --- src/ChangeLog | 1 + src/keymap.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9f770df40ef..8efad3a59d9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal): (copy_keymap_item, append_key, push_text_char_description): Now static. + (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily. * keyboard.c: Declare functions static if they are not used elsewhere. (echo_char, echo_dash, cmd_error, top_level_2): diff --git a/src/keymap.c b/src/keymap.c index cbb6adf3a0b..05d9616ef2d 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2774,8 +2774,8 @@ remapped command in the returned list. */) considered remapped sequences yet, copy them over and process them. */ || (!remapped && (sequences = remapped_sequences, - remapped = 1), - CONSP (sequences))) + remapped = 1, + CONSP (sequences)))) { Lisp_Object sequence, function; -- cgit v1.2.1 From dbbb842771445b0376b95a48a4fae85f37420c62 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:42:21 -0700 Subject: * keymap.c (DENSE_TABLE_SIZE): Remove; unused. --- src/ChangeLog | 1 + src/keymap.c | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8efad3a59d9..5b9e472e4e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ (copy_keymap_item, append_key, push_text_char_description): Now static. (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily. + (DENSE_TABLE_SIZE): Remove; unused. * keyboard.c: Declare functions static if they are not used elsewhere. (echo_char, echo_dash, cmd_error, top_level_2): diff --git a/src/keymap.c b/src/keymap.c index 05d9616ef2d..a4de89f6a72 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -34,9 +34,6 @@ along with GNU Emacs. If not, see . */ #include "keymap.h" #include "window.h" -/* The number of elements in keymap vectors. */ -#define DENSE_TABLE_SIZE (0200) - /* Actually allocate storage for these variables */ Lisp_Object current_global_map; /* Current global keymap */ -- cgit v1.2.1 From c1141155bab3b9e7b7c7663329715d492bbbccb2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 08:53:19 -0700 Subject: * keymap.c: (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal): (describe_map_tree): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/keymap.c | 57 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 32 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5b9e472e4e9..55fa10066ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,9 @@ Now static. (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily. (DENSE_TABLE_SIZE): Remove; unused. + (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal): + (describe_map_tree): + Rename locals to avoid shadowing. * keyboard.c: Declare functions static if they are not used elsewhere. (echo_char, echo_dash, cmd_error, top_level_2): diff --git a/src/keymap.c b/src/keymap.c index a4de89f6a72..06968a0d944 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -188,8 +188,9 @@ when reading a key-sequence to be looked-up in this keymap. */) If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR is zero as well), return Qt. - ERROR controls how we respond if OBJECT isn't a keymap. - If ERROR is non-zero, signal an error; otherwise, just return Qnil. + ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap. + If ERROR_IF_NOT_KEYMAP is non-zero, signal an error; otherwise, + just return Qnil. Note that most of the time, we don't want to pursue autoloads. Functions like Faccessible_keymaps which scan entire keymap trees @@ -201,7 +202,7 @@ when reading a key-sequence to be looked-up in this keymap. */) do_autoload which can GC. */ Lisp_Object -get_keymap (Lisp_Object object, int error, int autoload) +get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload) { Lisp_Object tem; @@ -219,7 +220,7 @@ get_keymap (Lisp_Object object, int error, int autoload) /* Should we do an autoload? Autoload forms for keymaps have Qkeymap as their fifth element. */ - if ((autoload || !error) && EQ (XCAR (tem), Qautoload) + if ((autoload || !error_if_not_keymap) && EQ (XCAR (tem), Qautoload) && SYMBOLP (object)) { Lisp_Object tail; @@ -244,7 +245,7 @@ get_keymap (Lisp_Object object, int error, int autoload) } end: - if (error) + if (error_if_not_keymap) wrong_type_argument (Qkeymapp, object); return Qnil; } @@ -465,19 +466,19 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au /* See if there is a meta-map. If there's none, there is no binding for IDX, unless a default binding exists in MAP. */ struct gcpro gcpro1; - Lisp_Object meta_map; + Lisp_Object event_meta_map; GCPRO1 (map); /* A strange value in which Meta is set would cause infinite recursion. Protect against that. */ if (XINT (meta_prefix_char) & CHAR_META) meta_prefix_char = make_number (27); - meta_map = get_keymap (access_keymap (map, meta_prefix_char, - t_ok, noinherit, autoload), - 0, autoload); + event_meta_map = get_keymap (access_keymap (map, meta_prefix_char, + t_ok, noinherit, autoload), + 0, autoload); UNGCPRO; - if (CONSP (meta_map)) + if (CONSP (event_meta_map)) { - map = meta_map; + map = event_meta_map; idx = make_number (XUINT (idx) & ~meta_modifier); } else if (t_ok) @@ -1139,10 +1140,10 @@ binding KEY to DEF is added at the front of KEYMAP. */) int i = ASIZE (def); while (--i >= 0) { - Lisp_Object c = AREF (def, i); - if (CONSP (c) && lucid_event_type_list_p (c)) - c = Fevent_convert_list (c); - ASET (tmp, i, c); + Lisp_Object defi = AREF (def, i); + if (CONSP (defi) && lucid_event_type_list_p (defi)) + defi = Fevent_convert_list (defi); + ASET (tmp, i, defi); } def = tmp; } @@ -2812,9 +2813,9 @@ remapped command in the returned list. */) seems to be only one menu item to report. */ if (! NILP (sequence)) { - Lisp_Object tem; - tem = Faref (sequence, make_number (ASIZE (sequence) - 1)); - if (STRINGP (tem)) + Lisp_Object tem1; + tem1 = Faref (sequence, make_number (ASIZE (sequence) - 1)); + if (STRINGP (tem1)) Faset (sequence, make_number (ASIZE (sequence) - 1), build_string ("(any string)")); } @@ -3119,13 +3120,13 @@ key binding\n\ /* Delete from MAPS each element that is for the menu bar. */ for (list = maps; CONSP (list); list = XCDR (list)) { - Lisp_Object elt, prefix, tem; + Lisp_Object elt, elt_prefix, tem; elt = XCAR (list); - prefix = Fcar (elt); - if (XVECTOR (prefix)->size >= 1) + elt_prefix = Fcar (elt); + if (XVECTOR (elt_prefix)->size >= 1) { - tem = Faref (prefix, make_number (0)); + tem = Faref (elt_prefix, make_number (0)); if (EQ (tem, Qmenu_bar)) maps = Fdelq (elt, maps); } @@ -3150,10 +3151,10 @@ key binding\n\ for (; CONSP (maps); maps = XCDR (maps)) { - register Lisp_Object elt, prefix, tail; + register Lisp_Object elt, elt_prefix, tail; elt = XCAR (maps); - prefix = Fcar (elt); + elt_prefix = Fcar (elt); sub_shadows = Qnil; @@ -3165,8 +3166,8 @@ key binding\n\ /* If the sequence by which we reach this keymap is zero-length, then the shadow map for this keymap is just SHADOW. */ - if ((STRINGP (prefix) && SCHARS (prefix) == 0) - || (VECTORP (prefix) && XVECTOR (prefix)->size == 0)) + if ((STRINGP (elt_prefix) && SCHARS (elt_prefix) == 0) + || (VECTORP (elt_prefix) && XVECTOR (elt_prefix)->size == 0)) ; /* If the sequence by which we reach this keymap actually has some elements, then the sequence's definition in SHADOW is @@ -3192,12 +3193,12 @@ key binding\n\ for (tail = orig_maps; !EQ (tail, maps); tail = XCDR (tail)) { Lisp_Object tem; - tem = Fequal (Fcar (XCAR (tail)), prefix); + tem = Fequal (Fcar (XCAR (tail)), elt_prefix); if (!NILP (tem)) sub_shadows = Fcons (XCDR (XCAR (tail)), sub_shadows); } - describe_map (Fcdr (elt), prefix, + describe_map (Fcdr (elt), elt_prefix, transl ? describe_translation : describe_command, partial, sub_shadows, &seen, nomenu, mention_shadow); -- cgit v1.2.1 From 2aa46d6cce6773a0c56c93ca64750caea6ed3bba Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 14 Mar 2011 12:18:25 -0400 Subject: * src/buffer.c (Fmake_indirect_buffer): Fix incorrect assertion. --- src/ChangeLog | 4 ++++ src/buffer.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bad9b8dd4b7..8e5c9564f55 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-14 Chong Yidong + + * buffer.c (Fmake_indirect_buffer): Fix incorrect assertion. + 2011-03-13 Chong Yidong * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) diff --git a/src/buffer.c b/src/buffer.c index 01940728275..c0485c10a99 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -611,8 +611,8 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Make sure the base buffer has markers for its narrowing. */ if (NILP (BVAR (b->base_buffer, pt_marker))) { - eassert (NILP (BVAR (b, begv_marker))); - eassert (NILP (BVAR (b, zv_marker))); + eassert (NILP (BVAR (b->base_buffer, begv_marker))); + eassert (NILP (BVAR (b->base_buffer, zv_marker))); BVAR (b->base_buffer, pt_marker) = Fmake_marker (); set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, -- cgit v1.2.1 From 7684e57b24092dbfbbe7fc62a1a544e40e2ce88a Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 14 Mar 2011 18:07:53 +0100 Subject: src/w32*.c: Clean up extern declarations. * w32select.c: Don't #include "keyboard.h". (run_protected): Add extern declaration for waiting_for_input. * lisp.h (VWindow_system, Qfile_name_history): * keyboard.h (lispy_function_keys) [WINDOWSNT]: * w32term.h (w32_system_caret_hwnd, w32_system_caret_height) (w32_system_caret_x, w32_system_caret_y): Declare extern. * w32.c (Qlocal, noninteractive1, inhibit_window_system): * w32console.c (detect_input_pending, read_input_pending) (encode_terminal_code): * w32fns.c (quit_char, lispy_function_keys, Qtooltip) (w32_system_caret_hwnd, w32_system_caret_height, w32_system_caret_x) (w32_system_caret_y, Qfile_name_history): * w32font.c (w32font_driver, QCantialias, QCotf, QClang): * w32inevt.c (reinvoke_input_signal, lispy_function_keys): * w32menu.c (Qmenu_bar, QCtoggle, QCradio, Qoverriding_local_map) (Qoverriding_terminal_local_map, Qmenu_bar_update_hook): * w32proc.c (Qlocal, report_file_error): * w32term.c (Vwindow_system, updating_frame): * w32uniscribe.c (initialized, uniscribe_font_driver): Remove unneeded extern declarations. --- src/ChangeLog | 25 +++++++++++++++++++++++++ src/keyboard.h | 9 ++++++--- src/lisp.h | 2 ++ src/w32.c | 5 ----- src/w32console.c | 9 --------- src/w32fns.c | 15 +-------------- src/w32font.c | 3 --- src/w32inevt.c | 9 ++------- src/w32menu.c | 8 -------- src/w32proc.c | 8 ++------ src/w32select.c | 2 +- src/w32term.c | 14 ++------------ src/w32term.h | 6 +++++- src/w32uniscribe.c | 4 ---- 14 files changed, 46 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8e5c9564f55..09413b26483 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,28 @@ +2011-03-14 Juanma Barranquero + + * lisp.h (VWindow_system, Qfile_name_history): + * keyboard.h (lispy_function_keys) [WINDOWSNT]: + * w32term.h (w32_system_caret_hwnd, w32_system_caret_height) + (w32_system_caret_x, w32_system_caret_y): Declare extern. + + * w32select.c: Don't #include "keyboard.h". + (run_protected): Add extern declaration for waiting_for_input. + + * w32.c (Qlocal, noninteractive1, inhibit_window_system): + * w32console.c (detect_input_pending, read_input_pending) + (encode_terminal_code): + * w32fns.c (quit_char, lispy_function_keys, Qtooltip) + (w32_system_caret_hwnd, w32_system_caret_height, w32_system_caret_x) + (w32_system_caret_y, Qfile_name_history): + * w32font.c (w32font_driver, QCantialias, QCotf, QClang): + * w32inevt.c (reinvoke_input_signal, lispy_function_keys): + * w32menu.c (Qmenu_bar, QCtoggle, QCradio, Qoverriding_local_map) + (Qoverriding_terminal_local_map, Qmenu_bar_update_hook): + * w32proc.c (Qlocal, report_file_error): + * w32term.c (Vwindow_system, updating_frame): + * w32uniscribe.c (initialized, uniscribe_font_driver): + Remove unneeded extern declarations. + 2011-03-14 Chong Yidong * buffer.c (Fmake_indirect_buffer): Fix incorrect assertion. diff --git a/src/keyboard.h b/src/keyboard.h index 10bf16d5c5c..f2000a44643 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -90,7 +90,7 @@ struct kboard /* User-supplied table to translate input characters through. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); - + /* Last command that may be repeated by `repeat'. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); @@ -140,12 +140,12 @@ struct kboard /* Keymap mapping keys to alternative preferred forms. See the DEFVAR for more documentation. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); - + /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. See the DEFVAR for more documentation. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); - + /* Minibufferless frames on this display use this frame's minibuffer. */ Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); @@ -518,3 +518,6 @@ extern int tty_read_avail_input (struct terminal *, int, struct input_event *); extern EMACS_TIME timer_check (int); +#ifdef WINDOWSNT +extern const char *const lispy_function_keys[]; +#endif diff --git a/src/lisp.h b/src/lisp.h index 113585320af..0f55da317ca 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2607,6 +2607,7 @@ extern void syms_of_insdel (void); /* Defined in dispnew.c */ extern Lisp_Object selected_frame; +extern Lisp_Object Vwindow_system; EXFUN (Fding, 1); EXFUN (Fredraw_frame, 1); EXFUN (Fsleep_for, 2); @@ -3009,6 +3010,7 @@ extern Lisp_Object Qfile_error; extern Lisp_Object Qfile_exists_p; extern Lisp_Object Qfile_directory_p; extern Lisp_Object Qinsert_file_contents; +extern Lisp_Object Qfile_name_history; EXFUN (Ffind_file_name_handler, 2); EXFUN (Ffile_name_as_directory, 1); EXFUN (Fexpand_file_name, 2); diff --git a/src/w32.c b/src/w32.c index ae2373be46e..721cea07d20 100644 --- a/src/w32.c +++ b/src/w32.c @@ -147,9 +147,6 @@ typedef HRESULT (WINAPI * ShGetFolderPath_fn) void globals_of_w32 (void); static DWORD get_rid (PSID); -/* Defined in process.c for its own purpose. */ -extern Lisp_Object Qlocal; - /* Initialization states. @@ -5666,8 +5663,6 @@ sys_write (int fd, const void * buffer, unsigned int count) static void check_windows_init_file (void) { - extern int noninteractive, inhibit_window_system; - /* A common indication that Emacs is not installed properly is when it cannot find the Windows installation file. If this file does not exist in the expected place, tell the user. */ diff --git a/src/w32console.c b/src/w32console.c index 31c4a7c4e5a..3c200405cb5 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -41,12 +41,6 @@ along with GNU Emacs. If not, see . */ /* from window.c */ extern Lisp_Object Frecenter (Lisp_Object); -/* from keyboard.c */ -extern int detect_input_pending (void); - -/* from sysdep.c */ -extern int read_input_pending (void); - static void w32con_move_cursor (struct frame *f, int row, int col); static void w32con_clear_to_end (struct frame *f); static void w32con_clear_frame (struct frame *f); @@ -277,9 +271,6 @@ w32con_insert_glyphs (struct frame *f, register struct glyph *start, } } -extern unsigned char *encode_terminal_code (struct glyph *, int, - struct coding_system *); - static void w32con_write_glyphs (struct frame *f, register struct glyph *string, register int len) diff --git a/src/w32fns.c b/src/w32fns.c index 09442d41e14..0c899cdceff 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -80,10 +80,6 @@ extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); extern void w32_free_menu_strings (HWND); extern const char *map_w32_filename (const char *, const char **); -extern int quit_char; - -extern const char *const lispy_function_keys[]; - /* If non-zero, a w32 timer that, when it expires, displays an hourglass cursor on all frames. */ static unsigned hourglass_timer = 0; @@ -187,18 +183,10 @@ unsigned int msh_mousewheel = 0; #define MENU_FREE_DELAY 1000 static unsigned menu_free_timer = 0; -extern Lisp_Object Qtooltip; - #ifdef GLYPH_DEBUG int image_cache_refcount, dpyinfo_refcount; #endif - -extern HWND w32_system_caret_hwnd; - -extern int w32_system_caret_height; -extern int w32_system_caret_x; -extern int w32_system_caret_y; static HWND w32_visible_system_caret_hwnd; /* From w32menu.c */ @@ -5851,7 +5839,6 @@ Value is t if tooltip was open, nil otherwise. */) /*********************************************************************** File selection dialog ***********************************************************************/ -extern Lisp_Object Qfile_name_history; /* Callback for altering the behavior of the Open File dialog. Makes the Filename text field contain "Current Directory" and be @@ -5899,7 +5886,7 @@ file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) no man's land and the user will be unable to tab through the dialog box (pressing tab will only result in a beep). Avoid that problem by setting focus to the list here. */ - if (CDN_INITDONE == notify->hdr.code) + if (notify->hdr.code == CDN_INITDONE) SetFocus (list); } else diff --git a/src/w32font.c b/src/w32font.c index aef62f61a3a..40ff0782b88 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -54,8 +54,6 @@ along with GNU Emacs. If not, see . */ #define JOHAB_CHARSET 130 #endif -extern struct font_driver w32font_driver; - Lisp_Object Qgdi; Lisp_Object Quniscribe; static Lisp_Object QCformat; @@ -64,7 +62,6 @@ static Lisp_Object Qserif, Qscript, Qdecorative; static Lisp_Object Qraster, Qoutline, Qunknown; /* antialiasing */ -extern Lisp_Object QCantialias, QCotf, QClang; /* defined in font.c */ extern Lisp_Object Qnone; /* reuse from w32fns.c */ static Lisp_Object Qstandard, Qsubpixel, Qnatural; diff --git a/src/w32inevt.c b/src/w32inevt.c index d0b097100fd..c4858dea908 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -40,18 +40,15 @@ along with GNU Emacs. If not, see . */ #include "w32heap.h" #include "w32term.h" -/* stdin, from ntterm */ +/* stdin, from w32console.c */ extern HANDLE keyboard_handle; /* Info for last mouse motion */ static COORD movement_pos; static DWORD movement_time; -/* from keyboard.c */ -extern void reinvoke_input_signal (void); - +/* from w32fns.c */ extern unsigned int map_keypad_keys (unsigned int, unsigned int); - extern unsigned int w32_key_to_modifier (int key); /* Event queue */ @@ -261,8 +258,6 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event) } -extern const char *const lispy_function_keys[]; - static int faked_key = 0; /* return code -1 means that event_queue_ptr won't be incremented. diff --git a/src/w32menu.c b/src/w32menu.c index 92447eb9fae..a2e62f24f6a 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -84,14 +84,6 @@ MessageBoxW_Proc unicode_message_box = NULL; Lisp_Object Qdebug_on_next_call; -extern Lisp_Object Qmenu_bar; - -extern Lisp_Object QCtoggle, QCradio; - -extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; - -extern Lisp_Object Qmenu_bar_update_hook; - void set_frame_menubar (FRAME_PTR, int, int); #ifdef HAVE_DIALOGS diff --git a/src/w32proc.c b/src/w32proc.c index bb8b428ffe4..e94d9aa3254 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -67,8 +67,6 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD); + ((DWORD)(var) - (section)->VirtualAddress) \ + (filedata).file_base)) -extern Lisp_Object Qlocal; - Lisp_Object Qhigh, Qlow; #ifdef EMACSDEBUG @@ -1053,7 +1051,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) detect that we were woken up by C-g, we return -1 with errno set to EINTR as on Unix. */ -/* From ntterm.c */ +/* From w32console.c */ extern HANDLE keyboard_handle; /* From w32xfns.c */ @@ -1559,8 +1557,6 @@ sys_kill (int pid, int sig) return rc; } -/* extern int report_file_error (char *, Lisp_Object); */ - /* The following two routines are used to manipulate stdin, stdout, and stderr of our child processes. @@ -1660,7 +1656,7 @@ set_process_dir (char * dir) dial-up users to only be connected when they actually need to use socket services. */ -/* From nt.c */ +/* From w32.c */ extern HANDLE winsock_lib; extern BOOL term_winsock (void); extern BOOL init_winsock (int load_now); diff --git a/src/w32select.c b/src/w32select.c index 23d5fb68c77..ef0cb3adc24 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -78,7 +78,6 @@ along with GNU Emacs. If not, see . */ #include "w32term.h" /* for all of the w32 includes */ #include "w32heap.h" /* os_subtype */ #include "blockinput.h" -#include "keyboard.h" /* cmd_error_internal() */ #include "charset.h" #include "coding.h" #include "character.h" @@ -391,6 +390,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg) with global variables and calling strange looking functions. Is this really the right way to run Lisp callbacks? */ + extern int waiting_for_input; /* from keyboard.c */ int owfi; BLOCK_INPUT; diff --git a/src/w32term.c b/src/w32term.c index 67e853f21f0..f31c4e90e77 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -88,8 +88,6 @@ extern void free_frame_menubar (struct frame *); extern int w32_codepage_for_font (char *fontname); extern Cursor w32_load_cursor (LPCTSTR name); -extern Lisp_Object Vwindow_system; - #define x_any_window_to_frame x_window_to_frame #define x_top_window_to_frame x_window_to_frame @@ -138,13 +136,6 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); #define WS_EX_LAYERED 0x80000 #endif -/* Frame being updated by update_frame. This is declared in term.c. - This is set by update_begin and looked at by all the - w32 functions. It is zero while not inside an update. - In that case, the w32 functions assume that `SELECTED_FRAME ()' - is the frame to apply to. */ -extern struct frame *updating_frame; - /* This is a frame waiting to be autoraised, within w32_read_socket. */ struct frame *pending_autoraise_frame; @@ -2536,8 +2527,7 @@ x_delete_glyphs (struct frame *f, register int n) } -/* Clear entire frame. If updating_frame is non-null, clear that - frame. Otherwise clear the selected frame. */ +/* Clear entire frame. */ static void x_clear_frame (struct frame *f) @@ -6060,7 +6050,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal->mouse_position_hook = w32_mouse_position; terminal->frame_rehighlight_hook = w32_frame_rehighlight; terminal->frame_raise_lower_hook = w32_frame_raise_lower; - // terminal->fullscreen_hook = XTfullscreen_hook; + /* terminal->fullscreen_hook = XTfullscreen_hook; */ terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar; terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars; terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; diff --git a/src/w32term.h b/src/w32term.h index c79352a8db8..cf6751b7d63 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -547,7 +547,7 @@ do { \ #define WM_APPCOMMAND 0x319 #define GET_APPCOMMAND_LPARAM(lParam) (HIWORD(lParam) & 0x7fff) #endif -#ifndef WM_UNICHAR +#ifndef WM_UNICHAR #define WM_UNICHAR 0x109 #endif #ifndef UNICODE_NOCHAR @@ -697,3 +697,7 @@ typedef BOOL (WINAPI * AppendMenuW_Proc) ( IN UINT_PTR, IN LPCWSTR); +extern HWND w32_system_caret_hwnd; +extern int w32_system_caret_height; +extern int w32_system_caret_x; +extern int w32_system_caret_y; diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 319f934e3bb..39d1ee5c851 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -52,10 +52,6 @@ int uniscribe_available = 0; extern Lisp_Object Quniscribe; extern Lisp_Object Qopentype; -extern int initialized; - -extern struct font_driver uniscribe_font_driver; - /* EnumFontFamiliesEx callback. */ static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, NEWTEXTMETRICEX *, -- cgit v1.2.1 From c96bbc66c6ce2554a0c5336110d5fd9a72ae371a Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 14 Mar 2011 18:22:53 +0100 Subject: src/ChangeLog: Fix typos. --- src/ChangeLog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 09413b26483..a1538d8f3f7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,7 +6,7 @@ (w32_system_caret_x, w32_system_caret_y): Declare extern. * w32select.c: Don't #include "keyboard.h". - (run_protected): Add extern declaration for waiting_for_input. + (run_protected): Add extern declaration for waiting_for_input. * w32.c (Qlocal, noninteractive1, inhibit_window_system): * w32console.c (detect_input_pending, read_input_pending) @@ -25,7 +25,7 @@ 2011-03-14 Chong Yidong - * buffer.c (Fmake_indirect_buffer): Fix incorrect assertion. + * buffer.c (Fmake_indirect_buffer): Fix incorrect assertions. 2011-03-13 Chong Yidong @@ -130,7 +130,7 @@ 2011-03-12 Eli Zaretskii - * termcap.c [MSDOS]: Include "msdos.h. + * termcap.c [MSDOS]: Include "msdos.h". (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent): Constify `char *' arguments and their references according to prototypes in tparam.h. -- cgit v1.2.1 From 604efe86a9fa5ab29cb701136b4a2dac1526062a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 15:36:12 -0700 Subject: * sysdep.c (reset_io): Now static. --- src/ChangeLog | 2 ++ src/sysdep.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 55fa10066ef..97fa2706cbb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-14 Paul Eggert + * sysdep.c (reset_io): Now static. + * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal): (copy_keymap_item, append_key, push_text_char_description): Now static. diff --git a/src/sysdep.c b/src/sysdep.c index 5760d0224eb..ac7927e8734 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -632,7 +632,7 @@ init_sigio (int fd) { } -void +static void reset_sigio (int fd) { } @@ -662,7 +662,7 @@ init_sigio (int fd) interrupts_deferred = 0; } -void +static void reset_sigio (int fd) { #ifdef FASYNC -- cgit v1.2.1 From b8950c9480bca68fd8c7a619127cb69c9aa684fe Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 15:37:08 -0700 Subject: * sysdep.c (wait_for_termination_signal): Remove; unused. --- src/ChangeLog | 1 + src/sysdep.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 97fa2706cbb..d695c20be42 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-14 Paul Eggert * sysdep.c (reset_io): Now static. + (wait_for_termination_signal): Remove; unused. * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal): (copy_keymap_item, append_key, push_text_char_description): diff --git a/src/sysdep.c b/src/sysdep.c index ac7927e8734..e5bf27f4fec 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -292,10 +292,6 @@ init_baud_rate (int fd) int wait_debugging; /* Set nonzero to make following function work under dbx (at least for bsd). */ -SIGTYPE -wait_for_termination_signal (void) -{} - #ifndef MSDOS /* Wait for subprocess with process id `pid' to terminate and make sure it will get eliminated (not remain forever as a zombie) */ -- cgit v1.2.1 From a884fdcc41237099dc76548a9b751ceaabefe7de Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 15:42:10 -0700 Subject: * fns.c (get_random, seed_random): Move extern decls from here ... * lisp.h: ... to here, so that they can be checked. --- src/ChangeLog | 3 +++ src/fns.c | 3 --- src/lisp.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d695c20be42..e45fed84108 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-14 Paul Eggert + * fns.c (get_random, seed_random): Move extern decls from here ... + * lisp.h: ... to here, so that they can be checked. + * sysdep.c (reset_io): Now static. (wait_for_termination_signal): Remove; unused. diff --git a/src/fns.c b/src/fns.c index b54d52e3003..0026c9d12e4 100644 --- a/src/fns.c +++ b/src/fns.c @@ -57,9 +57,6 @@ Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper; static int internal_equal (Lisp_Object , Lisp_Object, int, int); -extern long get_random (void); -extern void seed_random (long); - #ifndef HAVE_UNISTD_H extern long time (); #endif diff --git a/src/lisp.h b/src/lisp.h index 541302cb56b..eacd68e42cb 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3340,6 +3340,8 @@ extern void child_setup_tty (int); extern void setup_pty (int); extern int set_window_size (int, int, int); extern void create_process (Lisp_Object, char **, Lisp_Object); +extern long get_random (void); +extern void seed_random (long); extern int emacs_open (const char *, int, int); extern int emacs_close (int); extern int emacs_read (int, char *, unsigned int); -- cgit v1.2.1 From a0977c44540ebf331dde6f673f4fbf735b4e30ac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 15:49:41 -0700 Subject: * process.c (serial_open, serial_configure): Move decls from here ... * systty.h: ... to here, so that they can be checked. --- src/ChangeLog | 3 +++ src/process.c | 4 ---- src/systty.h | 3 +++ 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e45fed84108..edc79329a3b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-14 Paul Eggert + * process.c (serial_open, serial_configure): Move decls from here ... + * systty.h: ... to here, so that they can be checked. + * fns.c (get_random, seed_random): Move extern decls from here ... * lisp.h: ... to here, so that they can be checked. diff --git a/src/process.c b/src/process.c index 210287a85f1..c8f329c244b 100644 --- a/src/process.c +++ b/src/process.c @@ -164,10 +164,6 @@ extern Lisp_Object QCfilter; extern const char *get_operating_system_release (void); -/* From sysdep.c or w32.c */ -extern int serial_open (char *port); -extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); - #ifndef HAVE_H_ERRNO extern int h_errno; #endif diff --git a/src/systty.h b/src/systty.h index 2eacfdb2716..1548952e7a8 100644 --- a/src/systty.h +++ b/src/systty.h @@ -118,3 +118,6 @@ struct emacs_tty { extern int emacs_get_tty (int, struct emacs_tty *); extern int emacs_set_tty (int, struct emacs_tty *, int); +/* From sysdep.c or w32.c */ +extern int serial_open (char *); +extern void serial_configure (struct Lisp_Process *, Lisp_Object); -- cgit v1.2.1 From a70072c9a5be8a9cdd4d848b30ee5c82ee5c0987 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 15:52:28 -0700 Subject: * sysdep.c (system_process_attributes): Rename vars to avoid shadowing. --- src/ChangeLog | 2 ++ src/sysdep.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index edc79329a3b..0840e5ec9f0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-14 Paul Eggert + * sysdep.c (system_process_attributes): Rename vars to avoid shadowing. + * process.c (serial_open, serial_configure): Move decls from here ... * systty.h: ... to here, so that they can be checked. diff --git a/src/sysdep.c b/src/sysdep.c index e5bf27f4fec..b8fbf863074 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2667,8 +2667,8 @@ system_process_attributes (Lisp_Object pid) size_t cmdsize = 0, cmdline_size; unsigned char c; int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount; - unsigned long long utime, stime, cutime, cstime, start; - long priority, nice, rss; + unsigned long long u_time, s_time, cutime, cstime, start; + long priority, niceness, rss; unsigned long minflt, majflt, cminflt, cmajflt, vsize; time_t sec; unsigned usec; @@ -2748,8 +2748,8 @@ system_process_attributes (Lisp_Object pid) sscanf (p, "%c %d %d %d %d %d %*u %lu %lu %lu %lu %Lu %Lu %Lu %Lu %ld %ld %d %*d %Lu %lu %ld", &c, &ppid, &pgrp, &sess, &tty, &tpgid, &minflt, &cminflt, &majflt, &cmajflt, - &utime, &stime, &cutime, &cstime, - &priority, &nice, &thcount, &start, &vsize, &rss); + &u_time, &s_time, &cutime, &cstime, + &priority, &niceness, &thcount, &start, &vsize, &rss); { char state_str[2]; @@ -2777,13 +2777,14 @@ system_process_attributes (Lisp_Object pid) if (clocks_per_sec < 0) clocks_per_sec = 100; attrs = Fcons (Fcons (Qutime, - ltime_from_jiffies (utime, clocks_per_sec)), + ltime_from_jiffies (u_time, clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qstime, - ltime_from_jiffies (stime, clocks_per_sec)), + ltime_from_jiffies (s_time, clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qtime, - ltime_from_jiffies (stime+utime, clocks_per_sec)), + ltime_from_jiffies (s_time + u_time, + clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qcutime, ltime_from_jiffies (cutime, clocks_per_sec)), @@ -2795,7 +2796,7 @@ system_process_attributes (Lisp_Object pid) ltime_from_jiffies (cstime+cutime, clocks_per_sec)), attrs); attrs = Fcons (Fcons (Qpri, make_number (priority)), attrs); - attrs = Fcons (Fcons (Qnice, make_number (nice)), attrs); + attrs = Fcons (Fcons (Qnice, make_number (niceness)), attrs); attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount_eint)), attrs); EMACS_GET_TIME (tnow); get_up_time (&sec, &usec); @@ -2825,7 +2826,7 @@ system_process_attributes (Lisp_Object pid) make_number (EMACS_USECS (telapsed)))), attrs); - time_from_jiffies (utime + stime, clocks_per_sec, &sec, &usec); + time_from_jiffies (u_time + s_time, clocks_per_sec, &sec, &usec); pcpu = (sec + usec / 1000000.0) / (EMACS_SECS (telapsed) + EMACS_USECS (telapsed) / 1000000.0); if (pcpu > 1.0) pcpu = 1.0; -- cgit v1.2.1 From fbd02d7b061d3adc47ccce6ff568ef4bd3aecf17 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 15:56:24 -0700 Subject: * sysdep.c: Fix pointer signedness issue. --- src/ChangeLog | 1 + src/sysdep.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0840e5ec9f0..266ff2f58a6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-14 Paul Eggert * sysdep.c (system_process_attributes): Rename vars to avoid shadowing. + Fix pointer signedness issue. * process.c (serial_open, serial_configure): Move decls from here ... * systty.h: ... to here, so that they can be checked. diff --git a/src/sysdep.c b/src/sysdep.c index b8fbf863074..e19f9ca829e 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2845,8 +2845,10 @@ system_process_attributes (Lisp_Object pid) fd = emacs_open (fn, O_RDONLY, 0); if (fd >= 0) { - for (cmdline_size = 0; emacs_read (fd, &c, 1) == 1; cmdline_size++) + char ch; + for (cmdline_size = 0; emacs_read (fd, &ch, 1) == 1; cmdline_size++) { + c = ch; if (isspace (c) || c == '\\') cmdline_size++; /* for later quoting, see below */ } -- cgit v1.2.1 From edced198e35ccd2ab81797988705597da3fc3e19 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 16:30:06 -0700 Subject: * sysdep.c (sys_subshell): Mark local as volatile if checking for lint, to suppress a gcc -Wclobbered warning that does not seem to be right. --- src/ChangeLog | 2 ++ src/sysdep.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 266ff2f58a6..efc238cc078 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * sysdep.c (system_process_attributes): Rename vars to avoid shadowing. Fix pointer signedness issue. + (sys_subshell): Mark local as volatile if checking for lint, + to suppress a gcc -Wclobbered warning that does not seem to be right. * process.c (serial_open, serial_configure): Move decls from here ... * systty.h: ... to here, so that they can be checked. diff --git a/src/sysdep.c b/src/sysdep.c index e19f9ca829e..1c49b2a3387 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -488,7 +488,7 @@ sys_subshell (void) int pid; struct save_signal saved_handlers[5]; Lisp_Object dir; - unsigned char *str = 0; + unsigned char * IF_LINT (volatile) str = 0; int len; saved_handlers[0].code = SIGINT; -- cgit v1.2.1 From 15dfd3d9d66e43270f6ba506a7333bdc409a1ea9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 16:31:21 -0700 Subject: * sysdep.c (MAXPATHLEN): Define only if needed. --- src/ChangeLog | 1 + src/sysdep.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index efc238cc078..0a6b29a006c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ Fix pointer signedness issue. (sys_subshell): Mark local as volatile if checking for lint, to suppress a gcc -Wclobbered warning that does not seem to be right. + (MAXPATHLEN): Define only if needed. * process.c (serial_open, serial_configure): Move decls from here ... * systty.h: ... to here, so that they can be checked. diff --git a/src/sysdep.c b/src/sysdep.c index 1c49b2a3387..6ef3d88c5c8 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1886,13 +1886,13 @@ emacs_write (int fildes, const char *buf, unsigned int nbyte) * under error conditions. */ +#ifndef HAVE_GETWD + #ifndef MAXPATHLEN /* In 4.1, param.h fails to define this. */ #define MAXPATHLEN 1024 #endif -#ifndef HAVE_GETWD - char * getwd (char *pathname) { -- cgit v1.2.1 From c3bd59b510ddf8a9188a7dcd46b0a01a9b3f6172 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 16:32:27 -0700 Subject: * buffer.c (switch_to_buffer_1): Now static. --- src/ChangeLog | 2 ++ src/buffer.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0a6b29a006c..9bdfb18239f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-14 Paul Eggert + * buffer.c (switch_to_buffer_1): Now static. + * sysdep.c (system_process_attributes): Rename vars to avoid shadowing. Fix pointer signedness issue. (sys_subshell): Mark local as volatile if checking for lint, diff --git a/src/buffer.c b/src/buffer.c index 01940728275..68253a261c4 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1712,7 +1712,7 @@ the current buffer's major mode. */) /* Switch to buffer BUFFER in the selected window. If NORECORD is non-nil, don't call record_buffer. */ -Lisp_Object +static Lisp_Object switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord) { register Lisp_Object buffer; -- cgit v1.2.1 From 8f54f30aec0b3278cc1e370445ae2b3e5a115a46 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 16:43:16 -0700 Subject: * buffer.c: (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte): (report_overlay_modification): Rename locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/buffer.c | 86 +++++++++++++++++++++++++++++------------------------------ 2 files changed, 45 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9bdfb18239f..2c0e951c8df 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2011-03-14 Paul Eggert * buffer.c (switch_to_buffer_1): Now static. + (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte): + (report_overlay_modification): Rename locals to avoid shadowing. * sysdep.c (system_process_attributes): Rename vars to avoid shadowing. Fix pointer signedness issue. diff --git a/src/buffer.c b/src/buffer.c index 68253a261c4..99b4650bb60 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1464,9 +1464,9 @@ with SIGHUP. */) don't re-kill them. */ if (other->base_buffer == b && !NILP (BVAR (other, name))) { - Lisp_Object buffer; - XSETBUFFER (buffer, other); - Fkill_buffer (buffer); + Lisp_Object buf; + XSETBUFFER (buf, other); + Fkill_buffer (buf); } UNGCPRO; @@ -1527,9 +1527,9 @@ with SIGHUP. */) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) { - Lisp_Object tem; - tem = Fsymbol_value (intern ("delete-auto-save-files")); - if (! NILP (tem)) + Lisp_Object delete; + delete = Fsymbol_value (intern ("delete-auto-save-files")); + if (! NILP (delete)) internal_delete_file (BVAR (b, auto_save_file_name)); } @@ -1601,19 +1601,19 @@ with SIGHUP. */) void record_buffer (Lisp_Object buf) { - register Lisp_Object link, prev; + register Lisp_Object list, prev; Lisp_Object frame; frame = selected_frame; prev = Qnil; - for (link = Vbuffer_alist; CONSP (link); link = XCDR (link)) + for (list = Vbuffer_alist; CONSP (list); list = XCDR (list)) { - if (EQ (XCDR (XCAR (link)), buf)) + if (EQ (XCDR (XCAR (list)), buf)) break; - prev = link; + prev = list; } - /* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist); + /* Effectively do Vbuffer_alist = Fdelq (list, Vbuffer_alist); we cannot use Fdelq itself here because it allows quitting. */ if (NILP (prev)) @@ -1621,40 +1621,40 @@ record_buffer (Lisp_Object buf) else XSETCDR (prev, XCDR (XCDR (prev))); - XSETCDR (link, Vbuffer_alist); - Vbuffer_alist = link; + XSETCDR (list, Vbuffer_alist); + Vbuffer_alist = list; /* Effectively do a delq on buried_buffer_list. */ prev = Qnil; - for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); - link = XCDR (link)) + for (list = XFRAME (frame)->buried_buffer_list; CONSP (list); + list = XCDR (list)) { - if (EQ (XCAR (link), buf)) + if (EQ (XCAR (list), buf)) { if (NILP (prev)) - XFRAME (frame)->buried_buffer_list = XCDR (link); + XFRAME (frame)->buried_buffer_list = XCDR (list); else XSETCDR (prev, XCDR (XCDR (prev))); break; } - prev = link; + prev = list; } /* Now move this buffer to the front of frame_buffer_list also. */ prev = Qnil; - for (link = frame_buffer_list (frame); CONSP (link); - link = XCDR (link)) + for (list = frame_buffer_list (frame); CONSP (list); + list = XCDR (list)) { - if (EQ (XCAR (link), buf)) + if (EQ (XCAR (list), buf)) break; - prev = link; + prev = list; } /* Effectively do delq. */ - if (CONSP (link)) + if (CONSP (list)) { if (NILP (prev)) set_frame_buffer_list (frame, @@ -1662,8 +1662,8 @@ record_buffer (Lisp_Object buf) else XSETCDR (prev, XCDR (XCDR (prev))); - XSETCDR (link, frame_buffer_list (frame)); - set_frame_buffer_list (frame, link); + XSETCDR (list, frame_buffer_list (frame)); + set_frame_buffer_list (frame, list); } else set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame))); @@ -1984,13 +1984,13 @@ its frame, iconify that frame. */) buffer is killed. */ if (!NILP (BVAR (XBUFFER (buffer), name))) { - Lisp_Object aelt, link; + Lisp_Object aelt, list; aelt = Frassq (buffer, Vbuffer_alist); - link = Fmemq (aelt, Vbuffer_alist); + list = Fmemq (aelt, Vbuffer_alist); Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); - XSETCDR (link, Qnil); - Vbuffer_alist = nconc2 (Vbuffer_alist, link); + XSETCDR (list, Qnil); + Vbuffer_alist = nconc2 (Vbuffer_alist, list); XFRAME (selected_frame)->buffer_list = Fdelq (buffer, XFRAME (selected_frame)->buffer_list); @@ -2335,12 +2335,12 @@ current buffer is cleared. */) && GPT_BYTE > 1 && GPT_BYTE < Z_BYTE && ! CHAR_HEAD_P (*(GAP_END_ADDR))) { - unsigned char *p = GPT_ADDR - 1; + unsigned char *q = GPT_ADDR - 1; - while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--; - if (LEADING_CODE_P (*p)) + while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; + if (LEADING_CODE_P (*q)) { - EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - p); + EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q); move_gap_both (new_gpt, new_gpt); } @@ -2424,14 +2424,14 @@ current buffer is cleared. */) ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; { - EMACS_INT pt_byte = advance_to_char_boundary (PT_BYTE); - EMACS_INT pt; + EMACS_INT byte = advance_to_char_boundary (PT_BYTE); + EMACS_INT position; - if (pt_byte > GPT_BYTE) - pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT; + if (byte > GPT_BYTE) + position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; else - pt = chars_in_text (BEG_ADDR, pt_byte - BEG_BYTE) + BEG; - TEMP_SET_PT_BOTH (pt, pt_byte); + position = chars_in_text (BEG_ADDR, byte - BEG_BYTE) + BEG; + TEMP_SET_PT_BOTH (position, byte); } tail = markers = BUF_MARKERS (current_buffer); @@ -4322,10 +4322,10 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, for (i = 0; i < size;) { - Lisp_Object prop, overlay; - prop = copy[i++]; - overlay = copy[i++]; - call_overlay_mod_hooks (prop, overlay, after, arg1, arg2, arg3); + Lisp_Object prop_i, overlay_i; + prop_i = copy[i++]; + overlay_i = copy[i++]; + call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); } } UNGCPRO; -- cgit v1.2.1 From 5df8f01bab8c0bbc3391f41c54138d0a18973424 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:15:56 -0700 Subject: * buffer.c (fix_overlays_before): Mark locals as initialized. (fix_start_end_in_overlays): Likewise. This function should be simplified by using pointers-to-pointers, but that's a different matter. --- src/ChangeLog | 7 +++++++ src/buffer.c | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2c0e951c8df..fae7e8a29c9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-03-15 Paul Eggert + + * buffer.c (fix_overlays_before): Mark locals as initialized. + (fix_start_end_in_overlays): Likewise. This function should be + simplified by using pointers-to-pointers, but that's a different + matter. + 2011-03-14 Paul Eggert * buffer.c (switch_to_buffer_1): Now static. diff --git a/src/buffer.c b/src/buffer.c index 99b4650bb60..b718bf3e576 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -3398,7 +3398,8 @@ void fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) { Lisp_Object overlay; - struct Lisp_Overlay *before_list, *after_list; + struct Lisp_Overlay *before_list IF_LINT (= NULL); + struct Lisp_Overlay *after_list IF_LINT (= NULL); /* These are either nil, indicating that before_list or after_list should be assigned, or the cons cell the cdr of which should be assigned. */ @@ -3546,7 +3547,7 @@ fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos) /* If parent is nil, replace overlays_before; otherwise, parent->next. */ struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; Lisp_Object tem; - EMACS_INT end; + EMACS_INT end IF_LINT (= 0); /* After the insertion, the several overlays may be in incorrect order. The possibility is that, in the list `overlays_before', -- cgit v1.2.1 From 03d78a21befef9074bd85bba98968e9c25e022af Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:16:59 -0700 Subject: * filelock.c (within_one_second): Now static. --- src/ChangeLog | 2 ++ src/filelock.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fae7e8a29c9..25935defc9b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * filelock.c (within_one_second): Now static. + * buffer.c (fix_overlays_before): Mark locals as initialized. (fix_start_end_in_overlays): Likewise. This function should be simplified by using pointers-to-pointers, but that's a different diff --git a/src/filelock.c b/src/filelock.c index 7f8f0e1c0fb..0e4cee3c844 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -382,7 +382,7 @@ lock_file_1 (char *lfname, int force) /* Return 1 if times A and B are no more than one second apart. */ -int +static int within_one_second (time_t a, time_t b) { return (a - b >= -1 && a - b <= 1); -- cgit v1.2.1 From b3dd38aba98f3521d164ef698d6b77b80d867fb8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:19:50 -0700 Subject: * filelock.c (lock_file_1): Rename local to avoid shadowing. --- src/ChangeLog | 1 + src/filelock.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 25935defc9b..0f6bd3dab9c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-15 Paul Eggert * filelock.c (within_one_second): Now static. + (lock_file_1): Rename local to avoid shadowing. * buffer.c (fix_overlays_before): Mark locals as initialized. (fix_start_end_in_overlays): Likewise. This function should be diff --git a/src/filelock.c b/src/filelock.c index 0e4cee3c844..2138eaa502b 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -344,13 +344,13 @@ static int lock_file_1 (char *lfname, int force) { register int err; - time_t boot_time; + time_t boot; const char *user_name; const char *host_name; char *lock_info_str; /* Call this first because it can GC. */ - boot_time = get_boot_time (); + boot = get_boot_time (); if (STRINGP (Fuser_login_name (Qnil))) user_name = SSDATA (Fuser_login_name (Qnil)); @@ -363,9 +363,9 @@ lock_file_1 (char *lfname, int force) lock_info_str = (char *)alloca (strlen (user_name) + strlen (host_name) + LOCK_PID_MAX + 30); - if (boot_time) + if (boot) sprintf (lock_info_str, "%s@%s.%lu:%lu", user_name, host_name, - (unsigned long) getpid (), (unsigned long) boot_time); + (unsigned long) getpid (), (unsigned long) boot); else sprintf (lock_info_str, "%s@%s.%lu", user_name, host_name, (unsigned long) getpid ()); -- cgit v1.2.1 From 85876d07948fa6dba29b987c20eadd1b4c7aad1a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:22:56 -0700 Subject: * insdel.c (check_markers, make_gap_larger, make_gap_smaller): (reset_var_on_error, Fcombine_after_change_execute_1): Now static. --- src/ChangeLog | 3 +++ src/insdel.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0f6bd3dab9c..6717ce1489e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-15 Paul Eggert + * insdel.c (check_markers, make_gap_larger, make_gap_smaller): + (reset_var_on_error, Fcombine_after_change_execute_1): Now static. + * filelock.c (within_one_second): Now static. (lock_file_1): Rename local to avoid shadowing. diff --git a/src/insdel.c b/src/insdel.c index bdf6aff1717..a429ae6a1e3 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -74,7 +74,7 @@ Lisp_Object Qinhibit_modification_hooks; check_markers (); \ else -void +static void check_markers (void) { register struct Lisp_Marker *tail; @@ -451,7 +451,7 @@ adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte, /* Make the gap NBYTES_ADDED bytes longer. */ -void +static void make_gap_larger (EMACS_INT nbytes_added) { Lisp_Object tem; @@ -506,7 +506,7 @@ make_gap_larger (EMACS_INT nbytes_added) /* Make the gap NBYTES_REMOVED bytes shorter. */ -void +static void make_gap_smaller (EMACS_INT nbytes_removed) { Lisp_Object tem; @@ -2099,7 +2099,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, VARIABLE is the variable to maybe set to nil. NO-ERROR-FLAG is nil if there was an error, anything else meaning no error (so this function does nothing). */ -Lisp_Object +static Lisp_Object reset_var_on_error (Lisp_Object val) { if (NILP (XCDR (val))) @@ -2263,7 +2263,7 @@ signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins) unbind_to (count, Qnil); } -Lisp_Object +static Lisp_Object Fcombine_after_change_execute_1 (Lisp_Object val) { Vcombine_after_change_calls = val; -- cgit v1.2.1 From f0cb4a607918c065ebedfd62eb0187b0d49f67d6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:25:31 -0700 Subject: * insdel.c (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic. --- src/ChangeLog | 1 + src/insdel.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6717ce1489e..69d658eade2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * insdel.c (check_markers, make_gap_larger, make_gap_smaller): (reset_var_on_error, Fcombine_after_change_execute_1): Now static. + (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic. * filelock.c (within_one_second): Now static. (lock_file_1): Rename local to avoid shadowing. diff --git a/src/insdel.c b/src/insdel.c index a429ae6a1e3..18495e6c903 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -70,9 +70,12 @@ Lisp_Object combine_after_change_buffer; Lisp_Object Qinhibit_modification_hooks; #define CHECK_MARKERS() \ - if (check_markers_debug_flag) \ - check_markers (); \ - else + do \ + { \ + if (check_markers_debug_flag) \ + check_markers (); \ + } \ + while (0) static void check_markers (void) -- cgit v1.2.1 From 40ef059ee2a2cd7b4e3e75eef58c8ddcd2abb15f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:26:16 -0700 Subject: * insdel.c (copy_text): Remove unused local var. --- src/ChangeLog | 1 + src/insdel.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 69d658eade2..8bdf6881795 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * insdel.c (check_markers, make_gap_larger, make_gap_smaller): (reset_var_on_error, Fcombine_after_change_execute_1): Now static. (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic. + (copy_text): Remove unused local var. * filelock.c (within_one_second): Now static. (lock_file_1): Rename local to avoid shadowing. diff --git a/src/insdel.c b/src/insdel.c index 18495e6c903..ad3460f9a64 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -596,7 +596,6 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr, { EMACS_INT nchars = 0; EMACS_INT bytes_left = nbytes; - Lisp_Object tbl = Qnil; while (bytes_left > 0) { -- cgit v1.2.1 From b45db52287c1a23b2c639f4843395e4b5a4dbe92 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:32:33 -0700 Subject: * lisp.h (verify_bytepos, count_markers): New decls, so that gcc does not warn that these functions aren't declared. --- src/ChangeLog | 3 +++ src/lisp.h | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8bdf6881795..c438f1fb41a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-15 Paul Eggert + * lisp.h (verify_bytepos, count_markers): New decls, + so that gcc does not warn that these functions aren't declared. + * insdel.c (check_markers, make_gap_larger, make_gap_smaller): (reset_var_on_error, Fcombine_after_change_execute_1): Now static. (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic. diff --git a/src/lisp.h b/src/lisp.h index eacd68e42cb..3ba18186497 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2995,12 +2995,14 @@ extern EMACS_INT marker_byte_position (Lisp_Object); extern void clear_charpos_cache (struct buffer *); extern EMACS_INT charpos_to_bytepos (EMACS_INT); extern EMACS_INT buf_charpos_to_bytepos (struct buffer *, EMACS_INT); +extern EMACS_INT verify_bytepos (EMACS_INT charpos); extern EMACS_INT buf_bytepos_to_charpos (struct buffer *, EMACS_INT); extern void unchain_marker (struct Lisp_Marker *marker); extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT); extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT); +extern int count_markers (struct buffer *); extern void syms_of_marker (void); /* Defined in fileio.c */ -- cgit v1.2.1 From b4c3046a733bd68d98a13b0de6bfd3423e4d09ea Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:33:14 -0700 Subject: * marker.c (bytepos_to_charpos): Remove; unused. --- src/ChangeLog | 2 ++ src/marker.c | 12 +++--------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c438f1fb41a..bcc1f156e62 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * marker.c (bytepos_to_charpos): Remove; unused. + * lisp.h (verify_bytepos, count_markers): New decls, so that gcc does not warn that these functions aren't declared. diff --git a/src/marker.c b/src/marker.c index 72c564f420f..7d461099140 100644 --- a/src/marker.c +++ b/src/marker.c @@ -257,9 +257,10 @@ verify_bytepos (EMACS_INT charpos) return below_byte; } -/* bytepos_to_charpos returns the char position corresponding to BYTEPOS. */ +/* buf_bytepos_to_charpos returns the char position corresponding to + BYTEPOS. */ -/* This macro is a subroutine of bytepos_to_charpos. +/* This macro is a subroutine of buf_bytepos_to_charpos. It is used when BYTEPOS is actually the byte position. */ #define CONSIDER(BYTEPOS, CHARPOS) \ @@ -302,12 +303,6 @@ verify_bytepos (EMACS_INT charpos) } \ } -EMACS_INT -bytepos_to_charpos (EMACS_INT bytepos) -{ - return buf_bytepos_to_charpos (current_buffer, bytepos); -} - EMACS_INT buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos) { @@ -896,4 +891,3 @@ syms_of_marker (void) doc: /* Non-nil enables debugging checks in byte/char position conversions. */); byte_debug_flag = 0; } - -- cgit v1.2.1 From 5716756ee39eacd9bb08a20f46ac1424bf182f86 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:34:35 -0700 Subject: * minibuf.c (choose_minibuf_frame_1): Now static. --- src/ChangeLog | 2 ++ src/minibuf.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bcc1f156e62..6354508250e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * minibuf.c (choose_minibuf_frame_1): Now static. + * marker.c (bytepos_to_charpos): Remove; unused. * lisp.h (verify_bytepos, count_markers): New decls, diff --git a/src/minibuf.c b/src/minibuf.c index 83587b53b73..caf41115305 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -135,7 +135,7 @@ choose_minibuf_frame (void) } } -Lisp_Object +static Lisp_Object choose_minibuf_frame_1 (Lisp_Object ignore) { choose_minibuf_frame (); -- cgit v1.2.1 From 62137a95f36f5d8b1d43e805811c8f7a15cb8f44 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:39:30 -0700 Subject: * minibuf.c (Ftry_completion, Fall_completions): Rename or remove locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/minibuf.c | 42 ++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6354508250e..2fb5e03ca96 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2011-03-15 Paul Eggert * minibuf.c (choose_minibuf_frame_1): Now static. + (Ftry_completion, Fall_completions): Rename or remove locals + to avoid shadowing. * marker.c (bytepos_to_charpos): Remove; unused. diff --git a/src/minibuf.c b/src/minibuf.c index caf41115305..8ff861b2403 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1212,7 +1212,7 @@ is used to further constrain the set of candidates. */) && (!SYMBOLP (XCAR (collection)) || NILP (XCAR (collection))))) ? list_table : function_table)); - int index = 0, obsize = 0; + int idx = 0, obsize = 0; int matchcount = 0; int bindcount = -1; Lisp_Object bucket, zero, end, tem; @@ -1231,7 +1231,7 @@ is used to further constrain the set of candidates. */) { collection = check_obarray (collection); obsize = XVECTOR (collection)->size; - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; } while (1) @@ -1262,23 +1262,23 @@ is used to further constrain the set of candidates. */) else XSETFASTINT (bucket, 0); } - else if (++index >= obsize) + else if (++idx >= obsize) break; else { - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; continue; } } else /* if (type == hash_table) */ { - while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) - && NILP (HASH_HASH (XHASH_TABLE (collection), index))) - index++; - if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) + while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection)) + && NILP (HASH_HASH (XHASH_TABLE (collection), idx))) + idx++; + if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) break; else - elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); + elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); } /* Is this element a possible completion? */ @@ -1333,7 +1333,7 @@ is used to further constrain the set of candidates. */) tem = (type == hash_table ? call2 (predicate, elt, HASH_VALUE (XHASH_TABLE (collection), - index - 1)) + idx - 1)) : call1 (predicate, elt)); UNGCPRO; } @@ -1477,7 +1477,7 @@ with a space are ignored unless STRING itself starts with a space. */) : NILP (collection) || (CONSP (collection) && (!SYMBOLP (XCAR (collection)) || NILP (XCAR (collection)))); - int index = 0, obsize = 0; + int idx = 0, obsize = 0; int bindcount = -1; Lisp_Object bucket, tem, zero; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -1494,7 +1494,7 @@ with a space are ignored unless STRING itself starts with a space. */) { collection = check_obarray (collection); obsize = XVECTOR (collection)->size; - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; } while (1) @@ -1525,23 +1525,23 @@ with a space are ignored unless STRING itself starts with a space. */) else XSETFASTINT (bucket, 0); } - else if (++index >= obsize) + else if (++idx >= obsize) break; else { - bucket = XVECTOR (collection)->contents[index]; + bucket = XVECTOR (collection)->contents[idx]; continue; } } else /* if (type == 3) */ { - while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) - && NILP (HASH_HASH (XHASH_TABLE (collection), index))) - index++; - if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) + while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection)) + && NILP (HASH_HASH (XHASH_TABLE (collection), idx))) + idx++; + if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) break; else - elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); + elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); } /* Is this element a possible completion? */ @@ -1566,8 +1566,6 @@ with a space are ignored unless STRING itself starts with a space. */) { /* Yes. */ Lisp_Object regexps; - Lisp_Object zero; - XSETFASTINT (zero, 0); /* Ignore this element if it fails to match all the regexps. */ { @@ -1603,7 +1601,7 @@ with a space are ignored unless STRING itself starts with a space. */) GCPRO4 (tail, eltstring, allmatches, string); tem = type == 3 ? call2 (predicate, elt, - HASH_VALUE (XHASH_TABLE (collection), index - 1)) + HASH_VALUE (XHASH_TABLE (collection), idx - 1)) : call1 (predicate, elt); UNGCPRO; } -- cgit v1.2.1 From f14b7e14bb9284b6020431789ebc4c0dac1ef487 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 18:42:54 -0700 Subject: * fileio.c (file_name_as_directory, directory_file_name): (barf_or_query_if_file_exists, auto_save_error, auto_save_1): Now static. --- src/ChangeLog | 4 ++++ src/fileio.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2fb5e03ca96..1a7f0bbf7b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-15 Paul Eggert + * fileio.c (file_name_as_directory, directory_file_name): + (barf_or_query_if_file_exists, auto_save_error, auto_save_1): + Now static. + * minibuf.c (choose_minibuf_frame_1): Now static. (Ftry_completion, Fall_completions): Rename or remove locals to avoid shadowing. diff --git a/src/fileio.c b/src/fileio.c index 18e9dbe9680..e68fcbc65b5 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -433,7 +433,7 @@ get a current directory to run processes in. */) } -char * +static char * file_name_as_directory (char *out, char *in) { int size = strlen (in) - 1; @@ -496,7 +496,7 @@ For a Unix-syntax file name, just appends a slash. */) * Value is nonzero if the string output is different from the input. */ -int +static int directory_file_name (char *src, char *dst) { long slen; @@ -1734,7 +1734,7 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir) If QUICK is nonzero, we ask for y or n, not yes or no. */ -void +static void barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring, int interactive, struct stat *statptr, int quick) { @@ -5059,7 +5059,7 @@ An argument specifies the modification time value to use return Qnil; } -Lisp_Object +static Lisp_Object auto_save_error (Lisp_Object error) { Lisp_Object args[3], msg; @@ -5095,7 +5095,7 @@ auto_save_error (Lisp_Object error) return Qnil; } -Lisp_Object +static Lisp_Object auto_save_1 (void) { struct stat st; -- cgit v1.2.1 From 2893f1463d31f84556a78b1a714f2427064caf78 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 19:46:32 -0700 Subject: * fileio.c (file_name_as_directory): Use const pointers when appropriate. (Fexpand_file_name): Likewise. In particular, newdir might point at constant storage, so make it a const pointer. --- src/ChangeLog | 3 +++ src/fileio.c | 40 ++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1a7f0bbf7b0..9393cec02a9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,9 @@ * fileio.c (file_name_as_directory, directory_file_name): (barf_or_query_if_file_exists, auto_save_error, auto_save_1): Now static. + (file_name_as_directory): Use const pointers when appropriate. + (Fexpand_file_name): Likewise. In particular, newdir might + point at constant storage, so make it a const pointer. * minibuf.c (choose_minibuf_frame_1): Now static. (Ftry_completion, Fall_completions): Rename or remove locals diff --git a/src/fileio.c b/src/fileio.c index e68fcbc65b5..4b25d08f20d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -434,7 +434,7 @@ get a current directory to run processes in. */) static char * -file_name_as_directory (char *out, char *in) +file_name_as_directory (char *out, const char *in) { int size = strlen (in) - 1; @@ -728,7 +728,8 @@ filesystem tree, not (expand-file-name ".." dirname). */) { /* These point to SDATA and need to be careful with string-relocation during GC (via DECODE_FILE). */ - char *nm, *newdir; + char *nm; + const char *newdir; /* This should only point to alloca'd data. */ char *target; @@ -1013,21 +1014,23 @@ filesystem tree, not (expand-file-name ".." dirname). */) if (!newdir && drive) { /* Get default directory if needed to make nm absolute. */ + char *adir = NULL; if (!IS_DIRECTORY_SEP (nm[0])) { - newdir = alloca (MAXPATHLEN + 1); - if (!getdefdir (toupper (drive) - 'A' + 1, newdir)) - newdir = NULL; + adir = alloca (MAXPATHLEN + 1); + if (!getdefdir (toupper (drive) - 'A' + 1, adir)) + adir = NULL; } - if (!newdir) + if (!adir) { /* Either nm starts with /, or drive isn't mounted. */ - newdir = alloca (4); - newdir[0] = DRIVE_LETTER (drive); - newdir[1] = ':'; - newdir[2] = '/'; - newdir[3] = 0; + adir = alloca (4); + adir[0] = DRIVE_LETTER (drive); + adir[1] = ':'; + adir[2] = '/'; + adir[3] = 0; } + newdir = adir; } #endif /* DOS_NT */ @@ -1074,7 +1077,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) when we have pointers into lisp strings, we accomplish this indirectly by prepending newdir to nm if necessary, and using cwd (or the wd of newdir's drive) as the new newdir. */ - + char *adir; if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1])) { drive = (unsigned char) newdir[0]; @@ -1087,14 +1090,15 @@ filesystem tree, not (expand-file-name ".." dirname). */) strcat (tmp, nm); nm = tmp; } - newdir = alloca (MAXPATHLEN + 1); + adir = alloca (MAXPATHLEN + 1); if (drive) { - if (!getdefdir (toupper (drive) - 'A' + 1, newdir)) + if (!getdefdir (toupper (drive) - 'A' + 1, adir)) newdir = "/"; } else - getwd (newdir); + getwd (adir); + newdir = adir; } /* Strip off drive name from prefix, if present. */ @@ -1111,13 +1115,13 @@ filesystem tree, not (expand-file-name ".." dirname). */) #ifdef WINDOWSNT if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])) { - char *p; - newdir = strcpy (alloca (strlen (newdir) + 1), newdir); - p = newdir + 2; + char *adir = strcpy (alloca (strlen (newdir) + 1), newdir); + char *p = adir + 2; while (*p && !IS_DIRECTORY_SEP (*p)) p++; p++; while (*p && !IS_DIRECTORY_SEP (*p)) p++; *p = 0; + newdir = adir; } else #endif -- cgit v1.2.1 From fd4ead52062abcb8d8356595708229d83021f042 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 19:48:24 -0700 Subject: * fileio.c (Fmake_directory_internal, Fread_file_name): Remove unused vars. --- src/ChangeLog | 1 + src/fileio.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9393cec02a9..567fe22a941 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,6 +6,7 @@ (file_name_as_directory): Use const pointers when appropriate. (Fexpand_file_name): Likewise. In particular, newdir might point at constant storage, so make it a const pointer. + (Fmake_directory_internal, Fread_file_name): Remove unused vars. * minibuf.c (choose_minibuf_frame_1): Now static. (Ftry_completion, Fall_completions): Rename or remove locals diff --git a/src/fileio.c b/src/fileio.c index 4b25d08f20d..b99311445b3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2045,7 +2045,6 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal, (Lisp_Object directory) { const char *dir; - Lisp_Object handler; Lisp_Object encoded_dir; CHECK_STRING (directory); @@ -5430,7 +5429,7 @@ before any other event (mouse or keypress) is handled. */) Lisp_Object Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate) { - struct gcpro gcpro1, gcpro2; + struct gcpro gcpro1; Lisp_Object args[7]; GCPRO1 (default_filename); -- cgit v1.2.1 From b14aac08d08c5f17dc27e8d2cc1cc76b33e92c62 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 19:50:36 -0700 Subject: * fileio.c (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer signedness issues. --- src/ChangeLog | 2 ++ src/fileio.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 567fe22a941..aa21fb17c85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,8 @@ (Fexpand_file_name): Likewise. In particular, newdir might point at constant storage, so make it a const pointer. (Fmake_directory_internal, Fread_file_name): Remove unused vars. + (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer + signedness issues. * minibuf.c (choose_minibuf_frame_1): Now static. (Ftry_completion, Fall_completions): Rename or remove locals diff --git a/src/fileio.c b/src/fileio.c index b99311445b3..b4e28702029 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2756,7 +2756,7 @@ if file does not exist, is not accessible, or SELinux is disabled */) #if HAVE_LIBSELINUX if (is_selinux_enabled ()) { - conlength = lgetfilecon (SDATA (absname), &con); + conlength = lgetfilecon (SSDATA (absname), &con); if (conlength > 0) { context = context_new (con); @@ -2811,34 +2811,35 @@ is disabled. */) if (is_selinux_enabled ()) { /* Get current file context. */ - conlength = lgetfilecon (SDATA (encoded_absname), &con); + conlength = lgetfilecon (SSDATA (encoded_absname), &con); if (conlength > 0) { parsed_con = context_new (con); /* Change the parts defined in the parameter.*/ if (STRINGP (user)) { - if (context_user_set (parsed_con, SDATA (user))) + if (context_user_set (parsed_con, SSDATA (user))) error ("Doing context_user_set"); } if (STRINGP (role)) { - if (context_role_set (parsed_con, SDATA (role))) + if (context_role_set (parsed_con, SSDATA (role))) error ("Doing context_role_set"); } if (STRINGP (type)) { - if (context_type_set (parsed_con, SDATA (type))) + if (context_type_set (parsed_con, SSDATA (type))) error ("Doing context_type_set"); } if (STRINGP (range)) { - if (context_range_set (parsed_con, SDATA (range))) + if (context_range_set (parsed_con, SSDATA (range))) error ("Doing context_range_set"); } /* Set the modified context back to the file. */ - fail = lsetfilecon (SDATA (encoded_absname), context_str (parsed_con)); + fail = lsetfilecon (SSDATA (encoded_absname), + context_str (parsed_con)); if (fail) report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil)); -- cgit v1.2.1 From f839df0cf5882909c0f6424455abed586f125987 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 20:17:20 -0700 Subject: * fileio.c: (Fset_file_times, Finsert_file_contents, auto_save_error): Rename locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/fileio.c | 39 ++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index aa21fb17c85..c84c2397810 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,8 @@ (Fmake_directory_internal, Fread_file_name): Remove unused vars. (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer signedness issues. + (Fset_file_times, Finsert_file_contents, auto_save_error): + Rename locals to avoid shadowing. * minibuf.c (choose_minibuf_frame_1): Now static. (Ftry_completion, Fall_completions): Rename or remove locals diff --git a/src/fileio.c b/src/fileio.c index b4e28702029..826f2c18fbf 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2941,19 +2941,19 @@ The value is an integer. */) DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0, - doc: /* Set times of file FILENAME to TIME. + doc: /* Set times of file FILENAME to TIMESTAMP. Set both access and modification times. Return t on success, else nil. -Use the current time if TIME is nil. TIME is in the format of +Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of `current-time'. */) - (Lisp_Object filename, Lisp_Object time) + (Lisp_Object filename, Lisp_Object timestamp) { Lisp_Object absname, encoded_absname; Lisp_Object handler; time_t sec; int usec; - if (! lisp_time_argument (time, &sec, &usec)) + if (! lisp_time_argument (timestamp, &sec, &usec)) error ("Invalid time specification"); absname = Fexpand_file_name (filename, BVAR (current_buffer, directory)); @@ -2962,7 +2962,7 @@ Use the current time if TIME is nil. TIME is in the format of call the corresponding file handler. */ handler = Ffind_file_name_handler (absname, Qset_file_times); if (!NILP (handler)) - return call3 (handler, Qset_file_times, absname, time); + return call3 (handler, Qset_file_times, absname, timestamp); encoded_absname = ENCODE_FILE (absname); @@ -3358,13 +3358,13 @@ variable `last-coding-system-used' to the coding system actually used. */) else if (nread > 0) { struct buffer *prev = current_buffer; - Lisp_Object buffer; + Lisp_Object workbuf; struct buffer *buf; record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); - buffer = Fget_buffer_create (build_string (" *code-converting-work*")); - buf = XBUFFER (buffer); + workbuf = Fget_buffer_create (build_string (" *code-converting-work*")); + buf = XBUFFER (workbuf); delete_all_overlays (buf); BVAR (buf, directory) = BVAR (current_buffer, directory); @@ -3876,7 +3876,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (not_regular) { - Lisp_Object val; + Lisp_Object nbytes; /* Maybe make more room. */ if (gap_size < trytry) @@ -3891,15 +3891,16 @@ variable `last-coding-system-used' to the coding system actually used. */) non_regular_fd = fd; non_regular_inserted = inserted; non_regular_nbytes = trytry; - val = internal_condition_case_1 (read_non_regular, Qnil, Qerror, - read_non_regular_quit); - if (NILP (val)) + nbytes = internal_condition_case_1 (read_non_regular, + Qnil, Qerror, + read_non_regular_quit); + if (NILP (nbytes)) { read_quit = 1; break; } - this = XINT (val); + this = XINT (nbytes); } else { @@ -3990,7 +3991,7 @@ variable `last-coding-system-used' to the coding system actually used. */) care of marker adjustment. By this way, we can run Lisp program safely before decoding the inserted text. */ Lisp_Object unwind_data; - int count = SPECPDL_INDEX (); + int count1 = SPECPDL_INDEX (); unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), Fcons (BVAR (current_buffer, undo_list), @@ -4017,7 +4018,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (CONSP (coding_system)) coding_system = XCAR (coding_system); } - unbind_to (count, Qnil); + unbind_to (count1, Qnil); inserted = Z_BYTE - BEG_BYTE; } @@ -4120,7 +4121,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (inserted > 0) { /* Don't run point motion or modification hooks when decoding. */ - int count = SPECPDL_INDEX (); + int count1 = SPECPDL_INDEX (); EMACS_INT old_inserted = inserted; specbind (Qinhibit_point_motion_hooks, Qt); specbind (Qinhibit_modification_hooks, Qt); @@ -4232,7 +4233,7 @@ variable `last-coding-system-used' to the coding system actually used. */) Otherwise start with an empty undo_list. */ BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil; - unbind_to (count, Qnil); + unbind_to (count1, Qnil); } /* Call after-change hooks for the inserted text, aside from the case @@ -5064,7 +5065,7 @@ An argument specifies the modification time value to use } static Lisp_Object -auto_save_error (Lisp_Object error) +auto_save_error (Lisp_Object error_val) { Lisp_Object args[3], msg; int i, nbytes; @@ -5078,7 +5079,7 @@ auto_save_error (Lisp_Object error) args[0] = build_string ("Auto-saving %s: %s"); args[1] = BVAR (current_buffer, name); - args[2] = Ferror_message_string (error); + args[2] = Ferror_message_string (error_val); msg = Fformat (3, args); GCPRO1 (msg); nbytes = SBYTES (msg); -- cgit v1.2.1 From 4a6bea268fbac2fd64018374652f5b2c9b04b4fd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Mar 2011 20:59:26 -0700 Subject: * dired.c (directory_files_internal_unwind): Now static. --- src/ChangeLog | 2 ++ src/dired.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c84c2397810..7468af4c725 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * dired.c (directory_files_internal_unwind): Now static. + * fileio.c (file_name_as_directory, directory_file_name): (barf_or_query_if_file_exists, auto_save_error, auto_save_1): Now static. diff --git a/src/dired.c b/src/dired.c index d201418d78b..7891fc5f4a1 100644 --- a/src/dired.c +++ b/src/dired.c @@ -102,7 +102,7 @@ directory_files_internal_w32_unwind (Lisp_Object arg) } #endif -Lisp_Object +static Lisp_Object directory_files_internal_unwind (Lisp_Object dh) { DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; -- cgit v1.2.1 From 15206ed9236f4957cb62a0cfbd5397cf8f0cb76b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 00:04:00 -0700 Subject: Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254). An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in dired.c's scmp function, had undefined behavior. * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP): (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ... * buffer.h: ... to here, because these macros use current_buffer, and the new implementation with inline functions needs to have current_buffer in scope now, rather than later when the macros are used. (downcase, upcase1): New static inline functions. (DOWNCASE, UPCASE1): Reimplement using these functions. This avoids undefined behavior in expressions like DOWNCASE (x) == DOWNCASE (y), which previously suffered from race conditions in accessing the global variables case_temp1 and case_temp2. * casetab.c (case_temp1, case_temp2): Remove; no longer needed. * lisp.h (case_temp1, case_temp2): Remove their decls. * character.h (ASCII_CHAR_P): Move from here ... * lisp.h: ... to here, so that the inline functions mentioned above can use them. --- src/ChangeLog | 21 +++++++++++++++++++++ src/buffer.h | 43 +++++++++++++++++++++++++++++++++++++++++++ src/casetab.c | 6 ------ src/character.h | 3 --- src/lisp.h | 47 +++-------------------------------------------- 5 files changed, 67 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7468af4c725..7e873e3d85d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,26 @@ 2011-03-15 Paul Eggert + Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254). + An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in + dired.c's scmp function, had undefined behavior. + * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP): + (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ... + * buffer.h: ... to here, because these macros use current_buffer, + and the new implementation with inline functions needs to have + current_buffer in scope now, rather than later when the macros + are used. + (downcase, upcase1): New static inline functions. + (DOWNCASE, UPCASE1): Reimplement using these functions. + This avoids undefined behavior in expressions like + DOWNCASE (x) == DOWNCASE (y), which previously suffered + from race conditions in accessing the global variables + case_temp1 and case_temp2. + * casetab.c (case_temp1, case_temp2): Remove; no longer needed. + * lisp.h (case_temp1, case_temp2): Remove their decls. + * character.h (ASCII_CHAR_P): Move from here ... + * lisp.h: ... to here, so that the inline functions mentioned + above can use them. + * dired.c (directory_files_internal_unwind): Now static. * fileio.c (file_name_as_directory, directory_file_name): diff --git a/src/buffer.h b/src/buffer.h index 0975d2e3adc..996e4e59c27 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1026,4 +1026,47 @@ extern int last_per_buffer_idx; #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) + +/* Current buffer's map from characters to lower-case characters. */ + +#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table) + +/* Current buffer's map from characters to upper-case characters. */ + +#define UPCASE_TABLE BVAR (current_buffer, upcase_table) + +/* Downcase a character, or make no change if that cannot be done. */ + +static inline EMACS_INT +downcase (int ch) +{ + Lisp_Object down = CHAR_TABLE_REF (DOWNCASE_TABLE, ch); + return NATNUMP (down) ? XFASTINT (down) : ch; +} +#define DOWNCASE(CH) downcase (CH) + +/* 1 if CH is upper case. */ + +#define UPPERCASEP(CH) (DOWNCASE (CH) != (CH)) +/* 1 if CH is neither upper nor lower case. */ + +#define NOCASEP(CH) (UPCASE1 (CH) == (CH)) + +/* 1 if CH is lower case. */ + +#define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH)) + +/* Upcase a character, or make no change if that cannot be done. */ + +#define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH)) + +/* Upcase a character known to be not upper case. */ + +static inline EMACS_INT +upcase1 (int ch) +{ + Lisp_Object up = CHAR_TABLE_REF (UPCASE_TABLE, ch); + return NATNUMP (up) ? XFASTINT (up) : ch; +} +#define UPCASE1(CH) upcase1 (CH) diff --git a/src/casetab.c b/src/casetab.c index 5207e5315ae..56f6b065358 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -28,11 +28,6 @@ Lisp_Object Qcase_table_p, Qcase_table; Lisp_Object Vascii_downcase_table, Vascii_upcase_table; Lisp_Object Vascii_canon_table, Vascii_eqv_table; -/* Used as a temporary in DOWNCASE and other macros in lisp.h. No - need to mark it, since it is used only very temporarily. */ -int case_temp1; -Lisp_Object case_temp2; - static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt); static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt); static void shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt); @@ -302,4 +297,3 @@ syms_of_casetab (void) defsubr (&Sset_case_table); defsubr (&Sset_standard_case_table); } - diff --git a/src/character.h b/src/character.h index d29ab41557b..6d5b8110109 100644 --- a/src/character.h +++ b/src/character.h @@ -128,9 +128,6 @@ along with GNU Emacs. If not, see . */ XSETCDR ((x), tmp); \ } while (0) -/* Nonzero iff C is an ASCII character. */ -#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80) - /* Nonzero iff C is a character of code less than 0x100. */ #define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100) diff --git a/src/lisp.h b/src/lisp.h index 3ba18186497..15c13e0467b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -841,6 +841,9 @@ struct Lisp_Vector #endif /* not __GNUC__ */ +/* Nonzero iff C is an ASCII character. */ +#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80) + /* Almost equivalent to Faref (CT, IDX) with optimization for ASCII characters. Do not check validity of CT. */ #define CHAR_TABLE_REF(CT, IDX) \ @@ -2041,50 +2044,6 @@ extern int pending_signals; #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) -/* Variables used locally in the following case handling macros. */ -extern int case_temp1; -extern Lisp_Object case_temp2; - -/* Current buffer's map from characters to lower-case characters. */ - -#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table) - -/* Current buffer's map from characters to upper-case characters. */ - -#define UPCASE_TABLE BVAR (current_buffer, upcase_table) - -/* Downcase a character, or make no change if that cannot be done. */ - -#define DOWNCASE(CH) \ - ((case_temp1 = (CH), \ - case_temp2 = CHAR_TABLE_REF (DOWNCASE_TABLE, case_temp1), \ - NATNUMP (case_temp2)) \ - ? XFASTINT (case_temp2) : case_temp1) - -/* 1 if CH is upper case. */ - -#define UPPERCASEP(CH) (DOWNCASE (CH) != (CH)) - -/* 1 if CH is neither upper nor lower case. */ - -#define NOCASEP(CH) (UPCASE1 (CH) == (CH)) - -/* 1 if CH is lower case. */ - -#define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH)) - -/* Upcase a character, or make no change if that cannot be done. */ - -#define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH)) - -/* Upcase a character known to be not upper case. */ - -#define UPCASE1(CH) \ - ((case_temp1 = (CH), \ - case_temp2 = CHAR_TABLE_REF (UPCASE_TABLE, case_temp1), \ - NATNUMP (case_temp2)) \ - ? XFASTINT (case_temp2) : case_temp1) - extern Lisp_Object Vascii_downcase_table, Vascii_upcase_table; extern Lisp_Object Vascii_canon_table, Vascii_eqv_table; -- cgit v1.2.1 From 38b2c0769fbfc40162fc8c39170fcb28bcf69520 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 01:38:32 -0700 Subject: * dired.c (directory_files_internal, file_name_completion): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/dired.c | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7e873e3d85d..6355d81ba40 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-15 Paul Eggert + * dired.c (directory_files_internal, file_name_completion): + Rename locals to avoid shadowing. + Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254). An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in dired.c's scmp function, had undefined behavior. diff --git a/src/dired.c b/src/dired.c index 7891fc5f4a1..4080e1711e0 100644 --- a/src/dired.c +++ b/src/dired.c @@ -233,11 +233,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m int len; int wanted = 0; Lisp_Object name, finalname; - struct gcpro gcpro1, gcpro2; + struct gcpro inner_gcpro1, inner_gcpro2; len = NAMLEN (dp); name = finalname = make_unibyte_string (dp->d_name, len); - GCPRO2 (finalname, name); + GCPRO2_VAR (finalname, name, inner_gcpro); /* Note: DECODE_FILE can GC; it should protect its argument, though. */ @@ -293,23 +293,23 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m /* Construct an expanded filename for the directory entry. Use the decoded names for input to Ffile_attributes. */ Lisp_Object decoded_fullname, fileattrs; - struct gcpro gcpro1, gcpro2; + struct gcpro innermost_gcpro1, innermost_gcpro2; decoded_fullname = fileattrs = Qnil; - GCPRO2 (decoded_fullname, fileattrs); + GCPRO2_VAR (decoded_fullname, fileattrs, innermost_gcpro); /* Both Fexpand_file_name and Ffile_attributes can GC. */ decoded_fullname = Fexpand_file_name (name, directory); fileattrs = Ffile_attributes (decoded_fullname, id_format); list = Fcons (Fcons (finalname, fileattrs), list); - UNGCPRO; + UNGCPRO_VAR (innermost_gcpro); } else list = Fcons (finalname, list); } - UNGCPRO; + UNGCPRO_VAR (inner_gcpro); } } @@ -676,11 +676,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v if (!NILP (predicate)) { Lisp_Object val; - struct gcpro gcpro1; + struct gcpro inner_gcpro1; - GCPRO1 (name); + GCPRO1_VAR (name, inner_gcpro); val = call1 (predicate, name); - UNGCPRO; + UNGCPRO_VAR (inner_gcpro); if (NILP (val)) continue; @@ -702,16 +702,16 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v Lisp_Object zero = make_number (0); /* FIXME: This is a copy of the code in Ftry_completion. */ int compare = min (bestmatchsize, SCHARS (name)); - Lisp_Object tem + Lisp_Object cmp = Fcompare_strings (bestmatch, zero, make_number (compare), name, zero, make_number (compare), completion_ignore_case ? Qt : Qnil); int matchsize - = (EQ (tem, Qt) ? compare - : XINT (tem) < 0 ? - XINT (tem) - 1 - : XINT (tem) - 1); + = (EQ (cmp, Qt) ? compare + : XINT (cmp) < 0 ? - XINT (cmp) - 1 + : XINT (cmp) - 1); if (completion_ignore_case) { @@ -735,18 +735,18 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v (((matchsize == SCHARS (name)) == (matchsize + !!directoryp == SCHARS (bestmatch))) - && (tem = Fcompare_strings (name, zero, + && (cmp = Fcompare_strings (name, zero, make_number (SCHARS (file)), file, zero, Qnil, Qnil), - EQ (Qt, tem)) - && (tem = Fcompare_strings (bestmatch, zero, + EQ (Qt, cmp)) + && (cmp = Fcompare_strings (bestmatch, zero, make_number (SCHARS (file)), file, zero, Qnil, Qnil), - ! EQ (Qt, tem)))) + ! EQ (Qt, cmp)))) bestmatch = name; } bestmatchsize = matchsize; -- cgit v1.2.1 From 7082eac6799bba5ebd39417c40c810ed0672c7d9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 10:13:02 -0700 Subject: * lisp.h: New macros GCPRO2_VAR, GCPRO3_VAR, etc. --- src/ChangeLog | 9 +++ src/keyboard.c | 10 +-- src/lisp.h | 228 ++++++++++++++++++++++++++++++--------------------------- src/xfns.c | 8 +- 4 files changed, 139 insertions(+), 116 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6355d81ba40..40ba15de954 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2011-03-15 Paul Eggert + * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR): + New macros, so that the caller can use some names other than + gcpro1, gcpro2, etc. + (GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms + of the new macros. + (GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second + argument, for consistency with GCPRO2_VAR, etc: it is now the + prefix of the variable, not the variable itself. All uses + changed. * dired.c (directory_files_internal, file_name_completion): Rename locals to avoid shadowing. diff --git a/src/keyboard.c b/src/keyboard.c index 05b6abe97b3..2a2e24f3b1b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2942,7 +2942,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event keys = Fcopy_sequence (this_command_keys); else keys = Qnil; - GCPRO1_VAR (keys, inner_gcpro1); + GCPRO1_VAR (keys, inner_gcpro); /* Clear out this_command_keys. */ this_command_key_count = 0; @@ -2980,7 +2980,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (saved_immediate_echo) echo_now (); - UNGCPRO_VAR (inner_gcpro1); + UNGCPRO_VAR (inner_gcpro); /* The input method can return no events. */ if (! CONSP (tem)) @@ -8963,7 +8963,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, struct gcpro outer_gcpro1; - GCPRO1_VAR (fake_prefixed_keys, outer_gcpro1); + GCPRO1_VAR (fake_prefixed_keys, outer_gcpro); raw_keybuf_count = 0; last_nonmenu_event = Qnil; @@ -9258,7 +9258,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (EQ (key, Qt)) { unbind_to (count, Qnil); - UNGCPRO_VAR (outer_gcpro1); + UNGCPRO_VAR (outer_gcpro); return -1; } @@ -9941,7 +9941,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, add_command_key (keybuf[t]); } - UNGCPRO_VAR (outer_gcpro1); + UNGCPRO_VAR (outer_gcpro); return t; } diff --git a/src/lisp.h b/src/lisp.h index 15c13e0467b..ddaf0438b00 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2109,129 +2109,143 @@ struct gcpro || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS) -#define GCPRO1(varname) GCPRO1_VAR (varname, gcpro1) -#define UNGCPRO UNGCPRO_VAR (gcpro1) +#define GCPRO1(var) \ + GCPRO1_VAR (var, gcpro) +#define GCPRO2(var1, var2) \ + GCPRO2_VAR (var1, var2, gcpro) +#define GCPRO3(var1, var2, var3) \ + GCPRO3_VAR (var1, var2, var3, gcpro) +#define GCPRO4(var1, var2, var3, var4) \ + GCPRO4_VAR (var1, var2, var3, var4, gcpro) +#define GCPRO5(var1, var2, var3, var4, var5) \ + GCPRO5_VAR (var1, var2, var3, var4, var5, gcpro) +#define GCPRO6(var1, var2, var3, var4, var5, var6) \ + GCPRO6_VAR (var1, var2, var3, var4, var5, var6, gcpro) +#define UNGCPRO UNGCPRO_VAR (gcpro) #if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS /* Do something silly with gcproN vars just so gcc shuts up. */ /* You get warnings from MIPSPro... */ -#define GCPRO1_VAR(varname, gcpro1) ((void) gcpro1) -#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1)) -#define GCPRO3(varname1, varname2, varname3) \ - (((void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define GCPRO4(varname1, varname2, varname3, varname4) \ - (((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ - (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ - (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) -#define UNGCPRO_VAR(gcpro1) ((void) 0) +#define GCPRO1_VAR(var, gcpro) ((void) gcpro##1) +#define GCPRO2_VAR(var1, var2, gcpro) \ + ((void) gcpro##2, (void) gcpro##1) +#define GCPRO3_VAR(var1, var2, var3, gcpro) \ + ((void) gcpro##3, (void) gcpro##2, (void) gcpro##1) +#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \ + ((void) gcpro##4, (void) gcpro##3, (void) gcpro##2, (void) gcpro##1) +#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \ + ((void) gcpro##5, (void) gcpro##4, (void) gcpro##3, (void) gcpro##2, \ + (void) gcpro##1) +#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \ + ((void) gcpro##6, (void) gcpro##5, (void) gcpro##4, (void) gcpro##3, \ + (void) gcpro##2, (void) gcpro##1) +#define UNGCPRO_VAR(gcpro) ((void) 0) #else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ #ifndef DEBUG_GCPRO -#define GCPRO1_VAR(varname, gcpro1) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ - gcprolist = &gcpro1; } - -#define GCPRO2(varname1, varname2) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcprolist = &gcpro2; } - -#define GCPRO3(varname1, varname2, varname3) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcprolist = &gcpro3; } - -#define GCPRO4(varname1, varname2, varname3, varname4) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcprolist = &gcpro4; } - -#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcprolist = &gcpro5; } - -#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ - gcprolist = &gcpro6; } - -#define UNGCPRO_VAR(gcpro1) (gcprolist = gcpro1.next) +#define GCPRO1_VAR(var, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \ + gcprolist = &gcpro##1; } + +#define GCPRO2_VAR(var1, var2, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcprolist = &gcpro##2; } + +#define GCPRO3_VAR(var1, var2, var3, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcprolist = &gcpro##3; } + +#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcprolist = &gcpro##4; } + +#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcprolist = &gcpro##5; } + +#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \ + gcprolist = &gcpro##6; } + +#define UNGCPRO_VAR(gcpro) (gcprolist = gcpro##1.next) #else extern int gcpro_level; -#define GCPRO1_VAR(varname, gcpro1) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level++; \ - gcprolist = &gcpro1; } - -#define GCPRO2(varname1, varname2) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro2.level = gcpro_level++; \ - gcprolist = &gcpro2; } - -#define GCPRO3(varname1, varname2, varname3) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro3.level = gcpro_level++; \ - gcprolist = &gcpro3; } - -#define GCPRO4(varname1, varname2, varname3, varname4) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro4.level = gcpro_level++; \ - gcprolist = &gcpro4; } - -#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcpro5.level = gcpro_level++; \ - gcprolist = &gcpro5; } - -#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ - {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ - gcpro1.level = gcpro_level; \ - gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ - gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ - gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ - gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ - gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ - gcpro6.level = gcpro_level++; \ - gcprolist = &gcpro6; } - -#define UNGCPRO_VAR(gcpro1) \ - ((--gcpro_level != gcpro1.level) \ - ? (abort (), 0) \ - : ((gcprolist = gcpro1.next), 0)) +#define GCPRO1_VAR(var, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level++; \ + gcprolist = &gcpro##1; } + +#define GCPRO2_VAR(var1, var2, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##2.level = gcpro_level++; \ + gcprolist = &gcpro##2; } + +#define GCPRO3_VAR(var1, var2, var3, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##3.level = gcpro_level++; \ + gcprolist = &gcpro##3; } + +#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##4.level = gcpro_level++; \ + gcprolist = &gcpro##4; } + +#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcpro##5.level = gcpro_level++; \ + gcprolist = &gcpro##5; } + +#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \ + {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \ + gcpro##1.level = gcpro_level; \ + gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \ + gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \ + gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \ + gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \ + gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \ + gcpro##6.level = gcpro_level++; \ + gcprolist = &gcpro##6; } + +#define UNGCPRO_VAR(gcpro) \ + ((--gcpro_level != gcpro##1.level) \ + ? (abort (), 0) \ + : ((gcprolist = gcpro##1.next), 0)) #endif /* DEBUG_GCPRO */ #endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ diff --git a/src/xfns.c b/src/xfns.c index 3f0bd2a7d6a..e50d6887179 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3196,7 +3196,7 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_data.x->mouse_pixel = -1; black = build_string ("black"); - GCPRO1_VAR (black, inner_gcpro1); + GCPRO1_VAR (black, inner_gcpro); FRAME_FOREGROUND_PIXEL (f) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); FRAME_BACKGROUND_PIXEL (f) @@ -3209,7 +3209,7 @@ This function is an internal primitive--use `make-frame' instead. */) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); f->output_data.x->mouse_pixel = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); - UNGCPRO_VAR (inner_gcpro1); + UNGCPRO_VAR (inner_gcpro); } /* Specify the parent under which to make this X window. */ @@ -4664,7 +4664,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, f->output_data.x->mouse_pixel = -1; black = build_string ("black"); - GCPRO1_VAR (black, inner_gcpro1); + GCPRO1_VAR (black, inner_gcpro); FRAME_FOREGROUND_PIXEL (f) = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); FRAME_BACKGROUND_PIXEL (f) @@ -4677,7 +4677,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); f->output_data.x->mouse_pixel = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); - UNGCPRO_VAR (inner_gcpro1); + UNGCPRO_VAR (inner_gcpro); } /* Set the name; the functions to which we pass f expect the name to -- cgit v1.2.1 From 930d429ccc5c5526569a7b5816958a0605fc35df Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 10:16:01 -0700 Subject: * cmds.c (internal_self_insert): Rename local to avoid shadowing. --- src/ChangeLog | 2 ++ src/cmds.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 40ba15de954..bc2e0b972fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * cmds.c (internal_self_insert): Rename local to avoid shadowing. + * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR): New macros, so that the caller can use some names other than gcpro1, gcpro2, etc. diff --git a/src/cmds.c b/src/cmds.c index 5e6884c0807..fa1ac5028ae 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -485,18 +485,18 @@ internal_self_insert (int c, EMACS_INT n) : (c == ' ' || c == '\n')) && !NILP (BVAR (current_buffer, auto_fill_function))) { - Lisp_Object tem; + Lisp_Object auto_fill_result; if (c == '\n') /* After inserting a newline, move to previous line and fill that. Must have the newline in place already so filling and justification, if any, know where the end is going to be. */ SET_PT_BOTH (PT - 1, PT_BYTE - 1); - tem = call0 (BVAR (current_buffer, auto_fill_function)); + auto_fill_result = call0 (BVAR (current_buffer, auto_fill_function)); /* Test PT < ZV in case the auto-fill-function is strange. */ if (c == '\n' && PT < ZV) SET_PT_BOTH (PT + 1, PT_BYTE + 1); - if (!NILP (tem)) + if (!NILP (auto_fill_result)) hairy = 2; } -- cgit v1.2.1 From 181aa2be713f9d49a986e13228408c3f27943a47 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 10:16:14 -0700 Subject: * casefiddle.c (casify_object, casify_region): Now static. --- src/ChangeLog | 2 ++ src/casefiddle.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bc2e0b972fa..9187eb7c60e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * casefiddle.c (casify_object, casify_region): Now static. + * cmds.c (internal_self_insert): Rename local to avoid shadowing. * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR): diff --git a/src/casefiddle.c b/src/casefiddle.c index 26fa0db2d77..4ba323bf641 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -32,7 +32,7 @@ enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP}; Lisp_Object Qidentity; -Lisp_Object +static Lisp_Object casify_object (enum case_action flag, Lisp_Object obj) { register int c, c1; @@ -193,7 +193,7 @@ The argument object is not altered--the value is a copy. */) /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. b and e specify range of buffer to operate on. */ -void +static void casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) { register int c; -- cgit v1.2.1 From e45a141a5bab1fa5bc4c093eb2207d5d5c81e0f9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 10:18:02 -0700 Subject: * casefiddle.c (casify_region): Mark local as initialized. --- src/ChangeLog | 1 + src/casefiddle.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9187eb7c60e..1b44f7585d6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-15 Paul Eggert * casefiddle.c (casify_object, casify_region): Now static. + (casify_region): Mark local as initialized. * cmds.c (internal_self_insert): Rename local to avoid shadowing. diff --git a/src/casefiddle.c b/src/casefiddle.c index 4ba323bf641..d2c7e572125 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -201,7 +201,10 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); EMACS_INT start, end; EMACS_INT start_byte, end_byte; - EMACS_INT first = -1, last; /* Position of first and last changes. */ + + /* Position of first and last changes. */ + EMACS_INT first = -1, last IF_LINT (= 0); + EMACS_INT opoint = PT; EMACS_INT opoint_byte = PT_BYTE; -- cgit v1.2.1 From 85f24f61597cf8f38d5913e66a87c883f6a7690d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 10:57:31 -0700 Subject: * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width. All uses changed. (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion): Rename locals to avoid shadowing. --- src/ChangeLog | 5 +++++ src/indent.c | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1b44f7585d6..21a588a87da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-03-15 Paul Eggert + * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width. + All uses changed. + (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion): + Rename locals to avoid shadowing. + * casefiddle.c (casify_object, casify_region): Now static. (casify_region): Mark local as initialized. diff --git a/src/indent.c b/src/indent.c index 37ce647556d..d5e7671fa8c 100644 --- a/src/indent.c +++ b/src/indent.c @@ -274,20 +274,20 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob This macro is used in current_column_1, Fmove_to_column, and compute_motion. */ -#define MULTIBYTE_BYTES_WIDTH(p, dp) \ +#define MULTIBYTE_BYTES_WIDTH(p, dp, bytes, width) \ do { \ - int c; \ + int ch; \ \ wide_column = 0; \ - c = STRING_CHAR_AND_LENGTH (p, bytes); \ + ch = STRING_CHAR_AND_LENGTH (p, bytes); \ if (BYTES_BY_CHAR_HEAD (*p) != bytes) \ width = bytes * 4; \ else \ { \ - if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \ - width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; \ + if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ + width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ else \ - width = CHAR_WIDTH (c); \ + width = CHAR_WIDTH (ch); \ if (width > 1) \ wide_column = width; \ } \ @@ -569,14 +569,14 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) prev_col = col; { /* Check display property. */ - EMACS_INT end; - int width = check_display_width (scan, col, &end); + EMACS_INT endp; + int width = check_display_width (scan, col, &endp); if (width >= 0) { col += width; - if (end > scan) /* Avoid infinite loops with 0-width overlays. */ + if (endp > scan) /* Avoid infinite loops with 0-width overlays. */ { - scan = end; scan_byte = charpos_to_bytepos (scan); + scan = endp; scan_byte = charpos_to_bytepos (scan); continue; } } @@ -669,7 +669,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) int bytes, width, wide_column; ptr = BYTE_POS_ADDR (scan_byte); - MULTIBYTE_BYTES_WIDTH (ptr, dp); + MULTIBYTE_BYTES_WIDTH (ptr, dp, bytes, width); /* Subtract one to compensate for the increment that is going to happen below. */ scan_byte += bytes - 1; @@ -1657,15 +1657,15 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ { /* Start of multi-byte form. */ unsigned char *ptr; - int bytes, width, wide_column; + int mb_bytes, mb_width, wide_column; pos_byte--; /* rewind POS_BYTE */ ptr = BYTE_POS_ADDR (pos_byte); - MULTIBYTE_BYTES_WIDTH (ptr, dp); - pos_byte += bytes; + MULTIBYTE_BYTES_WIDTH (ptr, dp, mb_bytes, mb_width); + pos_byte += mb_bytes; if (wide_column) wide_column_end_hpos = hpos + wide_column; - hpos += width; + hpos += mb_width; } else if (VECTORP (charvec)) ++hpos; -- cgit v1.2.1 From 5671df8f51e552ca7d61296faf67b110b6a33235 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 10:59:31 -0700 Subject: * indent.c (Fvertical_motion): Mark locals as initialized. --- src/ChangeLog | 1 + src/indent.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 21a588a87da..9f5ed0a0c31 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ All uses changed. (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion): Rename locals to avoid shadowing. + (Fvertical_motion): Mark locals as initialized. * casefiddle.c (casify_object, casify_region): Now static. (casify_region): Mark local as initialized. diff --git a/src/indent.c b/src/indent.c index d5e7671fa8c..baea0641948 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1995,7 +1995,7 @@ whether or not it is currently displayed in some window. */) Lisp_Object old_buffer; struct gcpro gcpro1; Lisp_Object lcols = Qnil; - double cols; + double cols IF_LINT (= 0); /* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */ if (CONSP (lines) && (NUMBERP (XCAR (lines)))) @@ -2029,7 +2029,7 @@ whether or not it is currently displayed in some window. */) } else { - int it_start, first_x, it_overshoot_expected; + int it_start, first_x, it_overshoot_expected IF_LINT (= 0); SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); -- cgit v1.2.1 From 7e47afad4513977ba3cc5a175081f1c258a8ddfe Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:02:42 -0700 Subject: * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/character.h | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9f5ed0a0c31..d4f8061ed02 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing. + * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width. All uses changed. (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion): diff --git a/src/character.h b/src/character.h index 6d5b8110109..bbf5550c711 100644 --- a/src/character.h +++ b/src/character.h @@ -451,8 +451,8 @@ along with GNU Emacs. If not, see . */ #define INC_POS(pos_byte) \ do { \ - unsigned char *p = BYTE_POS_ADDR (pos_byte); \ - pos_byte += BYTES_BY_CHAR_HEAD (*p); \ + unsigned char *ptr = BYTE_POS_ADDR (pos_byte); \ + pos_byte += BYTES_BY_CHAR_HEAD (*ptr); \ } while (0) @@ -461,16 +461,16 @@ along with GNU Emacs. If not, see . */ #define DEC_POS(pos_byte) \ do { \ - unsigned char *p; \ + unsigned char *ptr; \ \ pos_byte--; \ if (pos_byte < GPT_BYTE) \ - p = BEG_ADDR + pos_byte - BEG_BYTE; \ + ptr = BEG_ADDR + pos_byte - BEG_BYTE; \ else \ - p = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE;\ - while (!CHAR_HEAD_P (*p)) \ + ptr = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ + while (!CHAR_HEAD_P (*ptr)) \ { \ - p--; \ + ptr--; \ pos_byte--; \ } \ } while (0) -- cgit v1.2.1 From dbd37a958fc17c793003ea95ad61ae51cff5ff45 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:08:06 -0700 Subject: * dired.c (compile_pattern): Move decl from here ... * lisp.h: ... to here, so that it can be checked. (struct re_registers): New forward decl. --- src/ChangeLog | 4 ++++ src/dired.c | 5 ----- src/lisp.h | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d4f8061ed02..ba863ba5710 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-15 Paul Eggert + * dired.c (compile_pattern): Move decl from here ... + * lisp.h: ... to here, so that it can be checked. + (struct re_registers): New forward decl. + * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing. * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width. diff --git a/src/dired.c b/src/dired.c index 4080e1711e0..3e2ce5e96a6 100644 --- a/src/dired.c +++ b/src/dired.c @@ -79,11 +79,6 @@ extern struct direct *readdir (DIR *); #include "regex.h" #include "blockinput.h" -/* Returns a search buffer, with a fastmap allocated and ready to go. */ -extern struct re_pattern_buffer *compile_pattern (Lisp_Object, - struct re_registers *, - Lisp_Object, int, int); - Lisp_Object Qdirectory_files; Lisp_Object Qdirectory_files_and_attributes; Lisp_Object Qfile_name_completion; diff --git a/src/lisp.h b/src/lisp.h index ddaf0438b00..ec45b83863b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3025,6 +3025,10 @@ EXFUN (Fset_match_data, 2); EXFUN (Fmatch_beginning, 1); EXFUN (Fmatch_end, 1); extern void record_unwind_save_match_data (void); +struct re_registers; +extern struct re_pattern_buffer *compile_pattern (Lisp_Object, + struct re_registers *, + Lisp_Object, int, int); extern int fast_string_match (Lisp_Object, Lisp_Object); extern int fast_c_string_match_ignore_case (Lisp_Object, const char *); extern int fast_string_match_ignore_case (Lisp_Object, Lisp_Object); -- cgit v1.2.1 From ded6f8f72e83259be778eae9411c1855ef3a0081 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:08:50 -0700 Subject: * search.c (simple_search): Remove unused var. --- src/ChangeLog | 2 ++ src/search.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ba863ba5710..a74b15aea6f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * search.c (simple_search): Remove unused var. + * dired.c (compile_pattern): Move decl from here ... * lisp.h: ... to here, so that it can be checked. (struct re_registers): New forward decl. diff --git a/src/search.c b/src/search.c index dceff94da72..dbc82bdb3d9 100644 --- a/src/search.c +++ b/src/search.c @@ -1554,7 +1554,6 @@ simple_search (EMACS_INT n, unsigned char *pat, while (this_len > 0) { - int charlen; int pat_ch, buf_ch; DEC_BOTH (this_pos, this_pos_byte); -- cgit v1.2.1 From 1f3561e4ca0b2338e162de9ae29caa814ae3a457 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:13:15 -0700 Subject: * search.c (boyer_moore): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. --- src/ChangeLog | 3 +++ src/character.h | 6 +++--- src/search.c | 16 ++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a74b15aea6f..9793b5692f8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-15 Paul Eggert + * search.c (boyer_moore): Rename locals to avoid shadowing. + * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. + * search.c (simple_search): Remove unused var. * dired.c (compile_pattern): Move decl from here ... diff --git a/src/character.h b/src/character.h index bbf5550c711..ad1577a5c90 100644 --- a/src/character.h +++ b/src/character.h @@ -377,10 +377,10 @@ along with GNU Emacs. If not, see . */ if (STRING_MULTIBYTE (STRING)) \ { \ unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ - int len; \ + int ptrlen; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (ptr, ptrlen); \ + BYTEIDX += ptrlen; \ } \ else \ { \ diff --git a/src/search.c b/src/search.c index dbc82bdb3d9..9869a7aad55 100644 --- a/src/search.c +++ b/src/search.c @@ -1725,17 +1725,17 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, /* Setup translate_prev_byte1/2/3/4 from CHAR_BASE. Only a byte following them are the target of translation. */ unsigned char str[MAX_MULTIBYTE_LENGTH]; - int len = CHAR_STRING (char_base, str); + int cblen = CHAR_STRING (char_base, str); - translate_prev_byte1 = str[len - 2]; - if (len > 2) + translate_prev_byte1 = str[cblen - 2]; + if (cblen > 2) { - translate_prev_byte2 = str[len - 3]; - if (len > 3) + translate_prev_byte2 = str[cblen - 3]; + if (cblen > 3) { - translate_prev_byte3 = str[len - 4]; - if (len > 4) - translate_prev_byte4 = str[len - 5]; + translate_prev_byte3 = str[cblen - 4]; + if (cblen > 4) + translate_prev_byte4 = str[cblen - 5]; } } } -- cgit v1.2.1 From 19ed5445872476a2728c7f9a4f0e99976f5e2e23 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:27:53 -0700 Subject: * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT): Rename locals to avoid shadowing. (regex_compile, re_match_2_internal): Move locals to avoid shadowing. --- src/ChangeLog | 4 ++ src/regex.c | 136 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 73 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9793b5692f8..73669e11c98 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-15 Paul Eggert + * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT): + Rename locals to avoid shadowing. + (regex_compile, re_match_2_internal): Move locals to avoid shadowing. + * search.c (boyer_moore): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. diff --git a/src/regex.c b/src/regex.c index 9284be95ffb..6babbfbed76 100644 --- a/src/regex.c +++ b/src/regex.c @@ -861,14 +861,14 @@ extract_number_and_incr (destination, source) do \ { \ re_wchar_t range_start, range_end; \ - re_char *p; \ + re_char *rtp; \ re_char *range_table_end \ = CHARSET_RANGE_TABLE_END ((range_table), (count)); \ \ - for (p = (range_table); p < range_table_end; p += 2 * 3) \ + for (rtp = (range_table); rtp < range_table_end; rtp += 2 * 3) \ { \ - EXTRACT_CHARACTER (range_start, p); \ - EXTRACT_CHARACTER (range_end, p + 3); \ + EXTRACT_CHARACTER (range_start, rtp); \ + EXTRACT_CHARACTER (range_end, rtp + 3); \ \ if (range_start <= (c) && (c) <= range_end) \ { \ @@ -1555,22 +1555,22 @@ do { \ /* Pop a saved register off the stack. */ #define POP_FAILURE_REG_OR_COUNT() \ do { \ - int reg = POP_FAILURE_INT (); \ - if (reg == -1) \ + int pfreg = POP_FAILURE_INT (); \ + if (pfreg == -1) \ { \ /* It's a counter. */ \ /* Here, we discard `const', making re_match non-reentrant. */ \ unsigned char *ptr = (unsigned char*) POP_FAILURE_POINTER (); \ - reg = POP_FAILURE_INT (); \ - STORE_NUMBER (ptr, reg); \ - DEBUG_PRINT3 (" Pop counter %p = %d\n", ptr, reg); \ + pfreg = POP_FAILURE_INT (); \ + STORE_NUMBER (ptr, pfreg); \ + DEBUG_PRINT3 (" Pop counter %p = %d\n", ptr, pfreg); \ } \ else \ { \ - regend[reg] = POP_FAILURE_POINTER (); \ - regstart[reg] = POP_FAILURE_POINTER (); \ + regend[pfreg] = POP_FAILURE_POINTER (); \ + regstart[pfreg] = POP_FAILURE_POINTER (); \ DEBUG_PRINT4 (" Pop reg %d (spanning %p -> %p)\n", \ - reg, regstart[reg], regend[reg]); \ + pfreg, regstart[pfreg], regend[pfreg]); \ } \ } while (0) @@ -2524,9 +2524,6 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct /* We fetch characters from PATTERN here. */ register re_wchar_t c, c1; - /* A random temporary spot in PATTERN. */ - re_char *p1; - /* Points to the end of the buffer, where we should append. */ register unsigned char *b; @@ -2894,6 +2891,8 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct case '[': { + re_char *p1; + CLEAR_RANGE_TABLE_WORK_USED (range_table_work); if (p == pend) FREE_STACK_RETURN (REG_EBRACK); @@ -5024,7 +5023,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int /* General temporaries. */ int mcnt; size_t reg; - boolean not; /* Just past the end of the corresponding string. */ re_char *end1, *end2; @@ -6005,46 +6003,48 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int case wordbound: case notwordbound: - not = (re_opcode_t) *(p - 1) == notwordbound; - DEBUG_PRINT2 ("EXECUTING %swordbound.\n", not?"not":""); + { + boolean not = (re_opcode_t) *(p - 1) == notwordbound; + DEBUG_PRINT2 ("EXECUTING %swordbound.\n", not?"not":""); - /* We SUCCEED (or FAIL) in one of the following cases: */ + /* We SUCCEED (or FAIL) in one of the following cases: */ - /* Case 1: D is at the beginning or the end of string. */ - if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) - not = !not; - else - { - /* C1 is the character before D, S1 is the syntax of C1, C2 - is the character at D, and S2 is the syntax of C2. */ - re_wchar_t c1, c2; - int s1, s2; - int dummy; + /* Case 1: D is at the beginning or the end of string. */ + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + not = !not; + else + { + /* C1 is the character before D, S1 is the syntax of C1, C2 + is the character at D, and S2 is the syntax of C2. */ + re_wchar_t c1, c2; + int s1, s2; + int dummy; #ifdef emacs - int offset = PTR_TO_OFFSET (d - 1); - int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); - UPDATE_SYNTAX_TABLE (charpos); + int offset = PTR_TO_OFFSET (d - 1); + int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + UPDATE_SYNTAX_TABLE (charpos); #endif - GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); - s1 = SYNTAX (c1); + GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); + s1 = SYNTAX (c1); #ifdef emacs - UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); + UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); #endif - PREFETCH_NOLIMIT (); - GET_CHAR_AFTER (c2, d, dummy); - s2 = SYNTAX (c2); - - if (/* Case 2: Only one of S1 and S2 is Sword. */ - ((s1 == Sword) != (s2 == Sword)) - /* Case 3: Both of S1 and S2 are Sword, and macro - WORD_BOUNDARY_P (C1, C2) returns nonzero. */ - || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) - not = !not; - } - if (not) - break; - else - goto fail; + PREFETCH_NOLIMIT (); + GET_CHAR_AFTER (c2, d, dummy); + s2 = SYNTAX (c2); + + if (/* Case 2: Only one of S1 and S2 is Sword. */ + ((s1 == Sword) != (s2 == Sword)) + /* Case 3: Both of S1 and S2 are Sword, and macro + WORD_BOUNDARY_P (C1, C2) returns nonzero. */ + || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) + not = !not; + } + if (not) + break; + else + goto fail; + } case wordbeg: DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); @@ -6224,27 +6224,29 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int case syntaxspec: case notsyntaxspec: - not = (re_opcode_t) *(p - 1) == notsyntaxspec; - mcnt = *p++; - DEBUG_PRINT3 ("EXECUTING %ssyntaxspec %d.\n", not?"not":"", mcnt); - PREFETCH (); -#ifdef emacs { - int offset = PTR_TO_OFFSET (d); - int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); - UPDATE_SYNTAX_TABLE (pos1); - } + boolean not = (re_opcode_t) *(p - 1) == notsyntaxspec; + mcnt = *p++; + DEBUG_PRINT3 ("EXECUTING %ssyntaxspec %d.\n", not?"not":"", mcnt); + PREFETCH (); +#ifdef emacs + { + int offset = PTR_TO_OFFSET (d); + int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); + UPDATE_SYNTAX_TABLE (pos1); + } #endif - { - int len; - re_wchar_t c; + { + int len; + re_wchar_t c; - GET_CHAR_AFTER (c, d, len); - if ((SYNTAX (c) != (enum syntaxcode) mcnt) ^ not) - goto fail; - d += len; + GET_CHAR_AFTER (c, d, len); + if ((SYNTAX (c) != (enum syntaxcode) mcnt) ^ not) + goto fail; + d += len; + } + break; } - break; #ifdef emacs case before_dot: -- cgit v1.2.1 From abbd1bcfeca309634cb602bc570f22e232846568 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:32:28 -0700 Subject: * regex.c: (regex_compile, re_search_2, re_match_2_internal): Remove unused local vars. --- src/ChangeLog | 2 ++ src/regex.c | 13 +++---------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 73669e11c98..2bcca8b0562 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,8 @@ * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT): Rename locals to avoid shadowing. (regex_compile, re_match_2_internal): Move locals to avoid shadowing. + (regex_compile, re_search_2, re_match_2_internal): + Remove unused local vars. * search.c (boyer_moore): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. diff --git a/src/regex.c b/src/regex.c index 6babbfbed76..e79316d6bc6 100644 --- a/src/regex.c +++ b/src/regex.c @@ -2571,9 +2571,6 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct /* If the object matched can contain multibyte characters. */ const boolean multibyte = RE_MULTIBYTE_P (bufp); - /* If a target of matching can contain multibyte characters. */ - const boolean target_multibyte = RE_TARGET_MULTIBYTE_P (bufp); - /* Nonzero if we have pushed down into a subpattern. */ int in_subpattern = 0; @@ -2928,7 +2925,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct { boolean escaped_char = false; const unsigned char *p2 = p; - re_wchar_t ch, c2; + re_wchar_t ch; if (p == pend) FREE_STACK_RETURN (REG_EBRACK); @@ -2991,10 +2988,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct them). */ if (c == ':' && *p == ']') { - re_wctype_t cc; - int limit; - - cc = re_wctype (str); + re_wctype_t cc = re_wctype (str); if (cc == 0) FREE_STACK_RETURN (REG_ECTYPE); @@ -4558,7 +4552,6 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const if (multibyte) { re_char *p = POS_ADDR_VSTRING (startpos); - re_char *pend = STOP_ADDR_VSTRING (startpos); int len = BYTES_BY_CHAR_HEAD (*p); range -= len; @@ -5462,7 +5455,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int else do { - int pat_charlen, buf_charlen; + int pat_charlen; int pat_ch, buf_ch; PREFETCH (); -- cgit v1.2.1 From 8fb3179241c11eef948f612d959521ac31af1560 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:37:02 -0700 Subject: * regex.c (re_match_2_internals): Fix one more "not". --- src/regex.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/regex.c b/src/regex.c index e79316d6bc6..0187a103b32 100644 --- a/src/regex.c +++ b/src/regex.c @@ -5613,8 +5613,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int if (!not) goto fail; d += len; - break; } + break; /* The beginning of a group is represented by start_memory. @@ -6238,8 +6238,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int goto fail; d += len; } - break; } + break; #ifdef emacs case before_dot: @@ -6262,18 +6262,21 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int case categoryspec: case notcategoryspec: - not = (re_opcode_t) *(p - 1) == notcategoryspec; - mcnt = *p++; - DEBUG_PRINT3 ("EXECUTING %scategoryspec %d.\n", not?"not":"", mcnt); - PREFETCH (); { - int len; - re_wchar_t c; + boolean not = (re_opcode_t) *(p - 1) == notcategoryspec; + mcnt = *p++; + DEBUG_PRINT3 ("EXECUTING %scategoryspec %d.\n", + not?"not":"", mcnt); + PREFETCH (); - GET_CHAR_AFTER (c, d, len); - if ((!CHAR_HAS_CATEGORY (c, mcnt)) ^ not) - goto fail; - d += len; + { + int len; + re_wchar_t c; + GET_CHAR_AFTER (c, d, len); + if ((!CHAR_HAS_CATEGORY (c, mcnt)) ^ not) + goto fail; + d += len; + } } break; -- cgit v1.2.1 From 0e48bb227a5b9cdabeb845422de33d62ccb1edc5 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 15 Mar 2011 19:38:57 +0100 Subject: * src/coding.c (detect_coding_iso_2022): Reorganize code to clarify structure. --- src/ChangeLog | 5 ++ src/coding.c | 159 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 85 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a1538d8f3f7..72585209c24 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-15 Andreas Schwab + + * coding.c (detect_coding_iso_2022): Reorganize code to clarify + structure. + 2011-03-14 Juanma Barranquero * lisp.h (VWindow_system, Qfile_name_history): diff --git a/src/coding.c b/src/coding.c index 9a6a4484e50..0c2836c19f6 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2954,12 +2954,7 @@ detect_coding_iso_2022 (struct coding_system *coding, const unsigned char *src_end = coding->source + coding->src_bytes; int multibytep = coding->src_multibyte; int single_shifting = 0; - - /* FIXME: Does ID need to be initialized here? The "End of composition" - code below does not initialize ID even though ID is used - afterwards, and perhaps that is a bug. */ - int id = 0; - + int id; int c, c1; int consumed_chars = 0; int i; @@ -2999,40 +2994,11 @@ detect_coding_iso_2022 (struct coding_system *coding, break; single_shifting = 0; ONE_MORE_BYTE (c); - if (c >= '(' && c <= '/') - { - /* Designation sequence for a charset of dimension 1. */ - ONE_MORE_BYTE (c1); - if (c1 < ' ' || c1 >= 0x80 - || (id = iso_charset_table[0][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; - } - else if (c == '$') - { - /* Designation sequence for a charset of dimension 2. */ - ONE_MORE_BYTE (c); - if (c >= '@' && c <= 'B') - /* Designation for JISX0208.1978, GB2312, or JISX0208. */ - id = iso_charset_table[1][0][c]; - else if (c >= '(' && c <= '/') - { - ONE_MORE_BYTE (c1); - if (c1 < ' ' || c1 >= 0x80 - || (id = iso_charset_table[1][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; - } - else - /* Invalid designation sequence. Just ignore it. */ - break; - } - else if (c == 'N' || c == 'O') + if (c == 'N' || c == 'O') { /* ESC for SS2 or SS3. */ single_shifting = 1; rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_8BIT; - break; } else if (c == '1') { @@ -3048,36 +3014,66 @@ detect_coding_iso_2022 (struct coding_system *coding, { /* ESC for start/end composition. */ composition_count = 0; - break; } else { - /* Invalid escape sequence. Just ignore it. */ - break; - } + if (c >= '(' && c <= '/') + { + /* Designation sequence for a charset of dimension 1. */ + ONE_MORE_BYTE (c1); + if (c1 < ' ' || c1 >= 0x80 + || (id = iso_charset_table[0][c >= ','][c1]) < 0) + /* Invalid designation sequence. Just ignore. */ + break; + } + else if (c == '$') + { + /* Designation sequence for a charset of dimension 2. */ + ONE_MORE_BYTE (c); + if (c >= '@' && c <= 'B') + /* Designation for JISX0208.1978, GB2312, or JISX0208. */ + id = iso_charset_table[1][0][c]; + else if (c >= '(' && c <= '/') + { + ONE_MORE_BYTE (c1); + if (c1 < ' ' || c1 >= 0x80 + || (id = iso_charset_table[1][c >= ','][c1]) < 0) + /* Invalid designation sequence. Just ignore. */ + break; + } + else + /* Invalid designation sequence. Just ignore it. */ + break; + } + else + { + /* Invalid escape sequence. Just ignore it. */ + break; + } - /* We found a valid designation sequence for CHARSET. */ - rejected |= CATEGORY_MASK_ISO_8BIT; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7], - id)) - found |= CATEGORY_MASK_ISO_7; - else - rejected |= CATEGORY_MASK_ISO_7; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_tight], - id)) - found |= CATEGORY_MASK_ISO_7_TIGHT; - else - rejected |= CATEGORY_MASK_ISO_7_TIGHT; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_else], - id)) - found |= CATEGORY_MASK_ISO_7_ELSE; - else - rejected |= CATEGORY_MASK_ISO_7_ELSE; - if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_8_else], - id)) - found |= CATEGORY_MASK_ISO_8_ELSE; - else - rejected |= CATEGORY_MASK_ISO_8_ELSE; + /* We found a valid designation sequence for CHARSET. */ + rejected |= CATEGORY_MASK_ISO_8BIT; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7], + id)) + found |= CATEGORY_MASK_ISO_7; + else + rejected |= CATEGORY_MASK_ISO_7; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_tight], + id)) + found |= CATEGORY_MASK_ISO_7_TIGHT; + else + rejected |= CATEGORY_MASK_ISO_7_TIGHT; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_else], + id)) + found |= CATEGORY_MASK_ISO_7_ELSE; + else + rejected |= CATEGORY_MASK_ISO_7_ELSE; + if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_8_else], + id)) + found |= CATEGORY_MASK_ISO_8_ELSE; + else + rejected |= CATEGORY_MASK_ISO_8_ELSE; + } break; case ISO_CODE_SO: @@ -3105,13 +3101,32 @@ detect_coding_iso_2022 (struct coding_system *coding, rejected |= CATEGORY_MASK_ISO_7BIT; if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) & CODING_ISO_FLAG_SINGLE_SHIFT) - found |= CATEGORY_MASK_ISO_8_1, single_shifting = 1; + { + found |= CATEGORY_MASK_ISO_8_1; + single_shifting = 1; + } if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2]) & CODING_ISO_FLAG_SINGLE_SHIFT) - found |= CATEGORY_MASK_ISO_8_2, single_shifting = 1; + { + found |= CATEGORY_MASK_ISO_8_2; + single_shifting = 1; + } if (single_shifting) break; - goto check_extra_latin; + check_extra_latin: + if (! VECTORP (Vlatin_extra_code_table) + || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) + { + rejected = CATEGORY_MASK_ISO; + break; + } + if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) + & CODING_ISO_FLAG_LATIN_EXTRA) + found |= CATEGORY_MASK_ISO_8_1; + else + rejected |= CATEGORY_MASK_ISO_8_1; + rejected |= CATEGORY_MASK_ISO_8_2; + break; default: if (c < 0) @@ -3162,20 +3177,6 @@ detect_coding_iso_2022 (struct coding_system *coding, } break; } - check_extra_latin: - single_shifting = 0; - if (! VECTORP (Vlatin_extra_code_table) - || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) - { - rejected = CATEGORY_MASK_ISO; - break; - } - if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) - & CODING_ISO_FLAG_LATIN_EXTRA) - found |= CATEGORY_MASK_ISO_8_1; - else - rejected |= CATEGORY_MASK_ISO_8_1; - rejected |= CATEGORY_MASK_ISO_8_2; } } detect_info->rejected |= CATEGORY_MASK_ISO; -- cgit v1.2.1 From 952db0d7ad3872dd675d23f7e60ae3298a8d8d52 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:40:00 -0700 Subject: * regex.c (FREE_VAR): Rewrite so as not to use empty "else", which gcc can warn about. --- src/ChangeLog | 2 ++ src/regex.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2bcca8b0562..e533b07d41a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,8 @@ (regex_compile, re_match_2_internal): Move locals to avoid shadowing. (regex_compile, re_search_2, re_match_2_internal): Remove unused local vars. + (FREE_VAR): Rewrite so as not to use empty "else", + which gcc can warn about. * search.c (boyer_moore): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. diff --git a/src/regex.c b/src/regex.c index 0187a103b32..9c950a42b22 100644 --- a/src/regex.c +++ b/src/regex.c @@ -4666,7 +4666,14 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, /* Free everything we malloc. */ #ifdef MATCH_MAY_ALLOCATE -# define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else +# define FREE_VAR(var) \ + do { \ + if (var) \ + { \ + REGEX_FREE (var); \ + var = NULL; \ + } \ + } while (0) # define FREE_VARIABLES() \ do { \ REGEX_FREE_STACK (fail_stack.stack); \ -- cgit v1.2.1 From da053e48b16db6fa8dedd72d9d7f80c392259193 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:43:04 -0700 Subject: * regex.c (regex_compile, re_match_2_internal): Mark locals as initialized. --- src/ChangeLog | 1 + src/regex.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e533b07d41a..2ebe327e326 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,7 @@ Remove unused local vars. (FREE_VAR): Rewrite so as not to use empty "else", which gcc can warn about. + (regex_compile, re_match_2_internal): Mark locals as initialized. * search.c (boyer_moore): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. diff --git a/src/regex.c b/src/regex.c index 9c950a42b22..6c6aa03e437 100644 --- a/src/regex.c +++ b/src/regex.c @@ -2576,9 +2576,9 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct /* These hold the values of p, pattern, and pend from the main pattern when we have pushed into a subpattern. */ - re_char *main_p; - re_char *main_pattern; - re_char *main_pend; + re_char *main_p IF_LINT (= NULL); + re_char *main_pattern IF_LINT (= NULL); + re_char *main_pend IF_LINT (= NULL); #ifdef DEBUG debug++; @@ -5533,7 +5533,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int /* Start of actual range_table, or end of bitmap if there is no range table. */ - re_char *range_table; + re_char *range_table IF_LINT (= NULL); /* Nonzero if there is a range table. */ int range_table_exists; -- cgit v1.2.1 From b313f9d86378db4dd4619923572b07513c53ceac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 11:53:29 -0700 Subject: * regex.c (RETALLOC_IF): Define only if needed. (WORDCHAR_P): Likewise. This one is never needed, but is used only in a comment talking about a compiler bug, so put inside the #if 0 of that comment. (CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK): (PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING): Remove; unused. --- src/ChangeLog | 7 +++++++ src/regex.c | 55 ++++++++++++------------------------------------------- 2 files changed, 19 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2ebe327e326..706612da945 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,13 @@ (FREE_VAR): Rewrite so as not to use empty "else", which gcc can warn about. (regex_compile, re_match_2_internal): Mark locals as initialized. + (RETALLOC_IF): Define only if needed. + (WORDCHAR_P): Likewise. This one is never needed, but is used + only in a comment talking about a compiler bug, so put inside + the #if 0 of that comment. + (CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK): + (PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING): + Remove; unused. * search.c (boyer_moore): Rename locals to avoid shadowing. * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. diff --git a/src/regex.c b/src/regex.c index 6c6aa03e437..4194ccc7c00 100644 --- a/src/regex.c +++ b/src/regex.c @@ -551,8 +551,6 @@ init_syntax_once (void) /* (Re)Allocate N items of type T using malloc, or fail. */ #define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) #define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) -#define RETALLOC_IF(addr, n, t) \ - if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t) #define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) #define BYTEWIDTH 8 /* In bits. */ @@ -843,11 +841,6 @@ extract_number_and_incr (destination, source) ((p)[2 + CHARSET_BITMAP_SIZE (p)] \ + (p)[3 + CHARSET_BITMAP_SIZE (p)] * 0x100) -/* Test if C is listed in the bitmap of charset P. */ -#define CHARSET_LOOKUP_BITMAP(p, c) \ - ((c) < CHARSET_BITMAP_SIZE (p) * BYTEWIDTH \ - && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH))) - /* Return the address of end of RANGE_TABLE. COUNT is number of ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' is start of range and end of range. `* 3' is size of each start @@ -1413,7 +1406,6 @@ typedef struct } fail_stack_type; #define FAIL_STACK_EMPTY() (fail_stack.frame == 0) -#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size) /* Define macros to initialize and free the failure stack. @@ -1433,8 +1425,6 @@ typedef struct fail_stack.avail = 0; \ fail_stack.frame = 0; \ } while (0) - -# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack) #else # define INIT_FAIL_STACK() \ do { \ @@ -1442,7 +1432,8 @@ typedef struct fail_stack.frame = 0; \ } while (0) -# define RESET_FAIL_STACK() ((void)0) +# define RETALLOC_IF(addr, n, t) \ + if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t) #endif @@ -1495,17 +1486,10 @@ typedef struct #define PUSH_FAILURE_INT(item) \ fail_stack.stack[fail_stack.avail++].integer = (item) -/* Push a fail_stack_elt_t value onto the failure stack. - Assumes the variable `fail_stack'. Probably should only - be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_ELT(item) \ - fail_stack.stack[fail_stack.avail++] = (item) - -/* These three POP... operations complement the three PUSH... operations. +/* These POP... operations complement the PUSH... operations. All assume that `fail_stack' is nonempty. */ #define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer #define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer -#define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail] /* Individual items aside from the registers. */ #define NUM_NONREG_ITEMS 3 @@ -1765,16 +1749,6 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend, } while (0) -/* As with BUF_PUSH_2, except for three bytes. */ -#define BUF_PUSH_3(c1, c2, c3) \ - do { \ - GET_BUFFER_SPACE (3); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ - *b++ = (unsigned char) (c3); \ - } while (0) - - /* Store a jump with opcode OP at LOC to location TO. We store a relative address offset by the three bytes the jump itself occupies. */ #define STORE_JUMP(op, loc, to) \ @@ -4322,10 +4296,6 @@ WEAK_ALIAS (__re_search, re_search) #define HEAD_ADDR_VSTRING(P) \ (((P) >= size1 ? string2 : string1)) -/* End address of virtual concatenation of string. */ -#define STOP_ADDR_VSTRING(P) \ - (((P) >= size1 ? string2 + size2 : string1 + size1)) - /* Address of POS in the concatenation of virtual string. */ #define POS_ADDR_VSTRING(POS) \ (((POS) >= size1 ? string2 - size1 : string1) + (POS)) @@ -4636,16 +4606,6 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) #define AT_STRINGS_END(d) ((d) == end2) - -/* Test if D points to a character which is word-constituent. We have - two special cases to check for: if past the end of string1, look at - the first character in string2; and if before the beginning of - string2, look at the last character in string1. */ -#define WORDCHAR_P(d) \ - (SYNTAX ((d) == end1 ? *string2 \ - : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ - == Sword) - /* Disabled due to a compiler bug -- see comment at case wordbound */ /* The comment at case wordbound is following one, but we don't use @@ -4657,6 +4617,15 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, macro and introducing temporary variables works around the bug. */ #if 0 +/* Test if D points to a character which is word-constituent. We have + two special cases to check for: if past the end of string1, look at + the first character in string2; and if before the beginning of + string2, look at the last character in string1. */ +#define WORDCHAR_P(d) \ + (SYNTAX ((d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ + == Sword) + /* Test if the character before D and the one at D differ with respect to being word-constituent. */ #define AT_WORD_BOUNDARY(d) \ -- cgit v1.2.1 From 5da9919f99ebacbc511113134ef8f687a562d5b8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 14:14:06 -0700 Subject: Use functions, not macros, for up- and down-casing. --- src/buffer.h | 58 ++++++++++++++++++++------------------------------------ src/casefiddle.c | 22 ++++++++++----------- src/dired.c | 4 ++-- src/editfns.c | 10 +++++----- src/fileio.c | 2 +- src/keyboard.c | 8 ++++---- src/process.c | 2 +- src/regex.c | 4 ++-- src/search.c | 4 ++-- 9 files changed, 49 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/buffer.h b/src/buffer.h index 996e4e59c27..d80875a0811 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1027,46 +1027,30 @@ extern int last_per_buffer_idx; #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) -/* Current buffer's map from characters to lower-case characters. */ - -#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table) - -/* Current buffer's map from characters to upper-case characters. */ - -#define UPCASE_TABLE BVAR (current_buffer, upcase_table) - -/* Downcase a character, or make no change if that cannot be done. */ - -static inline EMACS_INT -downcase (int ch) +/* Downcase a character C, or make no change if that cannot be done. */ +static inline int +downcase (int c) { - Lisp_Object down = CHAR_TABLE_REF (DOWNCASE_TABLE, ch); - return NATNUMP (down) ? XFASTINT (down) : ch; + Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); + Lisp_Object down = CHAR_TABLE_REF (downcase_table, c); + return NATNUMP (down) ? XFASTINT (down) : c; } -#define DOWNCASE(CH) downcase (CH) - -/* 1 if CH is upper case. */ - -#define UPPERCASEP(CH) (DOWNCASE (CH) != (CH)) - -/* 1 if CH is neither upper nor lower case. */ -#define NOCASEP(CH) (UPCASE1 (CH) == (CH)) +/* 1 if C is upper case. */ +static inline int uppercasep (int c) { return downcase (c) != c; } -/* 1 if CH is lower case. */ - -#define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH)) - -/* Upcase a character, or make no change if that cannot be done. */ - -#define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH)) - -/* Upcase a character known to be not upper case. */ - -static inline EMACS_INT -upcase1 (int ch) +/* Upcase a character C known to be not upper case. */ +static inline int +upcase1 (int c) { - Lisp_Object up = CHAR_TABLE_REF (UPCASE_TABLE, ch); - return NATNUMP (up) ? XFASTINT (up) : ch; + Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); + Lisp_Object up = CHAR_TABLE_REF (upcase_table, c); + return NATNUMP (up) ? XFASTINT (up) : c; } -#define UPCASE1(CH) upcase1 (CH) + +/* 1 if C is lower case. */ +static inline int lowercasep (int c) +{ return !uppercasep (c) && upcase1 (c) != c; } + +/* Upcase a character C, or make no change if that cannot be done. */ +static inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } diff --git a/src/casefiddle.c b/src/casefiddle.c index d2c7e572125..43ecd38dc7d 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -64,13 +64,13 @@ casify_object (enum case_action flag, Lisp_Object obj) multibyte = 1; if (! multibyte) MAKE_CHAR_MULTIBYTE (c1); - c = DOWNCASE (c1); + c = downcase (c1); if (inword) XSETFASTINT (obj, c | flags); else if (c == (XFASTINT (obj) & ~flagbits)) { if (! inword) - c = UPCASE1 (c1); + c = upcase1 (c1); if (! multibyte) MAKE_CHAR_UNIBYTE (c); XSETFASTINT (obj, c | flags); @@ -92,10 +92,10 @@ casify_object (enum case_action flag, Lisp_Object obj) MAKE_CHAR_MULTIBYTE (c); c1 = c; if (inword && flag != CASE_CAPITALIZE_UP) - c = DOWNCASE (c); - else if (!UPPERCASEP (c) + c = downcase (c); + else if (!uppercasep (c) && (!inword || flag != CASE_CAPITALIZE_UP)) - c = UPCASE1 (c1); + c = upcase1 (c1); if ((int) flag >= (int) CASE_CAPITALIZE) inword = (SYNTAX (c) == Sword); if (c != c1) @@ -133,10 +133,10 @@ casify_object (enum case_action flag, Lisp_Object obj) } c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); if (inword && flag != CASE_CAPITALIZE_UP) - c = DOWNCASE (c); - else if (!UPPERCASEP (c) + c = downcase (c); + else if (!uppercasep (c) && (!inword || flag != CASE_CAPITALIZE_UP)) - c = UPCASE1 (c); + c = upcase1 (c); if ((int) flag >= (int) CASE_CAPITALIZE) inword = (SYNTAX (c) == Sword); o += CHAR_STRING (c, o); @@ -243,10 +243,10 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) } c2 = c; if (inword && flag != CASE_CAPITALIZE_UP) - c = DOWNCASE (c); - else if (!UPPERCASEP (c) + c = downcase (c); + else if (!uppercasep (c) && (!inword || flag != CASE_CAPITALIZE_UP)) - c = UPCASE1 (c); + c = upcase1 (c); if ((int) flag >= (int) CASE_CAPITALIZE) inword = ((SYNTAX (c) == Sword) && (inword || !syntax_prefix_flag_p (c))); diff --git a/src/dired.c b/src/dired.c index 3e2ce5e96a6..176f14925b4 100644 --- a/src/dired.c +++ b/src/dired.c @@ -790,8 +790,8 @@ scmp (const char *s1, const char *s2, int len) if (completion_ignore_case) { while (l - && (DOWNCASE ((unsigned char) *s1++) - == DOWNCASE ((unsigned char) *s2++))) + && (downcase ((unsigned char) *s1++) + == downcase ((unsigned char) *s2++))) l--; } else diff --git a/src/editfns.c b/src/editfns.c index d92d3482d09..59cf269ef7b 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1374,7 +1374,7 @@ name, or nil if there is no such user. */) memcpy (r, p, q - p); r[q - p] = 0; strcat (r, SSDATA (login)); - r[q - p] = UPCASE ((unsigned char) r[q - p]); + r[q - p] = upcase ((unsigned char) r[q - p]); strcat (r, q + 1); full = build_string (r); } @@ -4213,7 +4213,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) { int i1, i2; /* Check they're chars, not just integers, otherwise we could get array - bounds violations in DOWNCASE. */ + bounds violations in downcase. */ CHECK_CHARACTER (c1); CHECK_CHARACTER (c2); @@ -4224,7 +4224,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) /* Do these in separate statements, then compare the variables. - because of the way DOWNCASE uses temp variables. */ + because of the way downcase uses temp variables. */ i1 = XFASTINT (c1); if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! ASCII_CHAR_P (i1)) @@ -4237,8 +4237,8 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) { MAKE_CHAR_MULTIBYTE (i2); } - i1 = DOWNCASE (i1); - i2 = DOWNCASE (i2); + i1 = downcase (i1); + i2 = downcase (i2); return (i1 == i2 ? Qt : Qnil); } diff --git a/src/fileio.c b/src/fileio.c index 826f2c18fbf..5d33fb93878 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -178,7 +178,7 @@ report_file_error (const char *string, Lisp_Object data) str = SSDATA (errstring); c = STRING_CHAR ((unsigned char *) str); - Faset (errstring, make_number (0), make_number (DOWNCASE (c))); + Faset (errstring, make_number (0), make_number (downcase (c))); } xsignal (Qfile_error, diff --git a/src/keyboard.c b/src/keyboard.c index 2a2e24f3b1b..fc8622de0a1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9836,7 +9836,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t && INTEGERP (key) && ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK)) - && UPPERCASEP (XINT (key) & ~CHAR_MODIFIER_MASK)) + && uppercasep (XINT (key) & ~CHAR_MODIFIER_MASK)) || (XINT (key) & shift_modifier))) { Lisp_Object new_key; @@ -9847,7 +9847,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (XINT (key) & shift_modifier) XSETINT (new_key, XINT (key) & ~shift_modifier); else - XSETINT (new_key, (DOWNCASE (XINT (key) & ~CHAR_MODIFIER_MASK) + XSETINT (new_key, (downcase (XINT (key) & ~CHAR_MODIFIER_MASK) | (XINT (key) & CHAR_MODIFIER_MASK))); /* We have to do this unconditionally, regardless of whether @@ -9875,13 +9875,13 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, || (INTEGERP (key) && (KEY_TO_CHAR (key) < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size) - && UPPERCASEP (KEY_TO_CHAR (key)))) + && uppercasep (KEY_TO_CHAR (key)))) { Lisp_Object new_key = (modifiers & shift_modifier ? apply_modifiers (modifiers & ~shift_modifier, XCAR (breakdown)) - : make_number (DOWNCASE (KEY_TO_CHAR (key)) | modifiers)); + : make_number (downcase (KEY_TO_CHAR (key)) | modifiers)); original_uppercase = key; original_uppercase_position = t - 1; diff --git a/src/process.c b/src/process.c index c8f329c244b..7bfd2a3258a 100644 --- a/src/process.c +++ b/src/process.c @@ -495,7 +495,7 @@ status_message (struct Lisp_Process *p) string = (code_convert_string_norecord (string, Vlocale_coding_system, 0)); c1 = STRING_CHAR (SDATA (string)); - c2 = DOWNCASE (c1); + c2 = downcase (c1); if (c1 != c2) Faset (string, make_number (0), make_number (c2)); } diff --git a/src/regex.c b/src/regex.c index 4194ccc7c00..e6d0da96312 100644 --- a/src/regex.c +++ b/src/regex.c @@ -340,7 +340,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; || ((c) >= 'A' && (c) <= 'Z')) \ : SYNTAX (c) == Sword) -# define ISLOWER(c) (LOWERCASEP (c)) +# define ISLOWER(c) lowercasep (c) # define ISPUNCT(c) (IS_REAL_ASCII (c) \ ? ((c) > ' ' && (c) < 0177 \ @@ -351,7 +351,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; # define ISSPACE(c) (SYNTAX (c) == Swhitespace) -# define ISUPPER(c) (UPPERCASEP (c)) +# define ISUPPER(c) uppercasep (c) # define ISWORD(c) (SYNTAX (c) == Sword) diff --git a/src/search.c b/src/search.c index 9869a7aad55..bf93a7fe442 100644 --- a/src/search.c +++ b/src/search.c @@ -2469,7 +2469,7 @@ since only regular expressions have distinguished subexpressions. */) else FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, pos, pos_byte); - if (LOWERCASEP (c)) + if (lowercasep (c)) { /* Cannot be all caps if any original char is lower case */ @@ -2479,7 +2479,7 @@ since only regular expressions have distinguished subexpressions. */) else some_multiletter_word = 1; } - else if (UPPERCASEP (c)) + else if (uppercasep (c)) { some_uppercase = 1; if (SYNTAX (prevc) != Sword) -- cgit v1.2.1 From 880433015d01974c015718f73c203ad36e47139b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 14:22:21 -0700 Subject: Add ChangeLog entry for previous change. --- src/ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 706612da945..a02d1473b4c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2011-03-15 Paul Eggert + Use functions, not macros, for up- and down-casing (Bug#8254). + * buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP): + (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed + to use the following functions instead of these macros. + (downcase): Adjust to lack of DOWNCASE_TABLE. Return int, not + EMACS_INT, since callers assume the returned value fits in int. + (upcase1): Likewise, for UPCASE_TABLE. + (uppercasep, lowercasep, upcase): New static inline functions. + * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT): Rename locals to avoid shadowing. (regex_compile, re_match_2_internal): Move locals to avoid shadowing. -- cgit v1.2.1 From 0da09c43ea240c1f07e1f9c2e9f40cd9fcbb862f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 14:23:02 -0700 Subject: * editfns.c (Fchar_equal): Remove no-longer-needed workaround for the race-condition problem the old DOWNCASE. --- src/ChangeLog | 2 ++ src/editfns.c | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a02d1473b4c..6cacc4576fb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,8 @@ EMACS_INT, since callers assume the returned value fits in int. (upcase1): Likewise, for UPCASE_TABLE. (uppercasep, lowercasep, upcase): New static inline functions. + * editfns.c (Fchar_equal): Remove no-longer-needed workaround for + the race-condition problem the old DOWNCASE. * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT): Rename locals to avoid shadowing. diff --git a/src/editfns.c b/src/editfns.c index 59cf269ef7b..8d428eb4815 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4222,9 +4222,6 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) if (NILP (BVAR (current_buffer, case_fold_search))) return Qnil; - /* Do these in separate statements, - then compare the variables. - because of the way downcase uses temp variables. */ i1 = XFASTINT (c1); if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! ASCII_CHAR_P (i1)) @@ -4237,9 +4234,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) { MAKE_CHAR_MULTIBYTE (i2); } - i1 = downcase (i1); - i2 = downcase (i2); - return (i1 == i2 ? Qt : Qnil); + return (downcase (i1) == downcase (i2) ? Qt : Qnil); } /* Transpose the markers in two regions of the current buffer, and -- cgit v1.2.1 From db69b0cde386ed1e4cc928f5beb916107ee9fc88 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 14:23:54 -0700 Subject: Fix typo in ChangeLog. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6cacc4576fb..91d5069d559 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,7 +9,7 @@ (upcase1): Likewise, for UPCASE_TABLE. (uppercasep, lowercasep, upcase): New static inline functions. * editfns.c (Fchar_equal): Remove no-longer-needed workaround for - the race-condition problem the old DOWNCASE. + the race-condition problem in the old DOWNCASE. * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT): Rename locals to avoid shadowing. -- cgit v1.2.1 From 4da60324405c45ce25b1de07c959b411463336db Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 14:33:24 -0700 Subject: * regex.c (IF_LINT): Add defn, for benefit of ../lib-src. --- src/ChangeLog | 2 ++ src/regex.c | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 91d5069d559..2ebee67dba2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-15 Paul Eggert + * regex.c (IF_LINT): Add defn, for benefit of ../lib-src. + Use functions, not macros, for up- and down-casing (Bug#8254). * buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP): (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed diff --git a/src/regex.c b/src/regex.c index e6d0da96312..a60ff0ce35c 100644 --- a/src/regex.c +++ b/src/regex.c @@ -1267,6 +1267,13 @@ print_double_string (where, string1, size1, string2, size2) #endif /* not DEBUG */ +/* Use this to suppress gcc's `...may be used before initialized' warnings. */ +#ifdef lint +# define IF_LINT(Code) Code +#else +# define IF_LINT(Code) /* empty */ +#endif + /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own syntax, so it can be changed between regex compilations. */ -- cgit v1.2.1 From 76ef09b7c8407733a7e55dd1b14e7807ba83ae5b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 14:37:03 -0700 Subject: * character.h (PREV_CHAR_BOUNDARY): Rename local to avoid shadowing. --- src/ChangeLog | 3 ++- src/character.h | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2ebee67dba2..aa03ad660b7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -30,7 +30,8 @@ Remove; unused. * search.c (boyer_moore): Rename locals to avoid shadowing. - * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. + * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): + (PREV_CHAR_BOUNDARY): Likewise. * search.c (simple_search): Remove unused var. diff --git a/src/character.h b/src/character.h index ad1577a5c90..f0b0002032e 100644 --- a/src/character.h +++ b/src/character.h @@ -278,11 +278,11 @@ along with GNU Emacs. If not, see . */ do { \ if ((p) > (limit)) \ { \ - const unsigned char *p0 = (p); \ + const unsigned char *pcb = (p); \ do { \ - p0--; \ - } while (p0 >= limit && ! CHAR_HEAD_P (*p0)); \ - (p) = (BYTES_BY_CHAR_HEAD (*p0) == (p) - p0) ? p0 : (p) - 1; \ + pcb--; \ + } while (pcb >= limit && ! CHAR_HEAD_P (*pcb)); \ + (p) = (BYTES_BY_CHAR_HEAD (*pcb) == (p) - pcb) ? pcb : (p) - 1; \ } \ } while (0) -- cgit v1.2.1 From e5aab7e74931e4b4b0fd21abf4a6ea5b7f5134f4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 14:56:37 -0700 Subject: * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this avoids undefined behavior in theory. --- src/ChangeLog | 4 ++++ src/alloc.c | 4 ++-- src/lisp.h | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index aa03ad660b7..d34e3478255 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-15 Paul Eggert + * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. + * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this + avoids undefined behavior in theory. + * regex.c (IF_LINT): Add defn, for benefit of ../lib-src. Use functions, not macros, for up- and down-casing (Bug#8254). diff --git a/src/alloc.c b/src/alloc.c index d6b64de5af9..1ad8af0d61a 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2653,17 +2653,17 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, return val; } +#ifdef GC_CHECK_CONS_LIST /* Get an error now if there's any junk in the cons free list. */ void check_cons_list (void) { -#ifdef GC_CHECK_CONS_LIST struct Lisp_Cons *tail = cons_free_list; while (tail) tail = tail->u.chain; -#endif } +#endif /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ diff --git a/src/lisp.h b/src/lisp.h index ec45b83863b..79f3b2f980b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -27,9 +27,10 @@ along with GNU Emacs. If not, see . */ types of run time checks for Lisp objects. */ #ifdef GC_CHECK_CONS_LIST -#define CHECK_CONS_LIST() check_cons_list() +extern void check_cons_list (void); +#define CHECK_CONS_LIST() check_cons_list () #else -#define CHECK_CONS_LIST() ((void)0) +#define CHECK_CONS_LIST() ((void) 0) #endif /* These are default choices for the types to use. */ -- cgit v1.2.1 From ae35e7564b5fc774798d5e9494123a2ff0522885 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 15:02:48 -0700 Subject: * alloc.c: (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/alloc.c | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d34e3478255..15b6cba0278 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,9 @@ 2011-03-15 Paul Eggert * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. + (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): + Rename locals to avoid shadowing. + * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this avoids undefined behavior in theory. diff --git a/src/alloc.c b/src/alloc.c index 1ad8af0d61a..6f379ef35f9 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2903,15 +2903,15 @@ See also the function `vector'. */) { Lisp_Object vector; register EMACS_INT sizei; - register EMACS_INT index; + register EMACS_INT i; register struct Lisp_Vector *p; CHECK_NATNUM (length); sizei = XFASTINT (length); p = allocate_vector (sizei); - for (index = 0; index < sizei; index++) - p->contents[index] = init; + for (i = 0; i < sizei; i++) + p->contents[i] = init; XSETVECTOR (vector, p); return vector; @@ -2925,14 +2925,14 @@ usage: (vector &rest OBJECTS) */) (register int nargs, Lisp_Object *args) { register Lisp_Object len, val; - register int index; + register int i; register struct Lisp_Vector *p; XSETFASTINT (len, nargs); val = Fmake_vector (len, Qnil); p = XVECTOR (val); - for (index = 0; index < nargs; index++) - p->contents[index] = args[index]; + for (i = 0; i < nargs; i++) + p->contents[i] = args[i]; return val; } @@ -2947,7 +2947,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT (register int nargs, Lisp_Object *args) { register Lisp_Object len, val; - register int index; + register int i; register struct Lisp_Vector *p; XSETFASTINT (len, nargs); @@ -2965,11 +2965,11 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT args[1] = Fstring_as_unibyte (args[1]); p = XVECTOR (val); - for (index = 0; index < nargs; index++) + for (i = 0; i < nargs; i++) { if (!NILP (Vpurify_flag)) - args[index] = Fpurecopy (args[index]); - p->contents[index] = args[index]; + args[i] = Fpurecopy (args[i]); + p->contents[i] = args[i]; } XSETPVECTYPE (p, PVEC_COMPILED); XSETCOMPILED (val, p); @@ -5063,18 +5063,18 @@ returns nil, because real GC can't be done. */) if (FLOATP (Vgc_cons_percentage)) { /* Set gc_cons_combined_threshold. */ - EMACS_INT total = 0; - - total += total_conses * sizeof (struct Lisp_Cons); - total += total_symbols * sizeof (struct Lisp_Symbol); - total += total_markers * sizeof (union Lisp_Misc); - total += total_string_size; - total += total_vector_size * sizeof (Lisp_Object); - total += total_floats * sizeof (struct Lisp_Float); - total += total_intervals * sizeof (struct interval); - total += total_strings * sizeof (struct Lisp_String); - - gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage); + EMACS_INT tot = 0; + + tot += total_conses * sizeof (struct Lisp_Cons); + tot += total_symbols * sizeof (struct Lisp_Symbol); + tot += total_markers * sizeof (union Lisp_Misc); + tot += total_string_size; + tot += total_vector_size * sizeof (Lisp_Object); + tot += total_floats * sizeof (struct Lisp_Float); + tot += total_intervals * sizeof (struct interval); + tot += total_strings * sizeof (struct Lisp_String); + + gc_relative_threshold = tot * XFLOAT_DATA (Vgc_cons_percentage); } else gc_relative_threshold = 0; @@ -5123,9 +5123,9 @@ returns nil, because real GC can't be done. */) if (!NILP (Vpost_gc_hook)) { - int count = inhibit_garbage_collection (); + int gc_count = inhibit_garbage_collection (); safe_run_hooks (Qpost_gc_hook); - unbind_to (count, Qnil); + unbind_to (gc_count, Qnil); } /* Accumulate statistics. */ -- cgit v1.2.1 From dff45157417d1620c4fb7b6c117cc89142009b69 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 15:09:50 -0700 Subject: * alloc.c (mark_stack): Move local variables into the #ifdef region where they're used. --- src/ChangeLog | 2 ++ src/alloc.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 15b6cba0278..34fdc1473be 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,8 @@ * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): Rename locals to avoid shadowing. + (mark_stack): Move local variables into the #ifdef region where + they're used. * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this avoids undefined behavior in theory. diff --git a/src/alloc.c b/src/alloc.c index 6f379ef35f9..fd1334a6ef7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4312,12 +4312,6 @@ static void mark_stack (void) { int i; - /* jmp_buf may not be aligned enough on darwin-ppc64 */ - union aligned_jmpbuf { - Lisp_Object o; - jmp_buf j; - } j; - volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; void *end; #ifdef HAVE___BUILTIN_UNWIND_INIT @@ -4327,6 +4321,14 @@ mark_stack (void) __builtin_unwind_init (); end = &end; #else /* not HAVE___BUILTIN_UNWIND_INIT */ +#ifndef GC_SAVE_REGISTERS_ON_STACK + /* jmp_buf may not be aligned enough on darwin-ppc64 */ + union aligned_jmpbuf { + Lisp_Object o; + jmp_buf j; + } j; + volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; +#endif /* This trick flushes the register windows so that all the state of the process is contained in the stack. */ /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is -- cgit v1.2.1 From 7bc26fdb5c3b50b29bff966a55394e730fbfadd8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 15:31:22 -0700 Subject: * alloc.c (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not needed otherwise. (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS. (GC_STRING_CHARS): Remove; not used. --- src/ChangeLog | 5 +++++ src/alloc.c | 15 +++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 34fdc1473be..9f8c2166364 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,11 @@ Rename locals to avoid shadowing. (mark_stack): Move local variables into the #ifdef region where they're used. + (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if + ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not + needed otherwise. + (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS. + (GC_STRING_CHARS): Remove; not used. * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this avoids undefined behavior in theory. diff --git a/src/alloc.c b/src/alloc.c index fd1334a6ef7..7fa2790cb1e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -92,7 +92,8 @@ extern __malloc_size_t __malloc_extra_blocks; #endif /* not DOUG_LEA_MALLOC */ -#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) +#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT +#ifdef HAVE_GTK_AND_PTHREAD /* When GTK uses the file chooser dialog, different backends can be loaded dynamically. One such a backend is the Gnome VFS backend that gets loaded @@ -130,12 +131,13 @@ static pthread_mutex_t alloc_mutex; } \ while (0) -#else /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ +#else /* ! defined HAVE_GTK_AND_PTHREAD */ #define BLOCK_INPUT_ALLOC BLOCK_INPUT #define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT -#endif /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ +#endif /* ! defined HAVE_GTK_AND_PTHREAD */ +#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ /* Value of _bytes_used, when spare_memory was freed. */ @@ -152,13 +154,11 @@ static __malloc_size_t bytes_used_when_full; #define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG) #define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0) -/* Value is the number of bytes/chars of S, a pointer to a struct - Lisp_String. This must be used instead of STRING_BYTES (S) or - S->size during GC, because S->size contains the mark bit for +/* Value is the number of bytes of S, a pointer to a struct Lisp_String. + Be careful during GC, because S->size contains the mark bit for strings. */ #define GC_STRING_BYTES(S) (STRING_BYTES (S)) -#define GC_STRING_CHARS(S) ((S)->size & ~ARRAY_MARK_FLAG) /* Global variables. */ struct emacs_globals globals; @@ -5306,7 +5306,6 @@ mark_object (Lisp_Object arg) #else /* not GC_CHECK_MARKED_OBJECTS */ -#define CHECK_ALLOCATED() (void) 0 #define CHECK_LIVE(LIVEP) (void) 0 #define CHECK_ALLOCATED_AND_LIVE(LIVEP) (void) 0 -- cgit v1.2.1 From d40d4be1bdebdc52a6061534d5ed1a76f54a1272 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 15:37:59 -0700 Subject: * alloc.c (Fmemory_limit): Cast sbrk's returned value to char *. --- src/ChangeLog | 1 + src/alloc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9f8c2166364..d62b1e2464b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -10,6 +10,7 @@ needed otherwise. (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS. (GC_STRING_CHARS): Remove; not used. + (Fmemory_limit): Cast sbrk's returned value to char *. * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this avoids undefined behavior in theory. diff --git a/src/alloc.c b/src/alloc.c index 7fa2790cb1e..6262e002ed3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6057,7 +6057,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer. */) { Lisp_Object end; - XSETINT (end, (EMACS_INT) sbrk (0) / 1024); + XSETINT (end, (EMACS_INT) (char *) sbrk (0) / 1024); return end; } -- cgit v1.2.1 From 946f9a5b0a6df7470868acb8b39ad10b0866f73e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 16:03:11 -0700 Subject: * data.c (Findirect_variable): Name an expression, to avoid gcc -Wbad-function-cast warning. --- src/ChangeLog | 3 +++ src/data.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d62b1e2464b..e2bff73bdb3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-15 Paul Eggert + * data.c (Findirect_variable): Name an expression, to avoid + gcc -Wbad-function-cast warning. + * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): Rename locals to avoid shadowing. diff --git a/src/data.c b/src/data.c index d0afca6a09f..288525cf5f5 100644 --- a/src/data.c +++ b/src/data.c @@ -805,7 +805,10 @@ variable chain of symbols. */) (Lisp_Object object) { if (SYMBOLP (object)) - XSETSYMBOL (object, indirect_variable (XSYMBOL (object))); + { + struct Lisp_Symbol *sym = indirect_variable (XSYMBOL (object)); + XSETSYMBOL (object, sym); + } return object; } -- cgit v1.2.1 From 112396d6542186a88963e08828cd66f6d7fe9543 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 16:06:01 -0700 Subject: * data.c (default_value, arithcompare, arith_driver, arith_error): Now static. --- src/ChangeLog | 1 + src/data.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e2bff73bdb3..37e2183ef70 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * data.c (Findirect_variable): Name an expression, to avoid gcc -Wbad-function-cast warning. + (default_value, arithcompare, arith_driver, arith_error): Now static. * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): diff --git a/src/data.c b/src/data.c index 288525cf5f5..81c16fff489 100644 --- a/src/data.c +++ b/src/data.c @@ -1272,7 +1272,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register /* Return the default value of SYMBOL, but don't check for voidness. Return Qunbound if it is void. */ -Lisp_Object +static Lisp_Object default_value (Lisp_Object symbol) { struct Lisp_Symbol *sym; @@ -2219,7 +2219,7 @@ bool-vector. IDX starts at 0. */) enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; -Lisp_Object +static Lisp_Object arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) { double f1 = 0, f2 = 0; @@ -2487,7 +2487,7 @@ enum arithop static Lisp_Object float_arith_driver (double, int, enum arithop, int, Lisp_Object *); -Lisp_Object +static Lisp_Object arith_driver (enum arithop code, int nargs, register Lisp_Object *args) { register Lisp_Object val; @@ -3311,7 +3311,7 @@ syms_of_data (void) XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; } -SIGTYPE +static SIGTYPE arith_error (int signo) { sigsetmask (SIGEMPTYMASK); -- cgit v1.2.1 From b9b84fa9b19f892520aa9fe3479d3da03a9b0da6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 16:07:15 -0700 Subject: * data.c (store_symval_forwarding): Rename local to avoid shadowing. --- src/ChangeLog | 1 + src/data.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 37e2183ef70..261805a8484 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * data.c (Findirect_variable): Name an expression, to avoid gcc -Wbad-function-cast warning. (default_value, arithcompare, arith_driver, arith_error): Now static. + (store_symval_forwarding): Rename local to avoid shadowing. * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): diff --git a/src/data.c b/src/data.c index 81c16fff489..50a6ac219c4 100644 --- a/src/data.c +++ b/src/data.c @@ -910,12 +910,12 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { - Lisp_Object buf; + Lisp_Object lbuf; struct buffer *b; - buf = Fcdr (XCAR (tail)); - if (!BUFFERP (buf)) continue; - b = XBUFFER (buf); + lbuf = Fcdr (XCAR (tail)); + if (!BUFFERP (lbuf)) continue; + b = XBUFFER (lbuf); if (! PER_BUFFER_VALUE_P (b, idx)) PER_BUFFER_VALUE (b, offset) = newval; -- cgit v1.2.1 From 8ef4622dd009b1d720155c7f2063f164f31a511e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 16:14:54 -0700 Subject: * lisp.h (eassert): Check that the argument compiles, even if ENABLE_CHECKING is not defined. --- src/ChangeLog | 3 +++ src/lisp.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 261805a8484..ad96221ed10 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-15 Paul Eggert + * lisp.h (eassert): Check that the argument compiles, even if + ENABLE_CHECKING is not defined. + * data.c (Findirect_variable): Name an expression, to avoid gcc -Wbad-function-cast warning. (default_value, arithcompare, arith_driver, arith_error): Now static. diff --git a/src/lisp.h b/src/lisp.h index 79f3b2f980b..5da73c57c66 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -86,7 +86,7 @@ extern void die (const char *, const char *, int) NO_RETURN; /* Define an Emacs version of "assert", since some system ones are flaky. */ #ifndef ENABLE_CHECKING -#define eassert(X) (void) 0 +#define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */ #else /* ENABLE_CHECKING */ #if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__) #define eassert(cond) CHECK(cond,"assertion failed: " #cond) -- cgit v1.2.1 From cdef261f74c8cf58a9b9c678e730a59b009ddad9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 16:20:25 -0700 Subject: * data.c (Fmake_variable_buffer_local, Fmake_local_variable): Mark variables as initialized. --- src/ChangeLog | 2 ++ src/data.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ad96221ed10..db04fe30bcf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,8 @@ gcc -Wbad-function-cast warning. (default_value, arithcompare, arith_driver, arith_error): Now static. (store_symval_forwarding): Rename local to avoid shadowing. + (Fmake_variable_buffer_local, Fmake_local_variable): Mark + variables as initialized. * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): diff --git a/src/data.c b/src/data.c index 50a6ac219c4..6599d8fdfa3 100644 --- a/src/data.c +++ b/src/data.c @@ -1506,8 +1506,8 @@ The function `default-value' gets the default value and `set-default' sets it. { struct Lisp_Symbol *sym; struct Lisp_Buffer_Local_Value *blv = NULL; - union Lisp_Val_Fwd valcontents; - int forwarded; + union Lisp_Val_Fwd valcontents IF_LINT (= {0}); + int forwarded IF_LINT (= 0); CHECK_SYMBOL (variable); sym = XSYMBOL (variable); @@ -1582,8 +1582,8 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) (register Lisp_Object variable) { register Lisp_Object tem; - int forwarded; - union Lisp_Val_Fwd valcontents; + int forwarded IF_LINT (= 0); + union Lisp_Val_Fwd valcontents IF_LINT (= {0}); struct Lisp_Symbol *sym; struct Lisp_Buffer_Local_Value *blv = NULL; -- cgit v1.2.1 From 527469183746cf04ee8212f9debc96e56f4748be Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 16:22:38 -0700 Subject: * data.c (do_blv_forwarding, do_symval_forwarding): Remove; unused. --- src/ChangeLog | 1 + src/data.c | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index db04fe30bcf..31b4ee92e26 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,7 @@ (store_symval_forwarding): Rename local to avoid shadowing. (Fmake_variable_buffer_local, Fmake_local_variable): Mark variables as initialized. + (do_blv_forwarding, do_symval_forwarding): Remove; unused. * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect): diff --git a/src/data.c b/src/data.c index 6599d8fdfa3..01aafbcede4 100644 --- a/src/data.c +++ b/src/data.c @@ -818,9 +818,6 @@ variable chain of symbols. */) This does not handle buffer-local variables; use swap_in_symval_forwarding for that. */ -#define do_blv_forwarding(blv) \ - ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv)) - Lisp_Object do_symval_forwarding (register union Lisp_Fwd *valcontents) { @@ -867,14 +864,6 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents) BUF non-zero means set the value in buffer BUF instead of the current buffer. This only plays a role for per-buffer variables. */ -#define store_blv_forwarding(blv, newval, buf) \ - do { \ - if ((blv)->forwarded) \ - store_symval_forwarding (BLV_FWD (blv), (newval), (buf)); \ - else \ - SET_BLV_VALUE (blv, newval); \ - } while (0) - static void store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf) { -- cgit v1.2.1 From a415e6946f76faecb98cb07ecd42ecdbcca5b7a4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 16:30:07 -0700 Subject: * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/doc.c | 36 +++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 31b4ee92e26..16cfc1d6d2f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-15 Paul Eggert + * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to + avoid shadowing. + * lisp.h (eassert): Check that the argument compiles, even if ENABLE_CHECKING is not defined. diff --git a/src/doc.c b/src/doc.c index e572d43dbf4..1ed9949e52c 100644 --- a/src/doc.c +++ b/src/doc.c @@ -322,17 +322,20 @@ string is passed through `substitute-command-keys'. */) { Lisp_Object fun; Lisp_Object funcar; - Lisp_Object tem, doc; + Lisp_Object doc; int try_reload = 1; documentation: doc = Qnil; - if (SYMBOLP (function) - && (tem = Fget (function, Qfunction_documentation), - !NILP (tem))) - return Fdocumentation_property (function, Qfunction_documentation, raw); + if (SYMBOLP (function)) + { + Lisp_Object tem = Fget (function, Qfunction_documentation); + if (!NILP (tem)) + return Fdocumentation_property (function, Qfunction_documentation, + raw); + } fun = Findirect_function (function, Qnil); if (SUBRP (fun)) @@ -348,13 +351,16 @@ string is passed through `substitute-command-keys'. */) { if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING) return Qnil; - tem = AREF (fun, COMPILED_DOC_STRING); - if (STRINGP (tem)) - doc = tem; - else if (NATNUMP (tem) || CONSP (tem)) - doc = tem; else - return Qnil; + { + Lisp_Object tem = AREF (fun, COMPILED_DOC_STRING); + if (STRINGP (tem)) + doc = tem; + else if (NATNUMP (tem) || CONSP (tem)) + doc = tem; + else + return Qnil; + } } else if (STRINGP (fun) || VECTORP (fun)) { @@ -370,9 +376,8 @@ string is passed through `substitute-command-keys'. */) else if (EQ (funcar, Qlambda) || EQ (funcar, Qautoload)) { - Lisp_Object tem1; - tem1 = Fcdr (Fcdr (fun)); - tem = Fcar (tem1); + Lisp_Object tem1 = Fcdr (Fcdr (fun)); + Lisp_Object tem = Fcar (tem1); if (STRINGP (tem)) doc = tem; /* Handle a doc reference--but these never come last @@ -539,7 +544,7 @@ the same file name is found in the `doc-directory'. */) char buf[1024 + 1]; register EMACS_INT filled; register EMACS_INT pos; - register char *p, *end; + register char *p; Lisp_Object sym; char *name; int skip_file = 0; @@ -598,6 +603,7 @@ the same file name is found in the `doc-directory'. */) pos = 0; while (1) { + register char *end; if (filled < 512) filled += emacs_read (fd, &buf[filled], sizeof buf - 1 - filled); if (!filled) -- cgit v1.2.1 From 63c5d10bb25f33f82cda1877d4aff792c030db94 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 17:24:51 -0700 Subject: * editfns.c (init_editfns, Fuser_login_name, Fuser_uid): (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts, some of which prompt warnings from gcc -Wbad-function-cast. --- src/ChangeLog | 6 ++++++ src/editfns.c | 27 ++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 16cfc1d6d2f..c477a43693f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-16 Paul Eggert + + * editfns.c (init_editfns, Fuser_login_name, Fuser_uid): + (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts, + some of which prompt warnings from gcc -Wbad-function-cast. + 2011-03-15 Paul Eggert * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to diff --git a/src/editfns.c b/src/editfns.c index 8d428eb4815..bfe07163cc8 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -122,7 +122,7 @@ Lisp_Object Qboundary; void init_editfns (void) { - char *user_name; + const char *user_name; register char *p; struct passwd *pw; /* password entry for the current user */ Lisp_Object tem; @@ -136,7 +136,7 @@ init_editfns (void) return; #endif /* not CANNOT_DUMP */ - pw = (struct passwd *) getpwuid (getuid ()); + pw = getpwuid (getuid ()); #ifdef MSDOS /* We let the real user name default to "root" because that's quite accurate on MSDOG and because it lets Emacs find the init file. @@ -148,17 +148,17 @@ init_editfns (void) /* Get the effective user name, by consulting environment variables, or the effective uid if those are unset. */ - user_name = (char *) getenv ("LOGNAME"); + user_name = getenv ("LOGNAME"); if (!user_name) #ifdef WINDOWSNT - user_name = (char *) getenv ("USERNAME"); /* it's USERNAME on NT */ + user_name = getenv ("USERNAME"); /* it's USERNAME on NT */ #else /* WINDOWSNT */ - user_name = (char *) getenv ("USER"); + user_name = getenv ("USER"); #endif /* WINDOWSNT */ if (!user_name) { - pw = (struct passwd *) getpwuid (geteuid ()); - user_name = (char *) (pw ? pw->pw_name : "unknown"); + pw = getpwuid (geteuid ()); + user_name = pw ? pw->pw_name : "unknown"; } Vuser_login_name = build_string (user_name); @@ -1266,9 +1266,9 @@ of the user with that uid, or nil if there is no such user. */) if (NILP (uid)) return Vuser_login_name; - id = (uid_t)XFLOATINT (uid); + id = XFLOATINT (uid); BLOCK_INPUT; - pw = (struct passwd *) getpwuid (id); + pw = getpwuid (id); UNBLOCK_INPUT; return (pw ? build_string (pw->pw_name) : Qnil); } @@ -1300,7 +1300,7 @@ Value is an integer or a float, depending on the value. */) /* Make sure we don't produce a negative UID due to signed integer overflow. */ if (euid < 0) - return make_float ((double)geteuid ()); + return make_float (geteuid ()); return make_fixnum_or_float (euid); } @@ -1316,7 +1316,7 @@ Value is an integer or a float, depending on the value. */) /* Make sure we don't produce a negative UID due to signed integer overflow. */ if (uid < 0) - return make_float ((double)getuid ()); + return make_float (getuid ()); return make_fixnum_or_float (uid); } @@ -1339,14 +1339,15 @@ name, or nil if there is no such user. */) return Vuser_full_name; else if (NUMBERP (uid)) { + uid_t u = XFLOATINT (uid); BLOCK_INPUT; - pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); + pw = getpwuid (u); UNBLOCK_INPUT; } else if (STRINGP (uid)) { BLOCK_INPUT; - pw = (struct passwd *) getpwnam (SSDATA (uid)); + pw = getpwnam (SSDATA (uid)); UNBLOCK_INPUT; } else -- cgit v1.2.1 From a292836456b5f127782b10accd31ff3c0b7b445d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Mar 2011 17:44:50 -0700 Subject: Move editfns decls to lisp.h to check interfaces. --- src/ChangeLog | 4 ++++ src/editfns.c | 2 -- src/lisp.h | 3 +++ src/process.c | 2 -- src/xrdb.c | 2 -- 5 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c477a43693f..69cfabaad3b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-16 Paul Eggert + * lisp.h (get_system_name, get_operating_system_release): + Move decls here, to check interfaces. + * process.c (get_operating_system_release): Move decl to lisp.h. + * xrdb.c (get_system_name): Likewise. * editfns.c (init_editfns, Fuser_login_name, Fuser_uid): (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts, some of which prompt warnings from gcc -Wbad-function-cast. diff --git a/src/editfns.c b/src/editfns.c index bfe07163cc8..9966eaaa057 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1391,8 +1391,6 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, return Vsystem_name; } -/* For the benefit of callers who don't want to include lisp.h */ - const char * get_system_name (void) { diff --git a/src/lisp.h b/src/lisp.h index 5da73c57c66..5a5e7dbec6b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2874,6 +2874,7 @@ extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void init_eval (void); extern void syms_of_eval (void); +/* Defined in editfns.c */ extern Lisp_Object Qfield; EXFUN (Fcurrent_message, 0); EXFUN (Fgoto_char, 1); @@ -2913,6 +2914,8 @@ extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int); extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int); extern void init_editfns (void); +const char *get_system_name (void); +const char *get_operating_system_release (void); extern void syms_of_editfns (void); EXFUN (Fconstrain_to_field, 5); EXFUN (Ffield_end, 3); diff --git a/src/process.c b/src/process.c index 7bfd2a3258a..39fa26e8b54 100644 --- a/src/process.c +++ b/src/process.c @@ -162,8 +162,6 @@ extern Lisp_Object QCfilter; /* Define first descriptor number available for subprocesses. */ #define FIRST_PROC_DESC 3 -extern const char *get_operating_system_release (void); - #ifndef HAVE_H_ERRNO extern int h_errno; #endif diff --git a/src/xrdb.c b/src/xrdb.c index 63e5851979c..a79f453e5e1 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -54,8 +54,6 @@ extern char *getenv (const char *); extern struct passwd *getpwuid (uid_t); extern struct passwd *getpwnam (const char *); -extern const char *get_system_name (void); - char *x_get_string_resource (XrmDatabase rdb, const char *name, const char *class); static int file_p (const char *filename); -- cgit v1.2.1 From 62973b416261f9b43e9026807651554e3cf2c9c3 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 16 Mar 2011 01:53:19 +0100 Subject: src/emacs.c (USAGE3): Doc fixes. --- src/ChangeLog | 4 ++++ src/emacs.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 72585209c24..44e4494d79a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-16 Juanma Barranquero + + * emacs.c (USAGE3): Doc fixes. + 2011-03-15 Andreas Schwab * coding.c (detect_coding_iso_2022): Reorganize code to clarify diff --git a/src/emacs.c b/src/emacs.c index 4455e6b4d9f..84092e18b8b 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -141,7 +141,7 @@ Lisp_Object Qfile_name_handler_alist; Lisp_Object Qrisky_local_variable; -/* If non-zero, emacs should not attempt to use a window-specific code, +/* If non-zero, Emacs should not attempt to use a window-specific code, but instead should use the virtual terminal under which it was started. */ int inhibit_window_system; @@ -169,7 +169,6 @@ static unsigned long heap_bss_diff; #define MAX_HEAP_BSS_DIFF (1024*1024) /* Nonzero means running Emacs without interactive terminal. */ - int noninteractive; /* Nonzero means remove site-lisp directories from load-path. */ @@ -249,14 +248,14 @@ Display options:\n\ --border-color, -bd COLOR main border color\n\ --border-width, -bw WIDTH width of main border\n\ --color, --color=MODE override color mode for character terminals;\n\ - MODE defaults to `auto', and can also\n\ - be `never', `auto', `always',\n\ + MODE defaults to `auto', and\n\ + can also be `never', `always',\n\ or a mode name like `ansi8'\n\ --cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\ --font, -fn FONT default font; must be fixed-width\n\ --foreground-color, -fg COLOR window foreground color\n\ --fullheight, -fh make the first frame high as the screen\n\ ---fullscreen, -fs make first frame fullscreen\n\ +--fullscreen, -fs make the first frame fullscreen\n\ --fullwidth, -fw make the first frame wide as the screen\n\ --maximized, -mm make the first frame maximized\n\ --geometry, -g GEOMETRY window geometry\n\ @@ -576,7 +575,8 @@ void __main (void) enough information to do it right. */ static int -argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr) +argmatch (char **argv, int argc, const char *sstr, const char *lstr, + int minlen, char **valptr, int *skipptr) { char *p = NULL; int arglen; -- cgit v1.2.1 From 545b49b4ff1d7bd8ee256dec95ea80613537eb75 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:15:43 -0700 Subject: * editfns.c: (Fformat_time_string, Fencode_time, Finsert_char): (Ftranslate_region_internal, Fformat): Rename or remove local vars to avoid shadowing. --- src/ChangeLog | 3 +++ src/editfns.c | 34 ++++++++++++++++------------------ 2 files changed, 19 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 69cfabaad3b..7901d65c086 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,9 @@ * editfns.c (init_editfns, Fuser_login_name, Fuser_uid): (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts, some of which prompt warnings from gcc -Wbad-function-cast. + (Fformat_time_string, Fencode_time, Finsert_char): + (Ftranslate_region_internal, Fformat): + Rename or remove local vars to avoid shadowing. 2011-03-15 Paul Eggert diff --git a/src/editfns.c b/src/editfns.c index 9966eaaa057..b02a92d5b98 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1721,7 +1721,7 @@ The modifiers are `E' and `O'. For certain characters X, %OX is like %X, but uses the locale's number symbols. For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) - (Lisp_Object format_string, Lisp_Object time, Lisp_Object universal) + (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) { time_t value; int size; @@ -1732,7 +1732,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) CHECK_STRING (format_string); - if (! (lisp_time_argument (time, &value, &usec) + if (! (lisp_time_argument (timeval, &value, &usec) && 0 <= usec && usec < 1000000)) error ("Invalid time specification"); ns = usec * 1000; @@ -1870,7 +1870,7 @@ year values as low as 1901 do work. usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) (int nargs, register Lisp_Object *args) { - time_t time; + time_t value; struct tm tm; Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); @@ -1887,7 +1887,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) if (NILP (zone)) { BLOCK_INPUT; - time = mktime (&tm); + value = mktime (&tm); UNBLOCK_INPUT; } else @@ -1915,7 +1915,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) set_time_zone_rule (tzstring); BLOCK_INPUT; - time = mktime (&tm); + value = mktime (&tm); UNBLOCK_INPUT; /* Restore TZ to previous value. */ @@ -1927,10 +1927,10 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) #endif } - if (time == (time_t) -1) + if (value == (time_t) -1) time_overflow (); - return make_time (time); + return make_time (value); } DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0, @@ -2340,7 +2340,7 @@ from adjoining text, if those properties are sticky. */) (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) { register char *string; - register EMACS_INT strlen; + register EMACS_INT stringlen; register int i; register EMACS_INT n; int len; @@ -2358,18 +2358,18 @@ from adjoining text, if those properties are sticky. */) n = XINT (count) * len; if (n <= 0) return Qnil; - strlen = min (n, 256 * len); - string = (char *) alloca (strlen); - for (i = 0; i < strlen; i++) + stringlen = min (n, 256 * len); + string = (char *) alloca (stringlen); + for (i = 0; i < stringlen; i++) string[i] = str[i % len]; - while (n >= strlen) + while (n >= stringlen) { QUIT; if (!NILP (inherit)) - insert_and_inherit (string, strlen); + insert_and_inherit (string, stringlen); else - insert (string, strlen); - n -= strlen; + insert (string, stringlen); + n -= stringlen; } if (n > 0) { @@ -3029,7 +3029,6 @@ It returns the number of characters changed. */) EMACS_INT pos, pos_byte, end_pos; int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int string_multibyte; - Lisp_Object val; validate_region (&start, &end); if (CHAR_TABLE_P (table)) @@ -3928,7 +3927,7 @@ usage: (format STRING &rest OBJECTS) */) /* handle case (precision[n] >= 0) */ int width, padding; - EMACS_INT nbytes, start, end; + EMACS_INT nbytes, start; EMACS_INT nchars_string; /* lisp_string_width ignores a precision of 0, but GNU @@ -3960,7 +3959,6 @@ usage: (format STRING &rest OBJECTS) */) info[n].start = start = nchars; nchars += nchars_string; - end = nchars; if (p > buf && multibyte -- cgit v1.2.1 From 9710023e8865ce1ac385526bbc44868cd2189cbd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:17:22 -0700 Subject: * editfns.c (Ftranslate_region_internal): Mark var as initialized. --- src/ChangeLog | 1 + src/editfns.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7901d65c086..88d05b56a0f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -10,6 +10,7 @@ (Fformat_time_string, Fencode_time, Finsert_char): (Ftranslate_region_internal, Fformat): Rename or remove local vars to avoid shadowing. + (Ftranslate_region_internal): Mark var as initialized. 2011-03-15 Paul Eggert diff --git a/src/editfns.c b/src/editfns.c index b02a92d5b98..1f98ff040b3 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3028,7 +3028,7 @@ It returns the number of characters changed. */) EMACS_INT size; /* Size of translate table. */ EMACS_INT pos, pos_byte, end_pos; int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); - int string_multibyte; + int string_multibyte IF_LINT (= 0); validate_region (&start, &end); if (CHAR_TABLE_P (table)) -- cgit v1.2.1 From b1349114e9a58791ee0d5e505e05633cc91293f3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:19:04 -0700 Subject: * callint.c (quotify_arg, quotify_args): Now static. --- src/ChangeLog | 2 ++ src/callint.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 88d05b56a0f..d87c1d0fbcb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Paul Eggert + * callint.c (quotify_arg, quotify_args): Now static. + * lisp.h (get_system_name, get_operating_system_release): Move decls here, to check interfaces. * process.c (get_operating_system_release): Move decl to lisp.h. diff --git a/src/callint.c b/src/callint.c index 21dd3cd4d9d..af9ee5bb9bd 100644 --- a/src/callint.c +++ b/src/callint.c @@ -118,7 +118,7 @@ usage: (interactive &optional ARGS) */) /* Quotify EXP: if EXP is constant, return it. If EXP is not constant, return (quote EXP). */ -Lisp_Object +static Lisp_Object quotify_arg (register Lisp_Object exp) { if (!INTEGERP (exp) && !STRINGP (exp) @@ -129,7 +129,7 @@ quotify_arg (register Lisp_Object exp) } /* Modify EXP by quotifying each element (except the first). */ -Lisp_Object +static Lisp_Object quotify_args (Lisp_Object exp) { register Lisp_Object tail; -- cgit v1.2.1 From a3e8cbda22e76cc2f5352638256cdc0033c00357 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:24:57 -0700 Subject: * callint.c (Fcall_interactively): Rename locals to avoid shadowing. --- src/ChangeLog | 1 + src/callint.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d87c1d0fbcb..e70683dd12a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-16 Paul Eggert * callint.c (quotify_arg, quotify_args): Now static. + (Fcall_interactively): Rename locals to avoid shadowing. * lisp.h (get_system_name, get_operating_system_release): Move decls here, to check interfaces. diff --git a/src/callint.c b/src/callint.c index af9ee5bb9bd..5ec916a5b8a 100644 --- a/src/callint.c +++ b/src/callint.c @@ -408,25 +408,25 @@ invoke it. If KEYS is omitted or nil, the return value of string++; else if (*string == '@') { - Lisp_Object event, tem; + Lisp_Object event, w; event = (next_event < key_count ? AREF (keys, next_event) : Qnil); if (EVENT_HAS_PARAMETERS (event) - && (tem = XCDR (event), CONSP (tem)) - && (tem = XCAR (tem), CONSP (tem)) - && (tem = XCAR (tem), WINDOWP (tem))) + && (w = XCDR (event), CONSP (w)) + && (w = XCAR (w), CONSP (w)) + && (w = XCAR (w), WINDOWP (w))) { - if (MINI_WINDOW_P (XWINDOW (tem)) - && ! (minibuf_level > 0 && EQ (tem, minibuf_window))) + if (MINI_WINDOW_P (XWINDOW (w)) + && ! (minibuf_level > 0 && EQ (w, minibuf_window))) error ("Attempt to select inactive minibuffer window"); /* If the current buffer wants to clean up, let it. */ if (!NILP (Vmouse_leave_buffer_hook)) call1 (Vrun_hooks, Qmouse_leave_buffer_hook); - Fselect_window (tem, Qnil); + Fselect_window (w, Qnil); } string++; } @@ -679,7 +679,7 @@ invoke it. If KEYS is omitted or nil, the return value of int first = 1; do { - Lisp_Object tem; + Lisp_Object str; if (! first) { message ("Please enter a number."); @@ -687,13 +687,13 @@ invoke it. If KEYS is omitted or nil, the return value of } first = 0; - tem = Fread_from_minibuffer (callint_message, + str = Fread_from_minibuffer (callint_message, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil); - if (! STRINGP (tem) || SCHARS (tem) == 0) + if (! STRINGP (str) || SCHARS (str) == 0) args[i] = Qnil; else - args[i] = Fread (tem); + args[i] = Fread (str); } while (! NUMBERP (args[i])); } -- cgit v1.2.1 From b0e80955879267569ee146c03ae0d5a8e7e041a5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:26:16 -0700 Subject: * callint.c: Use const pointer when appropriate. --- src/ChangeLog | 1 + src/callint.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e70683dd12a..ca43ce4dc8f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * callint.c (quotify_arg, quotify_args): Now static. (Fcall_interactively): Rename locals to avoid shadowing. + Use const pointer when appropriate. * lisp.h (get_system_name, get_operating_system_release): Move decls here, to check interfaces. diff --git a/src/callint.c b/src/callint.c index 5ec916a5b8a..282d8a82aa7 100644 --- a/src/callint.c +++ b/src/callint.c @@ -258,7 +258,7 @@ invoke it. If KEYS is omitted or nil, the return value of Lisp_Object prefix_arg; char *string; - char *tem; + const char *tem; /* If varies[i] > 0, the i'th argument shouldn't just have its value in this call quoted in the command history. It should be -- cgit v1.2.1 From 475545b50099448132747e79b70bbb4199559d09 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:28:57 -0700 Subject: * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static. --- src/ChangeLog | 2 ++ src/eval.c | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ca43ce4dc8f..4e72b9c0d2b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Paul Eggert + * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static. + * callint.c (quotify_arg, quotify_args): Now static. (Fcall_interactively): Rename locals to avoid shadowing. Use const pointer when appropriate. diff --git a/src/eval.c b/src/eval.c index d0effc755a2..f9ed8712eb3 100644 --- a/src/eval.c +++ b/src/eval.c @@ -158,7 +158,7 @@ restore_stack_limits (Lisp_Object data) /* Call the Lisp debugger, giving it argument ARG. */ -Lisp_Object +static Lisp_Object call_debugger (Lisp_Object arg) { int debug_while_redisplaying; @@ -214,7 +214,7 @@ call_debugger (Lisp_Object arg) return unbind_to (count, val); } -void +static void do_debug_on_call (Lisp_Object code) { debug_on_next_call = 0; @@ -1637,7 +1637,7 @@ See also the function `condition-case'. */) if (!NILP (clause)) break; } - + if (/* Don't run the debugger for a memory-full error. (There is no room in memory to do that!) */ !NILP (error_symbol) @@ -1654,13 +1654,13 @@ See also the function `condition-case'. */) can continue code which has signaled a quit. */ if (debugger_called && EQ (real_error_symbol, Qquit)) return Qnil; - } + } if (!NILP (clause)) { Lisp_Object unwind_data = (NILP (error_symbol) ? data : Fcons (error_symbol, data)); - + h->chosen_clause = clause; unwind_to_catch (h->tag, unwind_data); } @@ -1672,7 +1672,7 @@ See also the function `condition-case'. */) if (! NILP (error_symbol)) data = Fcons (error_symbol, data); - + string = Ferror_message_string (data); fatal ("%s", SDATA (string), 0); } @@ -3057,7 +3057,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, return object; } -void +static void grow_specpdl (void) { register int count = SPECPDL_INDEX (); @@ -3589,4 +3589,3 @@ The value the function returns is not used. */); defsubr (&Sbacktrace); defsubr (&Sbacktrace_frame); } - -- cgit v1.2.1 From d28a21703d47c6983e91d3d4a464546750519236 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:30:17 -0700 Subject: * eval.c (Fdefvar): Rewrite so as not to use empty "else". --- src/ChangeLog | 1 + src/eval.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4e72b9c0d2b..15d169a8b30 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-16 Paul Eggert * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static. + (Fdefvar): Rewrite so as not to use empty "else". * callint.c (quotify_arg, quotify_args): Now static. (Fcall_interactively): Rename locals to avoid shadowing. diff --git a/src/eval.c b/src/eval.c index f9ed8712eb3..4f6d3dd015d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -801,10 +801,11 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) LOADHIST_ATTACH (sym); } else - /* Simple (defvar ) should not count as a definition at all. - It could get in the way of other definitions, and unloading this - package could try to make the variable unbound. */ - ; + { + /* Simple (defvar ) should not count as a definition at all. + It could get in the way of other definitions, and unloading this + package could try to make the variable unbound. */ + } return sym; } -- cgit v1.2.1 From cfcbfb1aa5d013f114bc002110166fd1f5392f56 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:34:28 -0700 Subject: * eval.c (lisp_indirect_variable): Name an expression, to avoid gcc -Wbad-function-cast warning. --- src/ChangeLog | 2 ++ src/eval.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 15d169a8b30..a5a4657f7dc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static. (Fdefvar): Rewrite so as not to use empty "else". + (lisp_indirect_variable): Name an expression, + to avoid gcc -Wbad-function-cast warning. * callint.c (quotify_arg, quotify_args): Now static. (Fcall_interactively): Rename locals to avoid shadowing. diff --git a/src/eval.c b/src/eval.c index 4f6d3dd015d..affafadfecf 100644 --- a/src/eval.c +++ b/src/eval.c @@ -856,7 +856,8 @@ user_variable_p_eh (Lisp_Object ignore) static Lisp_Object lisp_indirect_variable (Lisp_Object sym) { - XSETSYMBOL (sym, indirect_variable (XSYMBOL (sym))); + struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym)); + XSETSYMBOL (sym, s); return sym; } -- cgit v1.2.1 From 8b2c52e913dcfed4dc39d79a994a2d301b06478a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:37:10 -0700 Subject: * alloc.c (mark_backtrace): Move decl from here ... * lisp.h: ... to here, so that it can be checked. --- src/ChangeLog | 3 +++ src/alloc.c | 1 - src/lisp.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a5a4657f7dc..00361255651 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-16 Paul Eggert + * alloc.c (mark_backtrace): Move decl from here ... + * lisp.h: ... to here, so that it can be checked. + * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static. (Fdefvar): Rewrite so as not to use empty "else". (lisp_indirect_variable): Name an expression, diff --git a/src/alloc.c b/src/alloc.c index 6262e002ed3..66695e7a9bc 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -270,7 +270,6 @@ Lisp_Object Qpost_gc_hook; static void mark_buffer (Lisp_Object); static void mark_terminals (void); -extern void mark_backtrace (void); static void gc_sweep (void); static void mark_glyph_matrix (struct glyph_matrix *); static void mark_face_cache (struct face_cache *); diff --git a/src/lisp.h b/src/lisp.h index 5a5e7dbec6b..074c758ce8e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2872,6 +2872,7 @@ extern Lisp_Object safe_call (int, Lisp_Object *); extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void init_eval (void); +extern void mark_backtrace (void); extern void syms_of_eval (void); /* Defined in editfns.c */ -- cgit v1.2.1 From 1faed8ae39da845b9e39d2ce7f20ee9f4e32fc31 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:44:19 -0700 Subject: * eval.c (Fdefvar): Rename locals to avoid shadowing. --- src/ChangeLog | 1 + src/eval.c | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 00361255651..0ef92dbb53a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,7 @@ (Fdefvar): Rewrite so as not to use empty "else". (lisp_indirect_variable): Name an expression, to avoid gcc -Wbad-function-cast warning. + (Fdefvar): Rename locals to avoid shadowing. * callint.c (quotify_arg, quotify_args): Now static. (Fcall_interactively): Rename locals to avoid shadowing. diff --git a/src/eval.c b/src/eval.c index affafadfecf..f68274e6e8c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -764,11 +764,11 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) if (SYMBOL_CONSTANT_P (sym)) { /* For upward compatibility, allow (defvar :foo (quote :foo)). */ - Lisp_Object tem = Fcar (tail); - if (! (CONSP (tem) - && EQ (XCAR (tem), Qquote) - && CONSP (XCDR (tem)) - && EQ (XCAR (XCDR (tem)), sym))) + Lisp_Object tem1 = Fcar (tail); + if (! (CONSP (tem1) + && EQ (XCAR (tem1), Qquote) + && CONSP (XCDR (tem1)) + && EQ (XCAR (XCDR (tem1)), sym))) error ("Constant symbol `%s' specified in defvar", SDATA (SYMBOL_NAME (sym))); } @@ -2539,8 +2539,8 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) } else { - Lisp_Object globals = Qnil; - GCPRO3 (sym, val, globals); + Lisp_Object global_vals = Qnil; + GCPRO3 (sym, val, global_vals); for (; CONSP (val) && ((cond == to_completion) @@ -2552,23 +2552,25 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) { /* t indicates this hook has a local binding; it means to run the global binding too. */ - globals = Fdefault_value (sym); - if (NILP (globals)) continue; + global_vals = Fdefault_value (sym); + if (NILP (global_vals)) continue; - if (!CONSP (globals) || EQ (XCAR (globals), Qlambda)) + if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) { - args[0] = globals; + args[0] = global_vals; ret = Ffuncall (nargs, args); } else { for (; - CONSP (globals) && ((cond == to_completion) - || (cond == until_success ? NILP (ret) - : !NILP (ret))); - globals = XCDR (globals)) + (CONSP (global_vals) + && (cond == to_completion + || (cond == until_success + ? NILP (ret) + : !NILP (ret)))); + global_vals = XCDR (global_vals)) { - args[0] = XCAR (globals); + args[0] = XCAR (global_vals); /* In a global value, t should not occur. If it does, we must ignore it to avoid an endless loop. */ if (!EQ (args[0], Qt)) -- cgit v1.2.1 From 1384fa33581c398a3f3393c82be071d5784b0b04 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:45:34 -0700 Subject: * floatfns.c (domain_error2): Define only if needed. --- src/ChangeLog | 2 ++ src/floatfns.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0ef92dbb53a..f57fa6d9e0f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Paul Eggert + * floatfns.c (domain_error2): Define only if needed. + * alloc.c (mark_backtrace): Move decl from here ... * lisp.h: ... to here, so that it can be checked. diff --git a/src/floatfns.c b/src/floatfns.c index c00923643d1..c8b5236d34a 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -187,8 +187,10 @@ static const char *float_error_fn_name; xsignal3 (Qrange_error, build_string ((op)), (a1), (a2)) #define domain_error(op,arg) \ xsignal2 (Qdomain_error, build_string ((op)), (arg)) +#ifdef FLOAT_CHECK_DOMAIN #define domain_error2(op,a1,a2) \ xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2)) +#endif /* Extract a Lisp number as a `double', or signal an error. */ @@ -1037,7 +1039,7 @@ syms_of_floatfns (void) defsubr (&Scopysign); defsubr (&Sfrexp); defsubr (&Sldexp); -#endif +#endif #if 0 defsubr (&Sacosh); defsubr (&Sasinh); @@ -1074,4 +1076,3 @@ syms_of_floatfns (void) defsubr (&Sround); defsubr (&Struncate); } - -- cgit v1.2.1 From a885e2ed791b15dc48a7024751872d2b5bc17034 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:47:02 -0700 Subject: * floatfns.c (Ffrexp, Fldexp): Rename locals to avoid shadowing. --- src/ChangeLog | 1 + src/floatfns.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f57fa6d9e0f..131d2af5a49 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-16 Paul Eggert * floatfns.c (domain_error2): Define only if needed. + (Ffrexp, Fldexp): Rename locals to avoid shadowing. * alloc.c (mark_backtrace): Move decl from here ... * lisp.h: ... to here, so that it can be checked. diff --git a/src/floatfns.c b/src/floatfns.c index c8b5236d34a..bc03509b757 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -328,9 +328,9 @@ If X is zero, both parts (SGNFCAND and EXP) are zero. */) return Fcons (make_float (0.0), make_number (0)); else { - int exp; - double sgnfcand = frexp (f, &exp); - return Fcons (make_float (sgnfcand), make_number (exp)); + int exponent; + double sgnfcand = frexp (f, &exponent); + return Fcons (make_float (sgnfcand), make_number (exponent)); } } @@ -338,10 +338,10 @@ DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0, doc: /* Construct number X from significand SGNFCAND and exponent EXP. Returns the floating point value resulting from multiplying SGNFCAND (the significand) by 2 raised to the power of EXP (the exponent). */) - (Lisp_Object sgnfcand, Lisp_Object exp) + (Lisp_Object sgnfcand, Lisp_Object exponent) { - CHECK_NUMBER (exp); - return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp))); + CHECK_NUMBER (exponent); + return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exponent))); } #endif -- cgit v1.2.1 From 2a80c887c75a89f23efcb0c565454647e4f96570 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:48:36 -0700 Subject: * fns.c (require_nesting_list, require_unwind): Now static. --- src/ChangeLog | 2 ++ src/fns.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 131d2af5a49..0e8e33ee53a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Paul Eggert + * fns.c (require_nesting_list, require_unwind): Now static. + * floatfns.c (domain_error2): Define only if needed. (Ffrexp, Fldexp): Rename locals to avoid shadowing. diff --git a/src/fns.c b/src/fns.c index 0026c9d12e4..ebbebdd9ee0 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2598,9 +2598,9 @@ particular subfeatures supported in this version of FEATURE. */) /* List of features currently being require'd, innermost first. */ -Lisp_Object require_nesting_list; +static Lisp_Object require_nesting_list; -Lisp_Object +static Lisp_Object require_unwind (Lisp_Object old_value) { return require_nesting_list = old_value; -- cgit v1.2.1 From 612f56dfff305bae8b6e61ea3a60502f42a8eb5b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 00:49:54 -0700 Subject: * fns.c (Ffillarray): Rename locals to avoid shadowing. --- src/ChangeLog | 1 + src/fns.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0e8e33ee53a..adac111aa19 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-16 Paul Eggert * fns.c (require_nesting_list, require_unwind): Now static. + (Ffillarray): Rename locals to avoid shadowing. * floatfns.c (domain_error2): Define only if needed. (Ffrexp, Fldexp): Rename locals to avoid shadowing. diff --git a/src/fns.c b/src/fns.c index ebbebdd9ee0..71f49b9cdae 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2133,15 +2133,15 @@ DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0, ARRAY is a vector, string, char-table, or bool-vector. */) (Lisp_Object array, Lisp_Object item) { - register EMACS_INT size, index; + register EMACS_INT size, idx; int charval; if (VECTORP (array)) { register Lisp_Object *p = XVECTOR (array)->contents; size = ASIZE (array); - for (index = 0; index < size; index++) - p[index] = item; + for (idx = 0; idx < size; idx++) + p[idx] = item; } else if (CHAR_TABLE_P (array)) { @@ -2177,8 +2177,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */) *p++ = str[i % len]; } else - for (index = 0; index < size; index++) - p[index] = charval; + for (idx = 0; idx < size; idx++) + p[idx] = charval; } else if (BOOL_VECTOR_P (array)) { @@ -2188,14 +2188,14 @@ ARRAY is a vector, string, char-table, or bool-vector. */) / BOOL_VECTOR_BITS_PER_CHAR); charval = (! NILP (item) ? -1 : 0); - for (index = 0; index < size_in_chars - 1; index++) - p[index] = charval; - if (index < size_in_chars) + for (idx = 0; idx < size_in_chars - 1; idx++) + p[idx] = charval; + if (idx < size_in_chars) { /* Mask out bits beyond the vector size. */ if (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR) charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1; - p[index] = charval; + p[idx] = charval; } } else -- cgit v1.2.1 From e663c700e753d901479798b735c2ad6ac74c07d9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 01:19:22 -0700 Subject: * font.c (font_unparse_xlfd): Don't mix pointers to variables with pointers to constants. --- src/ChangeLog | 3 +++ src/font.c | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index adac111aa19..e9a6d5da5a3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-16 Paul Eggert + * font.c (font_unparse_xlfd): Don't mix pointers to variables with + pointers to constants. + * fns.c (require_nesting_list, require_unwind): Now static. (Ffillarray): Rename locals to avoid shadowing. diff --git a/src/font.c b/src/font.c index 35821ae34f9..3b2ae9c6620 100644 --- a/src/font.c +++ b/src/font.c @@ -1163,7 +1163,8 @@ font_parse_xlfd (char *name, Lisp_Object font) int font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) { - char *f[XLFD_REGISTRY_INDEX + 1]; + char *p; + const char *f[XLFD_REGISTRY_INDEX + 1]; Lisp_Object val; int i, j, len = 0; @@ -1194,14 +1195,14 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) /* Change "jisx0208*" and "jisx0208" to "jisx0208*-*". */ if (SDATA (val)[SBYTES (val) - 1] == '*') { - f[j] = alloca (SBYTES (val) + 3); - sprintf (f[j], "%s-*", SDATA (val)); + f[j] = p = alloca (SBYTES (val) + 3); + sprintf (p, "%s-*", SDATA (val)); len += SBYTES (val) + 3; } else { - f[j] = alloca (SBYTES (val) + 4); - sprintf (f[j], "%s*-*", SDATA (val)); + f[j] = p = alloca (SBYTES (val) + 4); + sprintf (p, "%s*-*", SDATA (val)); len += SBYTES (val) + 4; } } @@ -1232,8 +1233,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) i = pixel_size; if (i > 0) { - f[XLFD_PIXEL_INDEX] = alloca (22); - len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", i) + 1; + f[XLFD_PIXEL_INDEX] = p = alloca (22); + len += sprintf (p, "%d-*", i) + 1; } else f[XLFD_PIXEL_INDEX] = "*-*", len += 4; @@ -1241,8 +1242,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) else if (FLOATP (val)) { i = XFLOAT_DATA (val) * 10; - f[XLFD_PIXEL_INDEX] = alloca (12); - len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1; + f[XLFD_PIXEL_INDEX] = p = alloca (12); + len += sprintf (p, "*-%d", i) + 1; } else f[XLFD_PIXEL_INDEX] = "*-*", len += 4; @@ -1250,9 +1251,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) if (INTEGERP (AREF (font, FONT_DPI_INDEX))) { i = XINT (AREF (font, FONT_DPI_INDEX)); - f[XLFD_RESX_INDEX] = alloca (22); - len += sprintf (f[XLFD_RESX_INDEX], - "%d-%d", i, i) + 1; + f[XLFD_RESX_INDEX] = p = alloca (22); + len += sprintf (p, "%d-%d", i, i) + 1; } else f[XLFD_RESX_INDEX] = "*-*", len += 4; @@ -1270,8 +1270,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) f[XLFD_SPACING_INDEX] = "*", len += 2; if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) { - f[XLFD_AVGWIDTH_INDEX] = alloca (11); - len += sprintf (f[XLFD_AVGWIDTH_INDEX], "%ld", + f[XLFD_AVGWIDTH_INDEX] = p = alloca (11); + len += sprintf (p, "%ld", (long) XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; } else -- cgit v1.2.1 From 89bc529a4c8578046172d80776abcf3fadc0dbe8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 01:20:40 -0700 Subject: * font.c (font_parse_fcname): Remove unused vars. --- src/ChangeLog | 1 + src/font.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e9a6d5da5a3..ba1bd03265b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * font.c (font_unparse_xlfd): Don't mix pointers to variables with pointers to constants. + (font_parse_fcname): Remove unused vars. * fns.c (require_nesting_list, require_unwind): Now static. (Ffillarray): Rename locals to avoid shadowing. diff --git a/src/font.c b/src/font.c index 3b2ae9c6620..16812255e87 100644 --- a/src/font.c +++ b/src/font.c @@ -1448,12 +1448,10 @@ font_parse_fcname (char *name, Lisp_Object font) { /* Either a fontconfig-style name with no size and property data, or a GTK-style name. */ - Lisp_Object prop; Lisp_Object weight = Qnil, slant = Qnil; Lisp_Object width = Qnil, size = Qnil; char *word_start; int word_len; - int size_found = 0; /* Scan backwards from the end, looking for a size. */ for (p = name + len - 1; p >= name; p--) -- cgit v1.2.1 From 7b81e2d023093bf21cf867ec42ffff3ee7114cf5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 01:22:13 -0700 Subject: * font.c (font_delete_unmatched): Now static. --- src/ChangeLog | 1 + src/font.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ba1bd03265b..63e23749374 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * font.c (font_unparse_xlfd): Don't mix pointers to variables with pointers to constants. (font_parse_fcname): Remove unused vars. + (font_delete_unmatched): Now static. * fns.c (require_nesting_list, require_unwind): Now static. (Ffillarray): Rename locals to avoid shadowing. diff --git a/src/font.c b/src/font.c index 16812255e87..25e2968df7f 100644 --- a/src/font.c +++ b/src/font.c @@ -2600,7 +2600,7 @@ static Lisp_Object scratch_font_spec, scratch_font_prefer; (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil). */ -Lisp_Object +static Lisp_Object font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size) { Lisp_Object entity, val; -- cgit v1.2.1 From ea838e10ea8a3e390b2d9160e02c4a5e08714850 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 01:22:49 -0700 Subject: * font.c (font_get_spec): Remove; unused. --- src/ChangeLog | 1 + src/font.c | 16 ---------------- 2 files changed, 1 insertion(+), 16 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 63e23749374..1b707c4b463 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ pointers to constants. (font_parse_fcname): Remove unused vars. (font_delete_unmatched): Now static. + (font_get_spec): Remove; unused. * fns.c (require_nesting_list, require_unwind): Now static. (Ffillarray): Rename locals to avoid shadowing. diff --git a/src/font.c b/src/font.c index 25e2968df7f..ed3b3aeefc5 100644 --- a/src/font.c +++ b/src/font.c @@ -2949,22 +2949,6 @@ font_get_name (Lisp_Object font_object) } -/* Return the specification of FONT_OBJECT. */ - -Lisp_Object -font_get_spec (Lisp_Object font_object) -{ - Lisp_Object spec = font_make_spec (); - int i; - - for (i = 0; i < FONT_SIZE_INDEX; i++) - ASET (spec, i, AREF (font_object, i)); - ASET (spec, FONT_SIZE_INDEX, - make_number (XFONT_OBJECT (font_object)->pixel_size)); - return spec; -} - - /* Create a new font spec from FONT_NAME, and return it. If FONT_NAME could not be parsed by font_parse_name, return Qnil. */ -- cgit v1.2.1 From 170a2692ec2abdc4e4978206ddec6bebb6c989b2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 01:31:20 -0700 Subject: * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing. --- src/ChangeLog | 2 ++ src/character.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1b707c4b463..4b3f0ceca36 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Paul Eggert + * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing. + * font.c (font_unparse_xlfd): Don't mix pointers to variables with pointers to constants. (font_parse_fcname): Remove unused vars. diff --git a/src/character.h b/src/character.h index f0b0002032e..77c670728d0 100644 --- a/src/character.h +++ b/src/character.h @@ -417,10 +417,10 @@ along with GNU Emacs. If not, see . */ if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ { \ unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ - int len; \ + int string_len; \ \ - OUTPUT= STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT= STRING_CHAR_AND_LENGTH (ptr, string_len); \ + BYTEIDX += string_len; \ } \ else \ { \ -- cgit v1.2.1 From 13a547c6792935558a306bec264e0bad575cec87 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 01:34:44 -0700 Subject: * font.c: (font_style_to_value, font_prop_validate_style, font_unparse_fcname): (font_update_drivers, Ffont_get_glyphs, font_add_log): Rename or move locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/font.c | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4b3f0ceca36..b056c08419e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,9 @@ (font_parse_fcname): Remove unused vars. (font_delete_unmatched): Now static. (font_get_spec): Remove; unused. + (font_style_to_value, font_prop_validate_style, font_unparse_fcname): + (font_update_drivers, Ffont_get_glyphs, font_add_log): + Rename or move locals to avoid shadowing. * fns.c (require_nesting_list, require_unwind): Now static. (Ffillarray): Rename locals to avoid shadowing. diff --git a/src/font.c b/src/font.c index ed3b3aeefc5..a9a381a828d 100644 --- a/src/font.c +++ b/src/font.c @@ -311,10 +311,10 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror { Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); int len = ASIZE (table); - int i, j; if (SYMBOLP (val)) { + int i, j; char *s; Lisp_Object args[2], elt; @@ -500,10 +500,9 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object val) enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX : EQ (style, QCslant) ? FONT_SLANT_INDEX : FONT_WIDTH_INDEX); - int n; if (INTEGERP (val)) { - n = XINT (val); + int n = XINT (val); if (((n >> 4) & 0xF) >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) val = Qerror; @@ -1602,15 +1601,15 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) len += strlen (":scalable=false"); /* or ":scalable=true" */ for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) { - Lisp_Object key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail)); + Lisp_Object key = XCAR (XCAR (tail)), value = XCDR (XCAR (tail)); len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */ - if (STRINGP (val)) - len += SBYTES (val); - else if (INTEGERP (val)) - len += sprintf (work, "%ld", (long) XINT (val)); - else if (SYMBOLP (val)) - len += (NILP (val) ? 5 : 4); /* for "false" or "true" */ + if (STRINGP (value)) + len += SBYTES (value); + else if (INTEGERP (value)) + len += sprintf (work, "%ld", (long) XINT (value)); + else if (SYMBOLP (value)) + len += (NILP (value) ? 5 : 4); /* for "false" or "true" */ } if (len > nbytes) @@ -3418,14 +3417,13 @@ Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers) { Lisp_Object active_drivers = Qnil; - struct font_driver *driver; struct font_driver_list *list; /* At first, turn off non-requested drivers, and turn on requested drivers. */ for (list = f->font_driver_list; list; list = list->next) { - driver = list->driver; + struct font_driver *driver = list->driver; if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers))) != list->on) { @@ -4651,7 +4649,7 @@ the corresponding element is nil. */) Lisp_Object object) { struct font *font; - int i, len, c; + int i, len; Lisp_Object *chars, vec; USE_SAFE_ALLOCA; @@ -4669,6 +4667,7 @@ the corresponding element is nil. */) bytepos = CHAR_TO_BYTE (charpos); for (i = 0; charpos < XFASTINT (to); i++) { + int c; FETCH_CHAR_ADVANCE (c, charpos, bytepos); chars[i] = make_number (c); } @@ -4690,7 +4689,7 @@ the corresponding element is nil. */) if (STRING_MULTIBYTE (object)) for (i = 0; i < len; i++) { - c = STRING_CHAR_ADVANCE (p); + int c = STRING_CHAR_ADVANCE (p); chars[i] = make_number (c); } else @@ -4941,7 +4940,7 @@ static Lisp_Object Vfont_log_deferred; void font_add_log (const char *action, Lisp_Object arg, Lisp_Object result) { - Lisp_Object tail, val; + Lisp_Object val; int i; if (EQ (Vfont_log, Qt)) @@ -4997,6 +4996,7 @@ font_add_log (const char *action, Lisp_Object arg, Lisp_Object result) } else if (CONSP (result)) { + Lisp_Object tail; result = Fcopy_sequence (result); for (tail = result; CONSP (tail); tail = XCDR (tail)) { -- cgit v1.2.1 From 35ac2a97f505a3c0de5cc2d4cf40b5b2f22529d0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 16 Mar 2011 10:23:26 -0400 Subject: * src/print.c (print_preprocess): Don't forget font objects. --- src/ChangeLog | 4 ++++ src/print.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 44e4494d79a..e25ed31f45b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-16 Stefan Monnier + + * print.c (print_preprocess): Don't forget font objects. + 2011-03-16 Juanma Barranquero * emacs.c (USAGE3): Doc fixes. diff --git a/src/print.c b/src/print.c index 29a4bfab790..f48ba57b574 100644 --- a/src/print.c +++ b/src/print.c @@ -1209,7 +1209,7 @@ print_preprocess (Lisp_Object obj) loop: if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) - || HASH_TABLE_P (obj) + || HASH_TABLE_P (obj) || FONTP (obj) || (! NILP (Vprint_gensym) && SYMBOLP (obj) && !SYMBOL_INTERNED_P (obj))) -- cgit v1.2.1 From fb103ca9a72ab9ddeeea1a9cfef85b0492ab9651 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 16 Mar 2011 13:34:26 -0400 Subject: * src/print.c (PRINT_CIRCLE_CANDIDATE_P): New macro. (print_preprocess, print_object): New macro to fix last change. --- src/ChangeLog | 3 +++ src/print.c | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e25ed31f45b..c43d3ba95ec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-16 Stefan Monnier + * print.c (PRINT_CIRCLE_CANDIDATE_P): New macro. + (print_preprocess, print_object): New macro to fix last change. + * print.c (print_preprocess): Don't forget font objects. 2011-03-16 Juanma Barranquero diff --git a/src/print.c b/src/print.c index f48ba57b574..c7011642643 100644 --- a/src/print.c +++ b/src/print.c @@ -1173,6 +1173,16 @@ print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) print_object (obj, printcharfun, escapeflag); } +#define PRINT_CIRCLE_CANDIDATE_P(obj) \ + (STRINGP (obj) || CONSP (obj) \ + || (VECTORLIKEP (obj) \ + && (VECTORP (obj) || COMPILEDP (obj) \ + || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \ + || HASH_TABLE_P (obj) || FONTP (obj))) \ + || (! NILP (Vprint_gensym) \ + && SYMBOLP (obj) \ + && !SYMBOL_INTERNED_P (obj))) + /* Construct Vprint_number_table according to the structure of OBJ. OBJ itself and all its elements will be added to Vprint_number_table recursively if it is a list, vector, compiled function, char-table, @@ -1207,12 +1217,7 @@ print_preprocess (Lisp_Object obj) halftail = obj; loop: - if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) - || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) - || HASH_TABLE_P (obj) || FONTP (obj) - || (! NILP (Vprint_gensym) - && SYMBOLP (obj) - && !SYMBOL_INTERNED_P (obj))) + if (PRINT_CIRCLE_CANDIDATE_P (obj)) { if (!HASH_TABLE_P (Vprint_number_table)) { @@ -1389,12 +1394,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag error ("Apparently circular structure being printed"); /* Detect circularities and truncate them. */ - if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) - || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) - || HASH_TABLE_P (obj) - || (! NILP (Vprint_gensym) - && SYMBOLP (obj) - && !SYMBOL_INTERNED_P (obj))) + if (PRINT_CIRCLE_CANDIDATE_P (obj)) { if (NILP (Vprint_circle) && NILP (Vprint_gensym)) { -- cgit v1.2.1 From 3ddb06397195434207cd188506693626b8c57a32 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:14:06 -0700 Subject: * font.c (font_unparse_fcname): Abort in an "impossible" situation instead of using an uninitialized var. --- src/ChangeLog | 3 +++ src/font.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b056c08419e..210b756e0ee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-16 Paul Eggert + * font.c (font_unparse_fcname): Abort in an "impossible" situation + instead of using an uninitialized var. + * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing. * font.c (font_unparse_xlfd): Don't mix pointers to variables with diff --git a/src/font.c b/src/font.c index a9a381a828d..5df0510b518 100644 --- a/src/font.c +++ b/src/font.c @@ -1566,8 +1566,10 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) point_size = -1; len += 21; /* for ":pixelsize=NUM" */ } - else if (FLOATP (val)) + else { + if (! FLOATP (val)) + abort (); pixel_size = -1; point_size = (int) XFLOAT_DATA (val); len += 11; /* for "-NUM" */ -- cgit v1.2.1 From 5ad03b978fea0a7cfeb8e0b8f78484244642c1c5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:23:37 -0700 Subject: * font.c (font_sort_entities): Mark var as initialized. --- src/ChangeLog | 1 + src/font.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 210b756e0ee..1f30c599626 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * font.c (font_unparse_fcname): Abort in an "impossible" situation instead of using an uninitialized var. + (font_sort_entities): Mark var as initialized. * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing. diff --git a/src/font.c b/src/font.c index 5df0510b518..9e8b7029c22 100644 --- a/src/font.c +++ b/src/font.c @@ -2177,7 +2177,7 @@ font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int unsigned best_score; Lisp_Object best_entity; struct frame *f = XFRAME (frame); - Lisp_Object tail, vec; + Lisp_Object tail, vec IF_LINT (= Qnil); USE_SAFE_ALLOCA; for (i = FONT_WEIGHT_INDEX; i <= FONT_AVGWIDTH_INDEX; i++) -- cgit v1.2.1 From f08b802adcfe721e35de22ab868149d66c28c7f6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:27:03 -0700 Subject: * lisp.h (debug_output_compilation_hack): Add decl here, to avoid warning when compiling print.c. --- src/ChangeLog | 3 +++ src/lisp.h | 1 + 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1f30c599626..5f02fa1188d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-16 Paul Eggert + * lisp.h (debug_output_compilation_hack): Add decl here, to avoid + warning when compiling print.c. + * font.c (font_unparse_fcname): Abort in an "impossible" situation instead of using an uninitialized var. (font_sort_entities): Mark var as initialized. diff --git a/src/lisp.h b/src/lisp.h index 074c758ce8e..04d75d55dc6 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2763,6 +2763,7 @@ EXFUN (Fprint, 2); EXFUN (Ferror_message_string, 1); extern Lisp_Object Qstandard_output; extern Lisp_Object Qexternal_debugging_output; +extern void debug_output_compilation_hack (int); extern void temp_output_buffer_setup (const char *); extern int print_level; extern Lisp_Object Qprint_escape_newlines; -- cgit v1.2.1 From d4d7173a912c261de01021649468f06df1b1a5a3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:28:29 -0700 Subject: * print.c (Fredirect_debugging_output): Fix pointer signedess. --- src/ChangeLog | 2 ++ src/print.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5f02fa1188d..690a585b641 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Paul Eggert + * print.c (Fredirect_debugging_output): Fix pointer signedess. + * lisp.h (debug_output_compilation_hack): Add decl here, to avoid warning when compiling print.c. diff --git a/src/print.c b/src/print.c index 29a4bfab790..b2e5965cd1c 100644 --- a/src/print.c +++ b/src/print.c @@ -854,7 +854,7 @@ append to existing target file. */) { file = Fexpand_file_name (file, Qnil); initial_stderr_stream = stderr; - stderr = fopen (SDATA (file), NILP (append) ? "w" : "a"); + stderr = fopen (SSDATA (file), NILP (append) ? "w" : "a"); if (stderr == NULL) { stderr = initial_stderr_stream; -- cgit v1.2.1 From cef2010db4a6e9f7264e60620c0e84123245e696 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:29:13 -0700 Subject: * lread.c (read1): Rewrite so as not to use empty "else". --- src/ChangeLog | 2 ++ src/lread.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 690a585b641..8bdb71c582b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-16 Paul Eggert + * lread.c (read1): Rewrite so as not to use empty "else". + * print.c (Fredirect_debugging_output): Fix pointer signedess. * lisp.h (debug_output_compilation_hack): Add decl here, to avoid diff --git a/src/lread.c b/src/lread.c index 3c5b627f98c..a287ed0e4bd 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2781,8 +2781,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) p = read_buffer + nchars; } else - /* Otherwise, READ_BUFFER contains only ASCII. */ - ; + { + /* Otherwise, READ_BUFFER contains only ASCII. */ + } /* We want readchar_count to be the number of characters, not bytes. Hence we adjust for multibyte characters in the -- cgit v1.2.1 From a6670b0ba2834d8996162596a55e09b1428e4ee6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:34:32 -0700 Subject: * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/character.h | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8bdb71c582b..e68f478cb40 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-16 Paul Eggert + * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS): + Rename locals to avoid shadowing. + * lread.c (read1): Rewrite so as not to use empty "else". * print.c (Fredirect_debugging_output): Fix pointer signedess. diff --git a/src/character.h b/src/character.h index 77c670728d0..4c468e14d2c 100644 --- a/src/character.h +++ b/src/character.h @@ -397,11 +397,11 @@ along with GNU Emacs. If not, see . */ #define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \ do \ { \ - unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ - int len; \ + unsigned char *fetch_ptr = &SDATA (STRING)[BYTEIDX]; \ + int fetch_len; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (fetch_ptr, fetch_len); \ + BYTEIDX += fetch_len; \ CHARIDX++; \ } \ while (0) @@ -510,8 +510,8 @@ along with GNU Emacs. If not, see . */ #define BUF_INC_POS(buf, pos_byte) \ do { \ - unsigned char *p = BUF_BYTE_ADDRESS (buf, pos_byte); \ - pos_byte += BYTES_BY_CHAR_HEAD (*p); \ + unsigned char *bbp = BUF_BYTE_ADDRESS (buf, pos_byte); \ + pos_byte += BYTES_BY_CHAR_HEAD (*bbp); \ } while (0) -- cgit v1.2.1 From 0902fe454066bb22a1c3874bb8d58693f39b78df Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:40:51 -0700 Subject: * lread.c (Fload, readevalloop, read1): Rename locals to avoid shadowing. --- src/ChangeLog | 1 + src/lread.c | 58 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 30 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e68f478cb40..95cbf19dbd4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ Rename locals to avoid shadowing. * lread.c (read1): Rewrite so as not to use empty "else". + (Fload, readevalloop, read1): Rename locals to avoid shadowing. * print.c (Fredirect_debugging_output): Fix pointer signedess. diff --git a/src/lread.c b/src/lread.c index a287ed0e4bd..a5fd1513c39 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1020,10 +1020,10 @@ Return t if the file exists and loads successfully. */) Also, just loading a file recursively is not always an error in the general case; the second load may do something different. */ { - int count = 0; + int load_count = 0; Lisp_Object tem; for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem)) - if (!NILP (Fequal (found, XCAR (tem))) && (++count > 3)) + if (!NILP (Fequal (found, XCAR (tem))) && (++load_count > 3)) { if (fd >= 0) emacs_close (fd); @@ -1654,8 +1654,8 @@ readevalloop (Lisp_Object readcharfun, to a different value when evaluated. */ if (BUFFERP (readcharfun)) { - struct buffer *b = XBUFFER (readcharfun); - if (BUF_PT (b) == BUF_ZV (b)) + struct buffer *buf = XBUFFER (readcharfun); + if (BUF_PT (buf) == BUF_ZV (buf)) continue_reading_p = 0; } } @@ -2674,7 +2674,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) { char *p = read_buffer; char *end = read_buffer + read_buffer_size; - register int c; + register int ch; /* Nonzero if we saw an escape sequence specifying a multibyte character. */ int force_multibyte = 0; @@ -2684,8 +2684,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) int cancel = 0; int nchars = 0; - while ((c = READCHAR) >= 0 - && c != '\"') + while ((ch = READCHAR) >= 0 + && ch != '\"') { if (end - p < MAX_MULTIBYTE_LENGTH) { @@ -2696,44 +2696,44 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) end = read_buffer + read_buffer_size; } - if (c == '\\') + if (ch == '\\') { int modifiers; - c = read_escape (readcharfun, 1); + ch = read_escape (readcharfun, 1); - /* C is -1 if \ newline has just been seen */ - if (c == -1) + /* CH is -1 if \ newline has just been seen */ + if (ch == -1) { if (p == read_buffer) cancel = 1; continue; } - modifiers = c & CHAR_MODIFIER_MASK; - c = c & ~CHAR_MODIFIER_MASK; + modifiers = ch & CHAR_MODIFIER_MASK; + ch = ch & ~CHAR_MODIFIER_MASK; - if (CHAR_BYTE8_P (c)) + if (CHAR_BYTE8_P (ch)) force_singlebyte = 1; - else if (! ASCII_CHAR_P (c)) + else if (! ASCII_CHAR_P (ch)) force_multibyte = 1; - else /* i.e. ASCII_CHAR_P (c) */ + else /* i.e. ASCII_CHAR_P (ch) */ { /* Allow `\C- ' and `\C-?'. */ if (modifiers == CHAR_CTL) { - if (c == ' ') - c = 0, modifiers = 0; - else if (c == '?') - c = 127, modifiers = 0; + if (ch == ' ') + ch = 0, modifiers = 0; + else if (ch == '?') + ch = 127, modifiers = 0; } if (modifiers & CHAR_SHIFT) { /* Shift modifier is valid only with [A-Za-z]. */ - if (c >= 'A' && c <= 'Z') + if (ch >= 'A' && ch <= 'Z') modifiers &= ~CHAR_SHIFT; - else if (c >= 'a' && c <= 'z') - c -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT; + else if (ch >= 'a' && ch <= 'z') + ch -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT; } if (modifiers & CHAR_META) @@ -2741,7 +2741,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) /* Move the meta bit to the right place for a string. */ modifiers &= ~CHAR_META; - c = BYTE8_TO_CHAR (c | 0x80); + ch = BYTE8_TO_CHAR (ch | 0x80); force_singlebyte = 1; } } @@ -2749,20 +2749,20 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) /* Any modifiers remaining are invalid. */ if (modifiers) error ("Invalid modifier in string"); - p += CHAR_STRING (c, (unsigned char *) p); + p += CHAR_STRING (ch, (unsigned char *) p); } else { - p += CHAR_STRING (c, (unsigned char *) p); - if (CHAR_BYTE8_P (c)) + p += CHAR_STRING (ch, (unsigned char *) p); + if (CHAR_BYTE8_P (ch)) force_singlebyte = 1; - else if (! ASCII_CHAR_P (c)) + else if (! ASCII_CHAR_P (ch)) force_multibyte = 1; } nchars++; } - if (c < 0) + if (ch < 0) end_of_file_error (); /* If purifying, and string starts with \ newline, -- cgit v1.2.1 From 01f44d5a68abccff781109300abf0616949b99c5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:43:38 -0700 Subject: * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/syntax.c | 15 +++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 95cbf19dbd4..46a9daf13e8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-16 Paul Eggert + * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid + shadowing. + * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS): Rename locals to avoid shadowing. diff --git a/src/syntax.c b/src/syntax.c index 707c2c19f31..1a615d735e4 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -554,7 +554,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); comstart = (com2start || code == Scomment); - + /* Nasty cases with overlapping 2-char comment markers: - snmp-mode: -- c -- foo -- c -- --- c -- @@ -2363,7 +2363,7 @@ between them, return t; otherwise return nil. */) if (code == Scomment_fence) { /* Skip until first preceding unquoted comment_fence. */ - int found = 0; + int fence_found = 0; EMACS_INT ini = from, ini_byte = from_byte; while (1) @@ -2374,13 +2374,13 @@ between them, return t; otherwise return nil. */) if (SYNTAX (c) == Scomment_fence && !char_quoted (from, from_byte)) { - found = 1; + fence_found = 1; break; } else if (from == stop) break; } - if (found == 0) + if (fence_found == 0) { from = ini; /* Set point to ini + 1. */ from_byte = ini_byte; @@ -2669,12 +2669,12 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf /* We must record the comment style encountered so that later, we can match only the proper comment begin sequence of the same style. */ - int c1, other_syntax; + int c2, other_syntax; DEC_BOTH (from, from_byte); UPDATE_SYNTAX_TABLE_BACKWARD (from); code = Sendcomment; - c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); - other_syntax = SYNTAX_WITH_FLAGS (c1); + c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte); + other_syntax = SYNTAX_WITH_FLAGS (c2); comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); @@ -3528,4 +3528,3 @@ In both cases, LIMIT bounds the search. */); defsubr (&Sbackward_prefix_chars); defsubr (&Sparse_partial_sexp); } - -- cgit v1.2.1 From 4f63c6bb76e662fe8025969e0e16ab8906e0ba22 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 14:47:59 -0700 Subject: * syntax.c (back_comment, skip_chars): Mark vars as initialized. --- src/ChangeLog | 1 + src/syntax.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 46a9daf13e8..7bc0a8fcc49 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid shadowing. + (back_comment, skip_chars): Mark vars as initialized. * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS): Rename locals to avoid shadowing. diff --git a/src/syntax.c b/src/syntax.c index 1a615d735e4..c1442c396c1 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -513,7 +513,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested EMACS_INT comment_end = from; EMACS_INT comment_end_byte = from_byte; EMACS_INT comstart_pos = 0; - EMACS_INT comstart_byte; + EMACS_INT comstart_byte IF_LINT (= 0); /* Place where the containing defun starts, or 0 if we didn't come across it yet. */ EMACS_INT defun_start = 0; @@ -1421,7 +1421,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl register unsigned int c; unsigned char fastmap[0400]; /* Store the ranges of non-ASCII characters. */ - int *char_ranges; + int *char_ranges IF_LINT (= NULL); int n_char_ranges = 0; int negate = 0; register EMACS_INT i, i_byte; -- cgit v1.2.1 From ce701a3393e8f02410dc0d076d5ddf57ef324260 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 16:59:54 -0700 Subject: New file unexec.h, the (simple) interface for unexec. * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o): (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o): Depend on unexec.h. * emacs.c [!defined CANNOT_DUMP]: Include unexec.h. * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c: * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h. --- src/ChangeLog | 8 ++++++++ src/deps.mk | 18 +++++++++--------- src/emacs.c | 4 +--- src/unexaix.c | 2 ++ src/unexcoff.c | 2 ++ src/unexcw.c | 3 ++- src/unexelf.c | 2 ++ src/unexhp9k800.c | 3 ++- src/unexmacosx.c | 3 +++ src/unexsol.c | 2 ++ src/unexw32.c | 1 + 11 files changed, 34 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7bc0a8fcc49..14d3e37a8ee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2011-03-16 Paul Eggert + New file unexec.h, the (simple) interface for unexec. + * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o): + (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o): + Depend on unexec.h. + * emacs.c [!defined CANNOT_DUMP]: Include unexec.h. + * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c: + * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h. + * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid shadowing. (back_comment, skip_chars): Mark vars as initialized. diff --git a/src/deps.mk b/src/deps.mk index 80a5721cf39..c868ff0e3c0 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -93,7 +93,7 @@ editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \ globals.h ../lib/unistd.h window.h dispextern.h keyboard.h keymap.h \ - frame.h coding.h gnutls.h msdos.h + frame.h coding.h gnutls.h msdos.h unexec.h fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h \ commands.h globals.h ../lib/unistd.h @@ -200,15 +200,15 @@ terminfo.o: terminfo.c lisp.h globals.h $(config_h) tparam.o: tparam.c tparam.h lisp.h $(config_h) undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ lisp.h globals.h $(config_h) -unexaix.o: unexaix.c lisp.h $(config_h) +unexaix.o: unexaix.c lisp.h unexec.h $(config_h) unexalpha.o: unexalpha.c $(config_h) -unexcw.o: unexcw.c lisp.h $(config_h) -unexcoff.o: unexcoff.c lisp.h $(config_h) -unexelf.o: unexelf.c ../lib/unistd.h $(config_h) -unexhp9k800.o: unexhp9k800.c $(config_h) -unexmacosx.o: unexmacosx.c $(config_h) -unexsol.o: unexsol.c lisp.h $(config_h) -unexw32.o: unexw32.c $(config_h) +unexcw.o: unexcw.c lisp.h unexec.h $(config_h) +unexcoff.o: unexcoff.c lisp.h unexec.h $(config_h) +unexelf.o: unexelf.c unexec.h ../lib/unistd.h $(config_h) +unexhp9k800.o: unexhp9k800.c unexec.h $(config_h) +unexmacosx.o: unexmacosx.c unexec.h $(config_h) +unexsol.o: unexsol.c lisp.h unexec.h $(config_h) +unexw32.o: unexw32.c unexec.h $(config_h) w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \ msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h) widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \ diff --git a/src/emacs.c b/src/emacs.c index c49e38f7a67..d30d42f1ee4 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2085,9 +2085,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) #ifndef CANNOT_DUMP -/* FIXME: maybe this should go into header file, config.h seems the - only one appropriate. */ -extern int unexec (const char *, const char *); +#include "unexec.h" DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, doc: /* Dump current state of Emacs into executable file FILENAME. diff --git a/src/unexaix.c b/src/unexaix.c index fe9d13d3e47..612d7c1fecf 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -40,6 +40,8 @@ what you give them. Help stamp out software-hoarding! */ */ #include +#include "unexec.h" + #define PERROR(file) report_error (file, new) #include /* Define getpagesize () if the system does not. diff --git a/src/unexcoff.c b/src/unexcoff.c index 4dafabab689..1efde1a9cbc 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c @@ -50,6 +50,8 @@ along with GNU Emacs. If not, see . */ */ #include +#include "unexec.h" + #define PERROR(file) report_error (file, new) #ifndef CANNOT_DUMP /* all rest of file! */ diff --git a/src/unexcw.c b/src/unexcw.c index 02add901bbd..b5d72e61550 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ #include +#include "unexec.h" + #include #include #include @@ -299,4 +301,3 @@ unexec (const char *outfile, const char *infile) return (0); } - diff --git a/src/unexelf.c b/src/unexelf.c index 1009c87066b..182b9f8a16b 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -386,6 +386,8 @@ temacs: Instead we read the whole file, modify it, and write it out. */ #include +#include + extern void fatal (const char *msgid, ...); #include diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c index c0471992a72..9889ffd63fc 100644 --- a/src/unexhp9k800.c +++ b/src/unexhp9k800.c @@ -50,6 +50,8 @@ */ #include +#include "unexec.h" + #include #include #include @@ -319,4 +321,3 @@ display_header (hdr, auxhdr) hdr->unloadable_sp_location, hdr->unloadable_sp_size); } #endif /* DEBUG */ - diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 2e46c063e95..0df0bb8451d 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -95,6 +95,9 @@ along with GNU Emacs. If not, see . */ #undef malloc #undef realloc #undef free + +#include "unexec.h" + #include #include #include diff --git a/src/unexsol.c b/src/unexsol.c index e1a10f7d211..ae91c170859 100644 --- a/src/unexsol.c +++ b/src/unexsol.c @@ -1,6 +1,8 @@ /* Trivial unexec for Solaris. */ #include +#include "unexec.h" + #include #include diff --git a/src/unexw32.c b/src/unexw32.c index 829c864c960..c921cd657d5 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see . */ */ #include +#include "unexec.h" #include #include -- cgit v1.2.1 From 7feda0d218772bf0917631f4bad843e2b4a83984 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 17:03:31 -0700 Subject: * unexec.h: New file. --- src/ChangeLog | 1 + src/unexec.h | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/unexec.h (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 14d3e37a8ee..168f2d72612 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-16 Paul Eggert New file unexec.h, the (simple) interface for unexec. + * unexec.h: New file. * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o): (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o): Depend on unexec.h. diff --git a/src/unexec.h b/src/unexec.h new file mode 100644 index 00000000000..343eb6d8db5 --- /dev/null +++ b/src/unexec.h @@ -0,0 +1 @@ +void unexec (const char *, const char *); -- cgit v1.2.1 From 29a6015ab3af5afe65a112b7447e343133783f5e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 17:22:09 -0700 Subject: * deps.mk (unexalpha.o): Remove; unused. --- src/ChangeLog | 4 ++++ src/deps.mk | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 168f2d72612..5a3ea2f71d0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-17 Paul Eggert + + * deps.mk (unexalpha.o): Remove; unused. + 2011-03-16 Paul Eggert New file unexec.h, the (simple) interface for unexec. diff --git a/src/deps.mk b/src/deps.mk index c868ff0e3c0..35754dfa7de 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -201,7 +201,6 @@ tparam.o: tparam.c tparam.h lisp.h $(config_h) undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ lisp.h globals.h $(config_h) unexaix.o: unexaix.c lisp.h unexec.h $(config_h) -unexalpha.o: unexalpha.c $(config_h) unexcw.o: unexcw.c lisp.h unexec.h $(config_h) unexcoff.o: unexcoff.c lisp.h unexec.h $(config_h) unexelf.o: unexelf.c unexec.h ../lib/unistd.h $(config_h) -- cgit v1.2.1 From 43cfc33e3d04f339d929da933f131694821ad6f9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 18:49:15 -0700 Subject: Add Bug#. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5a3ea2f71d0..6bb4021b876 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,7 +4,7 @@ 2011-03-16 Paul Eggert - New file unexec.h, the (simple) interface for unexec. + New file unexec.h, the (simple) interface for unexec (Bug#8267). * unexec.h: New file. * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o): (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o): -- cgit v1.2.1 From b3967b18cddd39cd736af29db48096716f35fbdf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 18:52:35 -0700 Subject: * unexelf.c (unexec): Name an expression, to avoid gcc -Wbad-function-cast warning. --- src/ChangeLog | 3 +++ src/unexelf.c | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6bb4021b876..dc3074697e3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-17 Paul Eggert + * unexelf.c (unexec): Name an expression, + to avoid gcc -Wbad-function-cast warning. + * deps.mk (unexalpha.o): Remove; unused. 2011-03-16 Paul Eggert diff --git a/src/unexelf.c b/src/unexelf.c index 182b9f8a16b..01d41a15d50 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -625,6 +625,10 @@ unexec (const char *new_name, const char *old_name) { int new_file, old_file, new_file_size; +#if defined (emacs) || !defined (DEBUG) + void *new_break; +#endif + /* Pointers to the base of the image of the two files. */ caddr_t old_base, new_base; @@ -755,7 +759,8 @@ unexec (const char *new_name, const char *old_name) old_name, old_file_h, old_section_h, 0); #if defined (emacs) || !defined (DEBUG) - new_bss_addr = (ElfW(Addr)) sbrk (0); + new_break = sbrk (0); + new_bss_addr = (ElfW(Addr)) new_break; #else new_bss_addr = old_bss_addr + old_bss_size + 0x1234; #endif @@ -956,13 +961,13 @@ temacs: Link Info Adralgn Entsize [22] 1 3 0x335150 0x315150 0x4 .data.rel.local - 0 0 0x4 0 + 0 0 0x4 0 [23] 8 3 0x335158 0x315158 0x42720 .bss - 0 0 0x8 0 + 0 0 0x8 0 [24] 2 0 0 0x315154 0x1c9d0 .symtab - 25 1709 0x4 0x10 + 25 1709 0x4 0x10 */ if (NEW_SECTION_H (nn).sh_offset >= old_bss_offset @@ -1309,4 +1314,3 @@ temacs: if (chmod (new_name, stat_buf.st_mode) == -1) fatal ("Can't chmod (%s): errno %d\n", new_name, errno); } - -- cgit v1.2.1 From 9ae7151257f2457c0a6d89fb2b97f59fb18f1b96 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 19:07:47 -0700 Subject: * unexelf.c: Use a different way to cause a compilation error if anyone uses n rather than nn, a way that does not involve shadowing. --- src/ChangeLog | 2 ++ src/unexelf.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dc3074697e3..8832388994c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * unexelf.c (unexec): Name an expression, to avoid gcc -Wbad-function-cast warning. + Use a different way to cause a compilation error if anyone uses + n rather than nn, a way that does not involve shadowing. * deps.mk (unexalpha.o): Remove; unused. diff --git a/src/unexelf.c b/src/unexelf.c index 01d41a15d50..3e664307d59 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -1235,8 +1235,8 @@ temacs: ElfW(Shdr) section = NEW_SECTION_H (n); /* Cause a compilation error if anyone uses n instead of nn below. */ - struct {int a;} n; - (void)n.a; /* Prevent `unused variable' warnings. */ + #define n ((void) 0); + n /* Prevent 'macro "n" is not used' warnings. */ switch (section.sh_type) { @@ -1283,6 +1283,8 @@ temacs: } break; } + + #undef n } /* Write out new_file, and free the buffers. */ -- cgit v1.2.1 From 73366a004b663bed19b9bc9b83e8843c836db83f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 19:09:36 -0700 Subject: * unexelf.c (ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused. --- src/ChangeLog | 1 + src/unexelf.c | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8832388994c..5abc9b66475 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ to avoid gcc -Wbad-function-cast warning. Use a different way to cause a compilation error if anyone uses n rather than nn, a way that does not involve shadowing. + (ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused. * deps.mk (unexalpha.o): Remove; unused. diff --git a/src/unexelf.c b/src/unexelf.c index 3e664307d59..b58c78501b8 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -520,10 +520,6 @@ typedef struct { # define ElfW(type) ElfExpandBitsW (ELFSIZE, type) #endif -#ifndef ELF_BSS_SECTION_NAME -#define ELF_BSS_SECTION_NAME ".bss" -#endif - /* Get the address of a particular section or program header entry, * accounting for the size of the entries. */ @@ -555,8 +551,6 @@ typedef struct { (*(ElfW(Shdr) *) ((byte *) old_section_h + old_file_h->e_shentsize * (n))) #define NEW_SECTION_H(n) \ (*(ElfW(Shdr) *) ((byte *) new_section_h + new_file_h->e_shentsize * (n))) -#define OLD_PROGRAM_H(n) \ - (*(ElfW(Phdr) *) ((byte *) old_program_h + old_file_h->e_phentsize * (n))) #define NEW_PROGRAM_H(n) \ (*(ElfW(Phdr) *) ((byte *) new_program_h + new_file_h->e_phentsize * (n))) -- cgit v1.2.1 From 7914961cd705c8a88734ff87c581924bf48c3fe3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 19:11:29 -0700 Subject: * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else". --- src/ChangeLog | 2 ++ src/bytecode.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5abc9b66475..9dcab33fed5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-17 Paul Eggert + * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else". + * unexelf.c (unexec): Name an expression, to avoid gcc -Wbad-function-cast warning. Use a different way to cause a compilation error if anyone uses diff --git a/src/bytecode.c b/src/bytecode.c index bb4e87c019d..fca8a8e1ebe 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -363,6 +363,7 @@ unmark_byte_stack (void) We do this at every branch, to avoid loops that never GC. */ #define MAYBE_GC() \ + do { \ if (consing_since_gc > gc_cons_threshold \ && consing_since_gc > gc_relative_threshold) \ { \ @@ -370,7 +371,7 @@ unmark_byte_stack (void) Fgarbage_collect (); \ AFTER_POTENTIAL_GC (); \ } \ - else + } while (0) /* Check for jumping out of range. */ -- cgit v1.2.1 From 615f2d59a5ee849bc46c3fa57d41fd136f2d0962 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 19:18:00 -0700 Subject: * bytecode.c (CONSTANTLIM): Remove; unused. (METER_CODE, Bscan_buffer, Bread_char, Bset_mark): Define only if needed. --- src/ChangeLog | 3 +++ src/bytecode.c | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9dcab33fed5..fa08263a80a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,9 @@ 2011-03-17 Paul Eggert * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else". + (CONSTANTLIM): Remove; unused. + (METER_CODE, Bscan_buffer, Bread_char, Bset_mark): + Define only if needed. * unexelf.c (unexec): Name an expression, to avoid gcc -Wbad-function-cast warning. diff --git a/src/bytecode.c b/src/bytecode.c index fca8a8e1ebe..ce2f06dfccb 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -76,11 +76,7 @@ Lisp_Object Qbyte_code_meter; } \ } -#else /* no BYTE_CODE_METER */ - -#define METER_CODE(last_code, this_code) - -#endif /* no BYTE_CODE_METER */ +#endif /* BYTE_CODE_METER */ Lisp_Object Qbytecode; @@ -146,7 +142,9 @@ Lisp_Object Qbytecode; #define Bpreceding_char 0150 #define Bcurrent_column 0151 #define Bindent_to 0152 +#ifdef BYTE_CODE_SAFE #define Bscan_buffer 0153 /* No longer generated as of v18 */ +#endif #define Beolp 0154 #define Beobp 0155 #define Bbolp 0156 @@ -154,8 +152,12 @@ Lisp_Object Qbytecode; #define Bcurrent_buffer 0160 #define Bset_buffer 0161 #define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer. */ +#if 0 #define Bread_char 0162 /* No longer generated as of v19 */ +#endif +#ifdef BYTE_CODE_SAFE #define Bset_mark 0163 /* this loser is no longer generated as of v18 */ +#endif #define Binteractive_p 0164 /* Needed since interactive-p takes unevalled args */ #define Bforward_char 0165 @@ -227,7 +229,6 @@ Lisp_Object Qbytecode; #define BinsertN 0261 #define Bconstant 0300 -#define CONSTANTLIM 0100 /* Whether to maintain a `top' and `bottom' field in the stack frame. */ #define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK) -- cgit v1.2.1 From 57048744037204ae0cef40cdca9d8a967a4e1407 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 19:36:27 -0700 Subject: * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling. * process.c (allocate_pty): Don't declare stb unless it's needed. --- src/ChangeLog | 3 +++ src/process.c | 2 +- src/s/irix6-5.h | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fa08263a80a..45cb41024ae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-17 Paul Eggert + * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling. + * process.c (allocate_pty): Don't declare stb unless it's needed. + * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else". (CONSTANTLIM): Remove; unused. (METER_CODE, Bscan_buffer, Bread_char, Bset_mark): diff --git a/src/process.c b/src/process.c index 39fa26e8b54..a026174bd23 100644 --- a/src/process.c +++ b/src/process.c @@ -545,7 +545,6 @@ allocate_pty (void) for (i = 0; i < 16; i++) #endif { - struct stat stb; /* Used in some PTY_OPEN. */ #ifdef PTY_NAME_SPRINTF PTY_NAME_SPRINTF #else @@ -562,6 +561,7 @@ allocate_pty (void) three failures in a row before deciding that we've reached the end of the ptys. */ int failed_count = 0; + struct stat stb; if (stat (pty_name, &stb) < 0) { diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h index 92465ded2ef..d283571d8fb 100644 --- a/src/s/irix6-5.h +++ b/src/s/irix6-5.h @@ -60,6 +60,7 @@ char *_getpty(); #define PTY_OPEN \ { \ struct sigaction ocstat, cstat; \ + struct stat stb; \ char * name; \ sigemptyset(&cstat.sa_mask); \ cstat.sa_handler = SIG_DFL; \ @@ -95,5 +96,3 @@ char *_getpty(); /* Tested on Irix 6.5. SCM worked on earlier versions. */ #define GC_SETJMP_WORKS 1 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS - - -- cgit v1.2.1 From be02381c5db4236f51f474726003d5a97bbc61f7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 22:15:08 -0700 Subject: * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars. That way, the code declares only the vars that it needs. * s/aix4-2.h (PTY_ITERATION): Declare iteration vars. * s/cygwin.h (PTY_ITERATION): Likewise. * s/darwin.h (PTY_ITERATION): Likewise. * s/gnu-linux.h (PTY_ITERATION): Likewise. --- src/ChangeLog | 7 +++++++ src/process.c | 2 +- src/s/aix4-2.h | 2 +- src/s/cygwin.h | 3 +-- src/s/darwin.h | 3 +-- src/s/gnu-linux.h | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 45cb41024ae..7e7556f0e85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2011-03-17 Paul Eggert + * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars. + That way, the code declares only the vars that it needs. + * s/aix4-2.h (PTY_ITERATION): Declare iteration vars. + * s/cygwin.h (PTY_ITERATION): Likewise. + * s/darwin.h (PTY_ITERATION): Likewise. + * s/gnu-linux.h (PTY_ITERATION): Likewise. + * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling. * process.c (allocate_pty): Don't declare stb unless it's needed. diff --git a/src/process.c b/src/process.c index a026174bd23..ab340867150 100644 --- a/src/process.c +++ b/src/process.c @@ -535,12 +535,12 @@ static char pty_name[24]; static int allocate_pty (void) { - register int c, i; int fd; #ifdef PTY_ITERATION PTY_ITERATION #else + register int c, i; for (c = FIRST_PTY_LETTER; c <= 'z'; c++) for (i = 0; i < 16; i++) #endif diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index 443fc034570..c2715fffe01 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h @@ -32,7 +32,7 @@ along with GNU Emacs. If not, see . */ /* In AIX, you allocate a pty by opening /dev/ptc to get the master side. To get the name of the slave side, you just ttyname() the master side. */ -#define PTY_ITERATION for (c = 0; !c ; c++) +#define PTY_ITERATION int c; for (c = 0; !c ; c++) #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc"); #define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); diff --git a/src/s/cygwin.h b/src/s/cygwin.h index ceebe23f1e7..af5308ff7bb 100644 --- a/src/s/cygwin.h +++ b/src/s/cygwin.h @@ -46,7 +46,7 @@ along with GNU Emacs. If not, see . */ /* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS -#define PTY_ITERATION for (i = 0; i < 1; i++) /* ick */ +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) /* ick */ #define PTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */ #define PTY_OPEN \ @@ -102,4 +102,3 @@ along with GNU Emacs. If not, see . */ /* Send signals to subprocesses by "typing" special chars at them. */ #define SIGNALS_VIA_CHARACTERS - diff --git a/src/s/darwin.h b/src/s/darwin.h index 4fc2f4d1031..dd0d0c34021 100644 --- a/src/s/darwin.h +++ b/src/s/darwin.h @@ -68,7 +68,7 @@ along with GNU Emacs. If not, see . */ Note: PTYs are broken on darwin <6. Use at your own risk. */ #define HAVE_PTYS /* Run only once. We need a `for'-loop because the code uses `continue'. */ -#define PTY_ITERATION for (i = 0; i < 1; i++) +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) #define PTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */ /* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8. @@ -148,4 +148,3 @@ along with GNU Emacs. If not, see . */ /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS - diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h index 84fe5b92da9..178d7082f72 100644 --- a/src/s/gnu-linux.h +++ b/src/s/gnu-linux.h @@ -44,7 +44,7 @@ along with GNU Emacs. If not, see . */ #define UNIX98_PTYS /* Run only once. We need a `for'-loop because the code uses `continue'. */ -#define PTY_ITERATION for (i = 0; i < 1; i++) +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) #ifdef HAVE_GETPT #define PTY_NAME_SPRINTF -- cgit v1.2.1 From b766f86726fc2828a035cb8db149598a3a84de96 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 22:18:33 -0700 Subject: * process.c (make_serial_process_unwind, send_process_trap): (sigchld_handler): Now static. --- src/ChangeLog | 3 +++ src/process.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7e7556f0e85..2b7d5289e67 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-17 Paul Eggert + * process.c (make_serial_process_unwind, send_process_trap): + (sigchld_handler): Now static. + * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars. That way, the code declares only the vars that it needs. * s/aix4-2.h (PTY_ITERATION): Declare iteration vars. diff --git a/src/process.c b/src/process.c index ab340867150..c9b420ab2ae 100644 --- a/src/process.c +++ b/src/process.c @@ -2724,7 +2724,8 @@ usage: (serial-process-configure &rest ARGS) */) } /* Used by make-serial-process to recover from errors. */ -Lisp_Object make_serial_process_unwind (Lisp_Object proc) +static Lisp_Object +make_serial_process_unwind (Lisp_Object proc) { if (!PROCESSP (proc)) abort (); @@ -5476,7 +5477,7 @@ read_process_output (Lisp_Object proc, register int channel) jmp_buf send_process_frame; Lisp_Object process_sent_to; -SIGTYPE +static SIGTYPE send_process_trap (int ignore) { SIGNAL_THREAD_CHECK (SIGPIPE); @@ -6385,7 +6386,7 @@ process has been transmitted to the serial port. */) indirectly; if it does, that is a bug */ #ifdef SIGCHLD -SIGTYPE +static SIGTYPE sigchld_handler (int signo) { int old_errno = errno; -- cgit v1.2.1 From 45763476fcc967a750bb2abe3bd7a43b7a19e537 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 17 Mar 2011 16:44:02 +0100 Subject: src/xfaces.c (Fx_load_color_file): Read color file from absolute filename. Fixes: debbugs:8250 --- src/ChangeLog | 5 +++++ src/xfaces.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 75958169951..49b37a843b6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-17 Juanma Barranquero + + * xfaces.c (Fx_load_color_file): + Read color file from absolute filename (bug#8250). + 2011-03-11 Juanma Barranquero Backport revno:103582 from trunk. diff --git a/src/xfaces.c b/src/xfaces.c index e9e677d1b19..9956ef55842 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6625,7 +6625,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) CHECK_STRING (filename); abspath = Fexpand_file_name (filename, Qnil); - fp = fopen (SDATA (filename), "rt"); + fp = fopen (SDATA (abspath), "rt"); if (fp) { char buf[512]; -- cgit v1.2.1 From 381259ef0debba4c0bb07bb5473467c1d4d84223 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 11:41:30 -0700 Subject: Change unexec implementations to match prototype. --- src/ChangeLog | 1 + src/unexaix.c | 6 ++---- src/unexcoff.c | 5 +---- src/unexcw.c | 5 +---- src/unexhp9k800.c | 3 +-- src/unexmacosx.c | 4 +--- src/unexsol.c | 5 ++--- src/unexw32.c | 5 +---- 8 files changed, 10 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d97969c24db..acc3f0308ed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -36,6 +36,7 @@ * emacs.c [!defined CANNOT_DUMP]: Include unexec.h. * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c: * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h. + Change as necessary to match prototype in unexec.h. * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid shadowing. diff --git a/src/unexaix.c b/src/unexaix.c index 612d7c1fecf..e6aad2db775 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -121,7 +121,8 @@ static void write_segment (int, char *, char *); * * driving logic. */ -int unexec (const char *new_name, const char *a_name) +void +unexec (const char *new_name, const char *a_name) { int new = -1, a_out = -1; @@ -141,14 +142,12 @@ int unexec (const char *new_name, const char *a_name) || unrelocate_symbols (new, a_out, a_name, new_name) < 0) { close (new); - return -1; } close (new); if (a_out >= 0) close (a_out); mark_x (new_name); - return 0; } /* **************************************************************** @@ -639,4 +638,3 @@ start_of_text (void) { return ((char *) 0x10000000); } - diff --git a/src/unexcoff.c b/src/unexcoff.c index 1efde1a9cbc..03b0015e6b9 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c @@ -524,7 +524,7 @@ adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name) * * driving logic. */ -int +void unexec (const char *new_name, const char *a_name) { int new = -1, a_out = -1; @@ -545,15 +545,12 @@ unexec (const char *new_name, const char *a_name) ) { close (new); - return -1; } close (new); if (a_out >= 0) close (a_out); mark_x (new_name); - return 0; } #endif /* not CANNOT_DUMP */ - diff --git a/src/unexcw.c b/src/unexcw.c index b5d72e61550..1202e046024 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -249,7 +249,7 @@ add_exe_suffix_if_necessary (const char *name, char *modified) return (modified); } -int +void unexec (const char *outfile, const char *infile) { char infile_buffer[FILENAME_MAX]; @@ -263,7 +263,6 @@ unexec (const char *outfile, const char *infile) { /* can only dump once */ printf ("You can only dump Emacs once on this platform.\n"); - return (1); } report_sheap_usage (1); @@ -298,6 +297,4 @@ unexec (const char *outfile, const char *infile) ret = close (fd_out); assert (ret == 0); - - return (0); } diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c index 9889ffd63fc..f27415a252c 100644 --- a/src/unexhp9k800.c +++ b/src/unexhp9k800.c @@ -76,7 +76,7 @@ run_time_remap (ignored) /* Create a new a.out file, same as old but with current data space */ -int +void unexec (const char *new_name, /* name of the new a.out file to be created */ const char *old_name) /* name of the old a.out file */ { @@ -133,7 +133,6 @@ unexec (const char *new_name, /* name of the new a.out file to be created * /* Close the binary file */ close (old); close (new); - return 0; } /* Save current data space in the file, update header. */ diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 0df0bb8451d..04e3edf463e 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -1227,7 +1227,7 @@ dump_it (void) from it. The file names of the output and input files are outfile and infile, respectively. The three other parameters are ignored. */ -int +void unexec (const char *outfile, const char *infile) { if (in_dumped_exec) @@ -1258,7 +1258,6 @@ unexec (const char *outfile, const char *infile) dump_it (); close (outfd); - return 0; } @@ -1383,4 +1382,3 @@ unexec_free (void *ptr) else malloc_zone_free (emacs_zone, (unexec_malloc_header_t *) ptr - 1); } - diff --git a/src/unexsol.c b/src/unexsol.c index ae91c170859..ef1e34e6f0f 100644 --- a/src/unexsol.c +++ b/src/unexsol.c @@ -11,14 +11,14 @@ #include "charset.h" #include "coding.h" -int +void unexec (const char *new_name, const char *old_name) { Lisp_Object data; Lisp_Object errstring; if (! dldump (0, new_name, RTLD_MEMORY)) - return 0; + return; data = Fcons (build_string (new_name), Qnil); synchronize_system_messages_locale (); @@ -28,4 +28,3 @@ unexec (const char *new_name, const char *old_name) xsignal (Qfile_error, Fcons (build_string ("Cannot unexec"), Fcons (errstring, data))); } - diff --git a/src/unexw32.c b/src/unexw32.c index c921cd657d5..cd8211d6bee 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -724,7 +724,7 @@ copy_executable_and_dump_data (file_data *p_infile, /* Dump out .data and .bss sections into a new executable. */ -int +void unexec (const char *new_name, const char *old_name) { file_data in_file, out_file; @@ -820,9 +820,6 @@ unexec (const char *new_name, const char *old_name) close_file_data (&in_file); close_file_data (&out_file); - - return 0; } /* eof */ - -- cgit v1.2.1 From 09f6ff021c99c2b80f39e6d8a54ef556ea108a83 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 17 Mar 2011 21:55:40 +0200 Subject: Update MS-Windows dependencies after 2011-03-17T18:41:30Z!eggert@cs.ucla.edu. src/makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h. --- src/ChangeLog | 4 ++++ src/makefile.w32-in | 1 + 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index acc3f0308ed..93c8245b239 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-17 Eli Zaretskii + + * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h. + 2011-03-17 Paul Eggert Fix more problems found by GCC 4.5.2's static checks. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 9916a884292..3d882b23d6b 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -1516,6 +1516,7 @@ $(BLD)/undo.$(O) : \ $(BLD)/unexw32.$(O) : \ $(SRC)/unexw32.c \ + $(SRC)/unexec.h \ $(CONFIG_H) \ $(SRC)/w32heap.h -- cgit v1.2.1 From fffe2e140420f75d6ad06ab9356b337570572b9b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 13:18:59 -0700 Subject: Restore failure returns to unexaix.c, unexcoff.c, unexcw.c --- src/unexaix.c | 1 + src/unexcoff.c | 1 + src/unexcw.c | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/unexaix.c b/src/unexaix.c index e6aad2db775..df4c5b8905c 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -142,6 +142,7 @@ unexec (const char *new_name, const char *a_name) || unrelocate_symbols (new, a_out, a_name, new_name) < 0) { close (new); + return; } close (new); diff --git a/src/unexcoff.c b/src/unexcoff.c index 03b0015e6b9..ef86a400239 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c @@ -545,6 +545,7 @@ unexec (const char *new_name, const char *a_name) ) { close (new); + return; } close (new); diff --git a/src/unexcw.c b/src/unexcw.c index 1202e046024..f643c196de0 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -263,6 +263,7 @@ unexec (const char *outfile, const char *infile) { /* can only dump once */ printf ("You can only dump Emacs once on this platform.\n"); + return; } report_sheap_usage (1); -- cgit v1.2.1 From f2b726e626e316bdf4728d2df44b94f6bf9635b2 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 19 Mar 2011 04:22:14 +0100 Subject: src/makefile.w32-in: Update dependencies. --- src/ChangeLog | 4 ++++ src/makefile.w32-in | 46 ++++++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 93c8245b239..8cbcaf4afbc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-19 Juanma Barranquero + + * makefile.w32-in: Update dependencies. + 2011-03-17 Eli Zaretskii * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 3d882b23d6b..62c40ca1f94 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -221,7 +221,7 @@ GLOBAL_SOURCES = dosfns.c msdos.c \ region-cache.c sound.c atimer.c \ doprnt.c intervals.c textprop.c composite.c SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ - xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o + xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o obj = $(GLOBAL_SOURCES:.c=.o) globals.h: gl-stamp @@ -386,6 +386,7 @@ $(BLD)/alloc.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -396,7 +397,6 @@ $(BLD)/alloc.$(O) : \ $(SRC)/frame.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/puresize.h \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ @@ -484,8 +484,10 @@ $(BLD)/callproc.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -497,7 +499,6 @@ $(BLD)/callproc.$(O) : \ $(SRC)/dispextern.h \ $(SRC)/epaths.h \ $(SRC)/frame.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/systty.h \ @@ -653,6 +654,7 @@ $(BLD)/dired.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/dir.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/lib/filemode.h \ $(LISP_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ @@ -662,7 +664,6 @@ $(BLD)/dired.$(O) : \ $(SRC)/coding.h \ $(SRC)/commands.h \ $(SRC)/composite.h \ - $(EMACS_ROOT)/lib/filemode.h \ $(SRC)/ndir.h \ $(SRC)/regex.h \ $(SRC)/systime.h @@ -673,6 +674,7 @@ $(BLD)/dispnew.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -687,7 +689,6 @@ $(BLD)/dispnew.$(O) : \ $(SRC)/indent.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/termchar.h \ @@ -726,8 +727,8 @@ $(BLD)/editfns.$(O) : \ $(EMACS_ROOT)/nt/inc/pwd.h \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ - $(EMACS_ROOT)/lib/strftime.h \ $(EMACS_ROOT)/lib/intprops.h \ + $(EMACS_ROOT)/lib/strftime.h \ $(LISP_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ @@ -747,8 +748,10 @@ $(BLD)/emacs.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -757,15 +760,14 @@ $(BLD)/emacs.$(O) : \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ $(SRC)/frame.h \ - $(SRC)/gnutls.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/systty.h \ $(SRC)/termhooks.h \ + $(SRC)/unexec.h \ $(SRC)/w32.h \ $(SRC)/w32gui.h \ $(SRC)/w32heap.h \ @@ -837,6 +839,7 @@ $(BLD)/fns.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/langinfo.h \ $(EMACS_ROOT)/nt/inc/nl_types.h \ + $(EMACS_ROOT)/nt/inc/stdint.h \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(EMACS_ROOT)/lib/md5.h \ @@ -1030,6 +1033,7 @@ $(BLD)/keyboard.$(O) : \ $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1044,7 +1048,6 @@ $(BLD)/keyboard.$(O) : \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ $(SRC)/macros.h \ - $(PROCESS_H) \ $(SRC)/puresize.h \ $(SRC)/syntax.h \ $(SRC)/syssignal.h \ @@ -1182,11 +1185,11 @@ $(BLD)/w32.$(O) : \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/coding.h \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ $(SRC)/ndir.h \ - $(PROCESS_H) \ $(SRC)/systime.h \ $(SRC)/w32.h \ $(SRC)/w32gui.h \ @@ -1225,11 +1228,11 @@ $(BLD)/w32proc.$(O) : \ $(EMACS_ROOT)/nt/inc/sys/file.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/character.h \ $(SRC)/coding.h \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ - $(PROCESS_H) \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ $(SRC)/syswait.h \ @@ -1261,6 +1264,7 @@ $(BLD)/print.$(O) : \ $(EMACS_ROOT)/lib/ftoastr.h \ $(EMACS_ROOT)/lib/intprops.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1274,7 +1278,6 @@ $(BLD)/print.$(O) : \ $(SRC)/frame.h \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/systime.h \ $(SRC)/termchar.h \ $(SRC)/termhooks.h \ @@ -1289,9 +1292,11 @@ $(BLD)/process.$(O) : \ $(EMACS_ROOT)/nt/inc/arpa/inet.h \ $(EMACS_ROOT)/nt/inc/netinet/in.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1302,7 +1307,6 @@ $(BLD)/process.$(O) : \ $(SRC)/dispextern.h \ $(SRC)/frame.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/sysselect.h \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ @@ -1415,10 +1419,12 @@ $(BLD)/sysdep.$(O) : \ $(EMACS_ROOT)/nt/inc/pwd.h \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(EMACS_ROOT)/lib/ignore-value.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/cm.h \ @@ -1427,7 +1433,6 @@ $(BLD)/sysdep.$(O) : \ $(SRC)/dispextern.h \ $(SRC)/frame.h \ $(SRC)/keyboard.h \ - $(PROCESS_H) \ $(SRC)/sysselect.h \ $(SRC)/syssignal.h \ $(SRC)/systime.h \ @@ -1445,6 +1450,7 @@ $(BLD)/term.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/atimer.h \ @@ -1500,9 +1506,9 @@ $(BLD)/textprop.$(O) : \ $(BLD)/tparam.$(O) : \ $(SRC)/tparam.c \ - $(SRC)/tparam.h \ $(CONFIG_H) \ - $(LISP_H) + $(LISP_H) \ + $(SRC)/tparam.h $(BLD)/undo.$(O) : \ $(SRC)/undo.c \ @@ -1516,8 +1522,8 @@ $(BLD)/undo.$(O) : \ $(BLD)/unexw32.$(O) : \ $(SRC)/unexw32.c \ - $(SRC)/unexec.h \ $(CONFIG_H) \ + $(SRC)/unexec.h \ $(SRC)/w32heap.h $(BLD)/vm-limit.$(O) : \ @@ -1557,6 +1563,7 @@ $(BLD)/xdisp.$(O) : \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1576,7 +1583,6 @@ $(BLD)/xdisp.$(O) : \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ $(SRC)/macros.h \ - $(PROCESS_H) \ $(SRC)/region-cache.h \ $(SRC)/systime.h \ $(SRC)/termchar.h \ @@ -1668,8 +1674,10 @@ $(BLD)/w32term.$(O) : \ $(SRC)/w32term.c \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/unistd.h \ + $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ + $(PROCESS_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -1686,7 +1694,6 @@ $(BLD)/w32term.$(O) : \ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ - $(PROCESS_H) \ $(SRC)/systime.h \ $(SRC)/systty.h \ $(SRC)/termchar.h \ @@ -1709,7 +1716,6 @@ $(BLD)/w32select.$(O) : \ $(SRC)/charset.h \ $(SRC)/coding.h \ $(SRC)/composite.h \ - $(SRC)/keyboard.h \ $(SRC)/systime.h \ $(SRC)/w32gui.h \ $(SRC)/w32heap.h \ -- cgit v1.2.1 From 20f5695598d3137257e24802479d003ea82eb5f9 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 19 Mar 2011 12:42:53 -0400 Subject: Backport fix for Bug#8219 from trunk. * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). These macros can no longer be used for assignment. * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign struct members directly, instead of using BUF_BEGV etc. (record_buffer_markers, fetch_buffer_markers): New functions for recording and fetching special buffer markers. (set_buffer_internal_1, set_buffer_temp): Use them. * lread.c (unreadchar): Use SET_BUF_PT_BOTH. * insdel.c (adjust_point): Use SET_BUF_PT_BOTH. * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH. (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH. * xdisp.c (hscroll_window_tree): (reconsider_clip_changes): Use PT instead of BUF_PT. --- src/ChangeLog | 22 +++++++ src/buffer.c | 187 +++++++++++++++++++++++++------------------------------- src/buffer.h | 42 ++++++++++--- src/insdel.c | 4 +- src/intervals.c | 16 ++--- src/lread.c | 6 +- src/xdisp.c | 4 +- 7 files changed, 148 insertions(+), 133 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 49b37a843b6..be81dd27584 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2011-03-19 Chong Yidong + + * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT) + (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). + These macros can no longer be used for assignment. + + * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign + struct members directly, instead of using BUF_BEGV etc. + (record_buffer_markers, fetch_buffer_markers): New functions for + recording and fetching special buffer markers. + (set_buffer_internal_1, set_buffer_temp): Use them. + + * lread.c (unreadchar): Use SET_BUF_PT_BOTH. + + * insdel.c (adjust_point): Use SET_BUF_PT_BOTH. + + * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH. + (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH. + + * xdisp.c (hscroll_window_tree): + (reconsider_clip_changes): Use PT instead of BUF_PT. + 2011-03-17 Juanma Barranquero * xfaces.c (Fx_load_color_file): diff --git a/src/buffer.c b/src/buffer.c index 9220527313d..e7759cb5255 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -371,15 +371,17 @@ even if it is dead. The return value is never nil. */) if (! BUF_BEG_ADDR (b)) buffer_memory_full (); - BUF_PT (b) = BEG; + b->pt = BEG; + b->begv = BEG; + b->zv = BEG; + b->pt_byte = BEG_BYTE; + b->begv_byte = BEG_BYTE; + b->zv_byte = BEG_BYTE; + BUF_GPT (b) = BEG; - BUF_BEGV (b) = BEG; - BUF_ZV (b) = BEG; - BUF_Z (b) = BEG; - BUF_PT_BYTE (b) = BEG_BYTE; BUF_GPT_BYTE (b) = BEG_BYTE; - BUF_BEGV_BYTE (b) = BEG_BYTE; - BUF_ZV_BYTE (b) = BEG_BYTE; + + BUF_Z (b) = BEG; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; BUF_CHARS_MODIFF (b) = 1; @@ -533,6 +535,53 @@ clone_per_buffer_values (from, to) to->local_var_alist = buffer_lisp_local_variables (from); } + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, update these markers. */ + +static void +record_buffer_markers (struct buffer *b) +{ + if (! NILP (b->pt_marker)) + { + Lisp_Object buffer; + + eassert (!NILP (b->begv_marker)); + eassert (!NILP (b->zv_marker)); + + XSETBUFFER (buffer, b); + set_marker_both (b->pt_marker, buffer, b->pt, b->pt_byte); + set_marker_both (b->begv_marker, buffer, b->begv, b->begv_byte); + set_marker_both (b->zv_marker, buffer, b->zv, b->zv_byte); + } +} + + +/* If buffer B has markers to record PT, BEGV and ZV when it is not + current, fetch these values into B->begv etc. */ + +static void +fetch_buffer_markers (struct buffer *b) +{ + if (! NILP (b->pt_marker)) + { + Lisp_Object m; + + eassert (!NILP (b->begv_marker)); + eassert (!NILP (b->zv_marker)); + + m = b->pt_marker; + SET_BUF_PT_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = b->begv_marker; + SET_BUF_BEGV_BOTH (b, marker_position (m), marker_byte_position (m)); + + m = b->zv_marker; + SET_BUF_ZV_BOTH (b, marker_position (m), marker_byte_position (m)); + } +} + + DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 2, 3, "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", @@ -572,12 +621,12 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Use the base buffer's text object. */ b->text = b->base_buffer->text; - BUF_BEGV (b) = BUF_BEGV (b->base_buffer); - BUF_ZV (b) = BUF_ZV (b->base_buffer); - BUF_PT (b) = BUF_PT (b->base_buffer); - BUF_BEGV_BYTE (b) = BUF_BEGV_BYTE (b->base_buffer); - BUF_ZV_BYTE (b) = BUF_ZV_BYTE (b->base_buffer); - BUF_PT_BYTE (b) = BUF_PT_BYTE (b->base_buffer); + b->pt = b->base_buffer->pt; + b->begv = b->base_buffer->begv; + b->zv = b->base_buffer->zv; + b->pt_byte = b->base_buffer->pt_byte; + b->begv_byte = b->base_buffer->begv_byte; + b->zv_byte = b->base_buffer->zv_byte; b->newline_cache = 0; b->width_run_cache = 0; @@ -607,24 +656,23 @@ CLONE nil means the indirect buffer's state is reset to default values. */) /* Make sure the base buffer has markers for its narrowing. */ if (NILP (b->base_buffer->pt_marker)) { + eassert (NILP (b->base_buffer->begv_marker)); + eassert (NILP (b->base_buffer->zv_marker)); + b->base_buffer->pt_marker = Fmake_marker (); set_marker_both (b->base_buffer->pt_marker, base_buffer, - BUF_PT (b->base_buffer), - BUF_PT_BYTE (b->base_buffer)); - } - if (NILP (b->base_buffer->begv_marker)) - { + b->base_buffer->pt, + b->base_buffer->pt_byte); + b->base_buffer->begv_marker = Fmake_marker (); set_marker_both (b->base_buffer->begv_marker, base_buffer, - BUF_BEGV (b->base_buffer), - BUF_BEGV_BYTE (b->base_buffer)); - } - if (NILP (b->base_buffer->zv_marker)) - { + b->base_buffer->begv, + b->base_buffer->begv_byte); + b->base_buffer->zv_marker = Fmake_marker (); set_marker_both (b->base_buffer->zv_marker, base_buffer, - BUF_ZV (b->base_buffer), - BUF_ZV_BYTE (b->base_buffer)); + b->base_buffer->zv, + b->base_buffer->zv_byte); XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; } @@ -632,11 +680,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */) { /* Give the indirect buffer markers for its narrowing. */ b->pt_marker = Fmake_marker (); - set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); + set_marker_both (b->pt_marker, buf, b->pt, b->pt_byte); b->begv_marker = Fmake_marker (); - set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + set_marker_both (b->begv_marker, buf, b->begv, b->begv_byte); b->zv_marker = Fmake_marker (); - set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + set_marker_both (b->zv_marker, buf, b->zv, b->zv_byte); XMARKER (b->zv_marker)->insertion_type = 1; } else @@ -1890,27 +1938,7 @@ set_buffer_internal_1 (b) /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (old_buf->begv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (old_buf->zv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } + record_buffer_markers (old_buf); } /* Get the undo list from the base buffer, so that it appears @@ -1920,21 +1948,7 @@ set_buffer_internal_1 (b) /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) - { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); - } - if (! NILP (b->begv_marker)) - { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); - } - if (! NILP (b->zv_marker)) - { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); - } + fetch_buffer_markers (b); /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ @@ -1984,50 +1998,13 @@ set_buffer_temp (b) old_buf = current_buffer; current_buffer = b; - if (old_buf) - { - /* If the old current buffer has markers to record PT, BEGV and ZV - when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, - BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); - } - if (! NILP (old_buf->begv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, - BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); - } - if (! NILP (old_buf->zv_marker)) - { - Lisp_Object obuf; - XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, - BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); - } - } + /* If the old current buffer has markers to record PT, BEGV and ZV + when it is not current, update them now. */ + record_buffer_markers (old_buf); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) - { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); - } - if (! NILP (b->begv_marker)) - { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); - } - if (! NILP (b->zv_marker)) - { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); - } + fetch_buffer_markers (b); } DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, diff --git a/src/buffer.h b/src/buffer.h index 21854571670..56d0422b7e3 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -107,22 +107,46 @@ along with GNU Emacs. If not, see . */ #define BUF_BEG(buf) (BEG) #define BUF_BEG_BYTE(buf) (BEG_BYTE) +/* The BUF_BEGV[_BYTE], BUF_ZV[_BYTE], and BUF_PT[_BYTE] macros cannot + be used for assignment; use SET_BUF_* macros below for that. */ + /* Position of beginning of accessible range of buffer. */ -#define BUF_BEGV(buf) ((buf)->begv) -#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) +#define BUF_BEGV(buf) \ + (buf == current_buffer ? BEGV \ + : NILP (buf->begv_marker) ? buf->begv \ + : marker_position (buf->begv_marker)) + +#define BUF_BEGV_BYTE(buf) \ + (buf == current_buffer ? BEGV_BYTE \ + : NILP (buf->begv_marker) ? buf->begv_byte \ + : marker_byte_position (buf->begv_marker)) /* Position of point in buffer. */ -#define BUF_PT(buf) ((buf)->pt) -#define BUF_PT_BYTE(buf) ((buf)->pt_byte) +#define BUF_PT(buf) \ + (buf == current_buffer ? PT \ + : NILP (buf->pt_marker) ? buf->pt \ + : marker_position (buf->pt_marker)) + +#define BUF_PT_BYTE(buf) \ + (buf == current_buffer ? PT_BYTE \ + : NILP (buf->pt_marker) ? buf->pt_byte \ + : marker_byte_position (buf->pt_marker)) + +/* Position of end of accessible range of buffer. */ +#define BUF_ZV(buf) \ + (buf == current_buffer ? ZV \ + : NILP (buf->zv_marker) ? buf->zv \ + : marker_position (buf->zv_marker)) + +#define BUF_ZV_BYTE(buf) \ + (buf == current_buffer ? ZV_BYTE \ + : NILP (buf->zv_marker) ? buf->zv_byte \ + : marker_byte_position (buf->zv_marker)) /* Position of gap in buffer. */ #define BUF_GPT(buf) ((buf)->text->gpt) #define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) -/* Position of end of accessible range of buffer. */ -#define BUF_ZV(buf) ((buf)->zv) -#define BUF_ZV_BYTE(buf) ((buf)->zv_byte) - /* Position of end of buffer. */ #define BUF_Z(buf) ((buf)->text->z) #define BUF_Z_BYTE(buf) ((buf)->text->z_byte) @@ -230,8 +254,6 @@ extern void enlarge_buffer_text P_ ((struct buffer *, EMACS_INT)); /* Macros for setting the BEGV, ZV or PT of a given buffer. - SET_BUF_PT* seet to be redundant. Get rid of them? - The ..._BOTH macros take both a charpos and a bytepos, which must correspond to each other. diff --git a/src/insdel.c b/src/insdel.c index 7e0ba797fa8..b76a2d2271a 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -459,9 +459,7 @@ adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes) { - BUF_PT (current_buffer) += nchars; - BUF_PT_BYTE (current_buffer) += nbytes; - + SET_BUF_PT_BOTH (current_buffer, PT + nchars, PT_BYTE + nbytes); /* In a single-byte buffer, the two positions must be equal. */ eassert (PT_BYTE >= PT && PT_BYTE - PT <= ZV_BYTE - ZV); } diff --git a/src/intervals.c b/src/intervals.c index d47888b237c..fd8f3f55479 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -1949,8 +1949,7 @@ temp_set_point_both (struct buffer *buffer, if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer)) abort (); - BUF_PT_BYTE (buffer) = bytepos; - BUF_PT (buffer) = charpos; + SET_BUF_PT_BOTH (buffer, charpos, bytepos); } /* Set point in BUFFER to CHARPOS. If the target position is @@ -2366,10 +2365,9 @@ get_local_map (position, buffer, type) old_zv = BUF_ZV (buffer); old_begv_byte = BUF_BEGV_BYTE (buffer); old_zv_byte = BUF_ZV_BYTE (buffer); - BUF_BEGV (buffer) = BUF_BEG (buffer); - BUF_ZV (buffer) = BUF_Z (buffer); - BUF_BEGV_BYTE (buffer) = BUF_BEG_BYTE (buffer); - BUF_ZV_BYTE (buffer) = BUF_Z_BYTE (buffer); + + SET_BUF_BEGV_BOTH (buffer, BUF_BEG (buffer), BUF_BEG_BYTE (buffer)); + SET_BUF_ZV_BOTH (buffer, BUF_Z (buffer), BUF_Z_BYTE (buffer)); XSETFASTINT (lispy_position, position); XSETBUFFER (lispy_buffer, buffer); @@ -2383,10 +2381,8 @@ get_local_map (position, buffer, type) if (NILP (prop)) prop = get_pos_property (lispy_position, type, lispy_buffer); - BUF_BEGV (buffer) = old_begv; - BUF_ZV (buffer) = old_zv; - BUF_BEGV_BYTE (buffer) = old_begv_byte; - BUF_ZV_BYTE (buffer) = old_zv_byte; + SET_BUF_BEGV_BOTH (buffer, old_begv, old_begv_byte); + SET_BUF_ZV_BOTH (buffer, old_zv, old_zv_byte); /* Use the local map only if it is valid. */ prop = get_keymap (prop, 0, 0); diff --git a/src/lread.c b/src/lread.c index 8f1d4af8f36..2da64632417 100644 --- a/src/lread.c +++ b/src/lread.c @@ -458,15 +458,15 @@ unreadchar (readcharfun, c) else if (BUFFERP (readcharfun)) { struct buffer *b = XBUFFER (readcharfun); - int bytepos = BUF_PT_BYTE (b); + EMACS_INT charpos = BUF_PT (b); + EMACS_INT bytepos = BUF_PT_BYTE (b); - BUF_PT (b)--; if (! NILP (b->enable_multibyte_characters)) BUF_DEC_POS (b, bytepos); else bytepos--; - BUF_PT_BYTE (b) = bytepos; + SET_BUF_PT_BOTH (b, charpos - 1, bytepos); } else if (MARKERP (readcharfun)) { diff --git a/src/xdisp.c b/src/xdisp.c index c2af4d68b6e..ade95cf3d62 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10760,7 +10760,7 @@ hscroll_window_tree (window) current_buffer = XBUFFER (w->buffer); if (w == XWINDOW (selected_window)) - pt = BUF_PT (current_buffer); + pt = PT; else { pt = marker_position (w->pointm); @@ -11194,7 +11194,7 @@ reconsider_clip_changes (w, b) int pt; if (w == XWINDOW (selected_window)) - pt = BUF_PT (current_buffer); + pt = PT; else pt = marker_position (w->pointm); -- cgit v1.2.1 From 3ec03f7e4696b4af1af7e1a2fef2a64ccb9224c2 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Sun, 20 Mar 2011 18:35:27 +0800 Subject: New variable completing-read-function to customize completing-read --- src/ChangeLog | 6 ++++++ src/minibuf.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5aee468d933..d5d1efebef8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-20 Leo + + * minibuf.c (completing-read-function): New variable. + (completing-read-default): Rename from completing-read. + (completing-read): Call completing-read-function. + 2011-03-19 Juanma Barranquero * xfaces.c (Fx_load_color_file): diff --git a/src/minibuf.c b/src/minibuf.c index 8ff861b2403..3fbe14e9da0 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -72,6 +72,8 @@ Lisp_Object Qcompletion_ignore_case; Lisp_Object Qminibuffer_completion_table; Lisp_Object Qminibuffer_completion_predicate; Lisp_Object Qminibuffer_completion_confirm; +Lisp_Object Qcompleting_read_default; +Lisp_Object Vcompleting_read_function; Lisp_Object Quser_variable_p; Lisp_Object Qminibuffer_default; @@ -1674,7 +1676,27 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits the current input method and the setting of `enable-multibyte-characters'. Completion ignores case if the ambient value of - `completion-ignore-case' is non-nil. */) + `completion-ignore-case' is non-nil. + +See also `completing-read-function'. */) + (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) +{ + Lisp_Object args[9]; + args[0] = Vcompleting_read_function; + args[1] = prompt; + args[2] = collection; + args[3] = predicate; + args[4] = require_match; + args[5] = initial_input; + args[6] = hist; + args[7] = def; + args[8] = inherit_input_method; + return Ffuncall (9, args); +} + +DEFUN ("completing-read-default", Fcompleting_read_default, Scompleting_read_default, 2, 8, 0, + doc: /* Default method for reading from the minibuffer with completion. +See `completing-read' for the meaning of the arguments. */) (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) { Lisp_Object val, histvar, histpos, position; @@ -1972,6 +1994,9 @@ syms_of_minibuf (void) minibuf_save_list = Qnil; staticpro (&minibuf_save_list); + Qcompleting_read_default = intern_c_string ("completing-read-default"); + staticpro (&Qcompleting_read_default); + Qcompletion_ignore_case = intern_c_string ("completion-ignore-case"); staticpro (&Qcompletion_ignore_case); @@ -2116,6 +2141,12 @@ If the value is `confirm-after-completion', the user may exit with an doc: /* Non-nil means completing file names. */); Vminibuffer_completing_file_name = Qnil; + DEFVAR_LISP ("completing-read-function", + &Vcompleting_read_function, + doc: /* The function called by `completing-read' to do the work. +It should accept the same arguments as `completing-read'. */); + Vcompleting_read_function = Qcompleting_read_default; + DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form, doc: /* Value that `help-form' takes on inside the minibuffer. */); Vminibuffer_help_form = Qnil; @@ -2191,4 +2222,5 @@ properties. */); defsubr (&Stest_completion); defsubr (&Sassoc_string); defsubr (&Scompleting_read); + defsubr (&Scompleting_read_default); } -- cgit v1.2.1 From 45b6f6d5cba8274c2e75d3cc7cd7a14f54a7b659 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 20 Mar 2011 14:57:22 +0100 Subject: src/minibuf.c: Fix previous change. * minibuf.c (Vcompleting_read_function): Don't declare, global variables are now in src/globals.h. (syms_of_minibuf): Remove spurious & from previous change. --- src/ChangeLog | 6 ++++++ src/minibuf.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d5d1efebef8..95bafd023b4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-20 Juanma Barranquero + + * minibuf.c (Vcompleting_read_function): Don't declare, global variables + are now in src/globals.h. + (syms_of_minibuf): Remove spurious & from previous change. + 2011-03-20 Leo * minibuf.c (completing-read-function): New variable. diff --git a/src/minibuf.c b/src/minibuf.c index 3fbe14e9da0..b6b79be9d3f 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -73,7 +73,6 @@ Lisp_Object Qminibuffer_completion_table; Lisp_Object Qminibuffer_completion_predicate; Lisp_Object Qminibuffer_completion_confirm; Lisp_Object Qcompleting_read_default; -Lisp_Object Vcompleting_read_function; Lisp_Object Quser_variable_p; Lisp_Object Qminibuffer_default; @@ -2142,7 +2141,7 @@ If the value is `confirm-after-completion', the user may exit with an Vminibuffer_completing_file_name = Qnil; DEFVAR_LISP ("completing-read-function", - &Vcompleting_read_function, + Vcompleting_read_function, doc: /* The function called by `completing-read' to do the work. It should accept the same arguments as `completing-read'. */); Vcompleting_read_function = Qcompleting_read_default; -- cgit v1.2.1 From 66b874939b5acd59c76fa53373f2e41871ec1fef Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 20 Mar 2011 16:58:23 -0700 Subject: (Re)move autotools generated files from the repository. Ref: http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00225.html * autogen/: New directory, to be excluded from releases. * autogen/copy_autogen, autogen/update_autogen: New scripts. * autogen/README: New file. * autogen/aclocal.m4, autogen/config.in, autogen/configure: * autogen/Makefile.in: Add auto-updated generated files. * autogen.sh: No longer a no-op, now it tests for autotools and runs them as necessary. * configure.in: Defaule maintainer-mode to on. * aclocal.m4, configure, lib/Makefile.in: Remove files. * src/config.in: Remove file. * INSTALL.BZR, admin/make-tarball.txt: Update instructions. --- src/ChangeLog | 4 + src/config.in | 1394 --------------------------------------------------------- 2 files changed, 4 insertions(+), 1394 deletions(-) delete mode 100644 src/config.in (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 95bafd023b4..6fa2d821565 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-20 Glenn Morris + + * config.in: Remove file. + 2011-03-20 Juanma Barranquero * minibuf.c (Vcompleting_read_function): Don't declare, global variables diff --git a/src/config.in b/src/config.in deleted file mode 100644 index fbd3ee9338d..00000000000 --- a/src/config.in +++ /dev/null @@ -1,1394 +0,0 @@ -/* src/config.in. Generated from configure.in by autoheader. */ - -/* GNU Emacs site configuration template file. - -Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2011 - Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - - -/* No code in Emacs #includes config.h twice, but some bits of code - intended to work with other packages as well (like gmalloc.c) - think they can include it as many times as they like. */ -#ifndef EMACS_CONFIG_H -#define EMACS_CONFIG_H - - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to the number of bits in type 'ptrdiff_t'. */ -#undef BITSIZEOF_PTRDIFF_T - -/* Define to the number of bits in type 'sig_atomic_t'. */ -#undef BITSIZEOF_SIG_ATOMIC_T - -/* Define to the number of bits in type 'size_t'. */ -#undef BITSIZEOF_SIZE_T - -/* Define to the number of bits in type 'wchar_t'. */ -#undef BITSIZEOF_WCHAR_T - -/* Define to the number of bits in type 'wint_t'. */ -#undef BITSIZEOF_WINT_T - -/* Define if Emacs cannot be dumped on your system. */ -#undef CANNOT_DUMP - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 for DGUX with . */ -#undef DGUX - -/* Define to 1 if you are using the GNU C Library. */ -#undef DOUG_LEA_MALLOC - -/* Define to the canonical Emacs configuration name. */ -#undef EMACS_CONFIGURATION - -/* Define to the options passed to configure. */ -#undef EMACS_CONFIG_OPTIONS - -/* Enable expensive run-time checking of data types? */ -#undef ENABLE_CHECKING - -/* Define this to check for errors in cons list. */ -#undef GC_CHECK_CONS_LIST - -/* Define this temporarily to hunt a bug. If defined, the size of strings is - redundantly recorded in sdata structures so that it can be compared to the - sizes recorded in Lisp strings. */ -#undef GC_CHECK_STRING_BYTES - -/* Define this to check the string free list. */ -#undef GC_CHECK_STRING_FREE_LIST - -/* Define this to check for short string overrun. */ -#undef GC_CHECK_STRING_OVERRUN - -/* Define to 1 if the `getpgrp' function requires zero arguments. */ -#undef GETPGRP_VOID - -/* Define to 1 if gettimeofday accepts only one argument. */ -#undef GETTIMEOFDAY_ONE_ARGUMENT - -/* Define to 1 if you want to use the GNU memory allocator. */ -#undef GNU_MALLOC - -/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */ -#undef HAVE_AIX_SMT_EXP - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if ALSA is available. */ -#undef HAVE_ALSA - -/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */ -#undef HAVE_ATTRIBUTE_ALIGNED - -/* Define to 1 if strtold conforms to C99. */ -#undef HAVE_C99_STRTOLD - -/* Define to 1 if you have the `cbrt' function. */ -#undef HAVE_CBRT - -/* Define to 1 if you have the `cfmakeraw' function. */ -#undef HAVE_CFMAKERAW - -/* Define to 1 if you have the `cfsetspeed' function. */ -#undef HAVE_CFSETSPEED - -/* Define to 1 if you have the `closedir' function. */ -#undef HAVE_CLOSEDIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_COFF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_COM_ERR_H - -/* Define to 1 if you have the `copysign' function. */ -#undef HAVE_COPYSIGN - -/* Define to 1 if using D-Bus. */ -#undef HAVE_DBUS - -/* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */ -#undef HAVE_DBUS_WATCH_GET_UNIX_FD - -/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. - */ -#undef HAVE_DECL_GETENV - -/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you - don't. */ -#undef HAVE_DECL_LOCALTIME_R - -/* Define to 1 if you have the declaration of `strmode', and to 0 if you - don't. */ -#undef HAVE_DECL_STRMODE - -/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you - don't. */ -#undef HAVE_DECL_SYS_SIGLIST - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - -/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you - don't. */ -#undef HAVE_DECL___SYS_SIGLIST - -/* Define to 1 if you have the header file. */ -#undef HAVE_DES_H - -/* Define to 1 if dynamic ptys are supported. */ -#undef HAVE_DEV_PTMX - -/* Define to 1 if you have the `difftime' function. */ -#undef HAVE_DIFFTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the `dup2' function. */ -#undef HAVE_DUP2 - -/* Define to 1 if you have the `euidaccess' function. */ -#undef HAVE_EUIDACCESS - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fmod' function. */ -#undef HAVE_FMOD - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `fpathconf' function. */ -#undef HAVE_FPATHCONF - -/* Define to 1 if using the freetype and fontconfig libraries. */ -#undef HAVE_FREETYPE - -/* Define to 1 if you have the `frexp' function. */ -#undef HAVE_FREXP - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -#undef HAVE_FSEEKO - -/* Define to 1 if you have the `fsync' function. */ -#undef HAVE_FSYNC - -/* Define to 1 if you have the `ftime' function. */ -#undef HAVE_FTIME - -/* Define to 1 if you have the `gai_strerror' function. */ -#undef HAVE_GAI_STRERROR - -/* Define to 1 if using GConf. */ -#undef HAVE_GCONF - -/* Define to 1 if you have the `getaddrinfo' function. */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - -/* Define to 1 if you have the `getdelim' function. */ -#undef HAVE_GETDELIM - -/* Define to 1 if you have the `getdomainname' function. */ -#undef HAVE_GETDOMAINNAME - -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define to 1 if you have the `getline' function. */ -#undef HAVE_GETLINE - -/* Define to 1 if you have the header file. */ -#undef HAVE_GETOPT_H - -/* Define to 1 if you have the `getopt_long_only' function. */ -#undef HAVE_GETOPT_LONG_ONLY - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the `getpeername' function. */ -#undef HAVE_GETPEERNAME - -/* Define to 1 if you have the `getpt' function. */ -#undef HAVE_GETPT - -/* Define to 1 if you have the `getrlimit' function. */ -#undef HAVE_GETRLIMIT - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `getsockname' function. */ -#undef HAVE_GETSOCKNAME - -/* Define to 1 if you have the `getsockopt' function. */ -#undef HAVE_GETSOCKOPT - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the `getwd' function. */ -#undef HAVE_GETWD - -/* Define to 1 if you have the `get_current_dir_name' function. */ -#undef HAVE_GET_CURRENT_DIR_NAME - -/* Define to 1 if you have a gif (or ungif) library. */ -#undef HAVE_GIF - -/* Define if using GnuTLS. */ -#undef HAVE_GNUTLS - -/* Define to 1 if you have the gpm library (-lgpm). */ -#undef HAVE_GPM - -/* Define to 1 if you have the `grantpt' function. */ -#undef HAVE_GRANTPT - -/* Define to 1 if using GTK 3 or later. */ -#undef HAVE_GTK3 - -/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */ -#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE - -/* Define to 1 if you have GTK and pthread (-lpthread). */ -#undef HAVE_GTK_AND_PTHREAD - -/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */ -#undef HAVE_GTK_DIALOG_GET_ACTION_AREA - -/* Define to 1 if you have the `gtk_file_selection_new' function. */ -#undef HAVE_GTK_FILE_SELECTION_NEW - -/* Define to 1 if you have the `gtk_main' function. */ -#undef HAVE_GTK_MAIN - -/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */ -#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION - -/* Define to 1 if you have the `gtk_widget_get_mapped' function. */ -#undef HAVE_GTK_WIDGET_GET_MAPPED - -/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */ -#undef HAVE_GTK_WIDGET_GET_SENSITIVE - -/* Define to 1 if you have the `gtk_widget_get_window' function. */ -#undef HAVE_GTK_WIDGET_GET_WINDOW - -/* Define to 1 if you have the `gtk_widget_set_has_window' function. */ -#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW - -/* Define to 1 if you have the `g_type_init' function. */ -#undef HAVE_G_TYPE_INIT - -/* Define to 1 if netdb.h declares h_errno. */ -#undef HAVE_H_ERRNO - -/* Define to 1 if using imagemagick. */ -#undef HAVE_IMAGEMAGICK - -/* Define to 1 if you have inet sockets. */ -#undef HAVE_INET_SOCKETS - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `isnan' function. */ -#undef HAVE_ISNAN - -/* Define to 1 if you have the jpeg library (-ljpeg). */ -#undef HAVE_JPEG - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROSIV_DES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROSIV_KRB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROS_DES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROS_KRB_H - -/* Define to 1 if `e_text' is a member of `krb5_error'. */ -#undef HAVE_KRB5_ERROR_E_TEXT - -/* Define to 1 if `text' is a member of `krb5_error'. */ -#undef HAVE_KRB5_ERROR_TEXT - -/* Define to 1 if you have the header file. */ -#undef HAVE_KRB5_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KRB_H - -/* Define if you have and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET - -/* Define to 1 if you have the `com_err' library (-lcom_err). */ -#undef HAVE_LIBCOM_ERR - -/* Define to 1 if you have the `crypto' library (-lcrypto). */ -#undef HAVE_LIBCRYPTO - -/* Define to 1 if you have the `des' library (-ldes). */ -#undef HAVE_LIBDES - -/* Define to 1 if you have the `des425' library (-ldes425). */ -#undef HAVE_LIBDES425 - -/* Define to 1 if you have the `dgc' library (-ldgc). */ -#undef HAVE_LIBDGC - -/* Define to 1 if you have the `dnet' library (-ldnet). */ -#undef HAVE_LIBDNET - -/* Define to 1 if you have the hesiod library (-lhesiod). */ -#undef HAVE_LIBHESIOD - -/* Define to 1 if you have the `intl' library (-lintl). */ -#undef HAVE_LIBINTL - -/* Define to 1 if you have the `k5crypto' library (-lk5crypto). */ -#undef HAVE_LIBK5CRYPTO - -/* Define to 1 if you have the `krb' library (-lkrb). */ -#undef HAVE_LIBKRB - -/* Define to 1 if you have the `krb4' library (-lkrb4). */ -#undef HAVE_LIBKRB4 - -/* Define to 1 if you have the `krb5' library (-lkrb5). */ -#undef HAVE_LIBKRB5 - -/* Define to 1 if you have the `kstat' library (-lkstat). */ -#undef HAVE_LIBKSTAT - -/* Define to 1 if you have the `lockfile' library (-llockfile). */ -#undef HAVE_LIBLOCKFILE - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `mail' library (-lmail). */ -#undef HAVE_LIBMAIL - -/* Define to 1 if you have the `ncurses' library (-lncurses). */ -#undef HAVE_LIBNCURSES - -/* Define to 1 if using libotf. */ -#undef HAVE_LIBOTF - -/* Define to 1 if you have the `perfstat' library (-lperfstat). */ -#undef HAVE_LIBPERFSTAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBPNG_PNG_H - -/* Define to 1 if you have the `pthreads' library (-lpthreads). */ -#undef HAVE_LIBPTHREADS - -/* Define to 1 if you have the resolv library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define to 1 if using SELinux. */ -#undef HAVE_LIBSELINUX - -/* Define to 1 if you have the `Xext' library (-lXext). */ -#undef HAVE_LIBXEXT - -/* Define to 1 if you have the libxml library (-lxml2). */ -#undef HAVE_LIBXML2 - -/* Define to 1 if you have the `Xmu' library (-lXmu). */ -#undef HAVE_LIBXMU - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_VERSION_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - -/* Define to 1 if you have the `logb' function. */ -#undef HAVE_LOGB - -/* Define to 1 if you support file names longer than 14 characters. */ -#undef HAVE_LONG_FILE_NAMES - -/* Define to 1 if the system has the type `long long int'. */ -#undef HAVE_LONG_LONG_INT - -/* Define to 1 if you have the `lrand48' function. */ -#undef HAVE_LRAND48 - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if using libm17n-flt. */ -#undef HAVE_M17N_FLT - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_SOUNDCARD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACH_MACH_H - -/* Define to 1 if you have the `MagickExportImagePixels' function. */ -#undef HAVE_MAGICKEXPORTIMAGEPIXELS - -/* Define to 1 if you have the header file. */ -#undef HAVE_MAILLOCK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MALLOC_MALLOC_H - -/* Define to 1 if you have the `mblen' function. */ -#undef HAVE_MBLEN - -/* Define to 1 if you have the `mbrlen' function. */ -#undef HAVE_MBRLEN - -/* Define to 1 if you have the `mbsinit' function. */ -#undef HAVE_MBSINIT - -/* Define to 1 if declares mbstate_t. */ -#undef HAVE_MBSTATE_T - -/* Define to 1 if you have the `memcmp' function. */ -#undef HAVE_MEMCMP - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mempcpy' function. */ -#undef HAVE_MEMPCPY - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have mouse menus. (This is automatic if you use X, but - the option to specify it remains.) It is also defined with other window - systems that support xmenu.c. */ -#undef HAVE_MENUS - -/* Define to 1 if you have the `mkdir' function. */ -#undef HAVE_MKDIR - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you have mouse support. */ -#undef HAVE_MOUSE - -/* Define to 1 if you have the `mremap' function. */ -#undef HAVE_MREMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NLIST_H - -/* Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on - Mac OS X. */ -#undef HAVE_NS - -/* Define to 1 if libotf has OTF_get_variation_glyphs. */ -#undef HAVE_OTF_GET_VARIATION_GLYPHS - -/* Define to 1 if personality LINUX32 can be set. */ -#undef HAVE_PERSONALITY_LINUX32 - -/* Define to 1 if you have the png library (-lpng). */ -#undef HAVE_PNG - -/* Define to 1 if you have the header file. */ -#undef HAVE_PNG_H - -/* Define to 1 if you have the `posix_memalign' function. */ -#undef HAVE_POSIX_MEMALIGN - -/* Define to 1 if you have the `pstat_getdynamic' function. */ -#undef HAVE_PSTAT_GETDYNAMIC - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PWD_H - -/* Define to 1 if you have the `random' function. */ -#undef HAVE_RANDOM - -/* Define to 1 if you have the `readlink' function. */ -#undef HAVE_READLINK - -/* Define to 1 if you have the `recvfrom' function. */ -#undef HAVE_RECVFROM - -/* Define to 1 if you have the `rename' function. */ -#undef HAVE_RENAME - -/* Define to 1 if res_init is available. */ -#undef HAVE_RES_INIT - -/* Define to 1 if you have the `rint' function. */ -#undef HAVE_RINT - -/* Define to 1 if you have the `rmdir' function. */ -#undef HAVE_RMDIR - -/* Define to 1 if using librsvg. */ -#undef HAVE_RSVG - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the `sendto' function. */ -#undef HAVE_SENDTO - -/* Define to 1 if you have the `setitimer' function. */ -#undef HAVE_SETITIMER - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `setpgid' function. */ -#undef HAVE_SETPGID - -/* Define to 1 if you have the `setrlimit' function. */ -#undef HAVE_SETRLIMIT - -/* Define to 1 if you have the `setsid' function. */ -#undef HAVE_SETSID - -/* Define to 1 if you have the `setsockopt' function. */ -#undef HAVE_SETSOCKOPT - -/* Define to 1 if you have the `shutdown' function. */ -#undef HAVE_SHUTDOWN - -/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ -#undef HAVE_SIGNED_SIG_ATOMIC_T - -/* Define to 1 if 'wchar_t' is a signed integer type. */ -#undef HAVE_SIGNED_WCHAR_T - -/* Define to 1 if 'wint_t' is a signed integer type. */ -#undef HAVE_SIGNED_WINT_T - -/* Define to 1 if the system has the type `size_t'. */ -#undef HAVE_SIZE_T - -/* Define to 1 if you have sound support. */ -#undef HAVE_SOUND - -/* Define to 1 if you have the header file. */ -#undef HAVE_SOUNDCARD_H - -/* Define to 1 if `speed_t' is declared by . */ -#undef HAVE_SPEED_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_EXT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strrchr' function. */ -#undef HAVE_STRRCHR - -/* Define to 1 if you have the `strsignal' function. */ -#undef HAVE_STRSIGNAL - -/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_ADDR - -/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR - -/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_FLAGS - -/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_HWADDR - -/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_NETMASK - -/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ -#undef HAVE_STRUCT_NLIST_N_UN_N_NAME - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if `struct utimbuf' is declared by . */ -#undef HAVE_STRUCT_UTIMBUF - -/* Define if struct stat has an st_dm_mode member. */ -#undef HAVE_ST_DM_MODE - -/* Define to 1 if you have the `symlink' function. */ -#undef HAVE_SYMLINK - -/* Define to 1 if you have the `sync' function. */ -#undef HAVE_SYNC - -/* Define to 1 if you have the `sysinfo' function. */ -#undef HAVE_SYSINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_BITYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LOADAVG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOUNDCARD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSTEMINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VLIMIT_H - -/* Define to 1 if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS__MBSTATE_T_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERM_H - -/* Define to 1 if you have the tiff library (-ltiff). */ -#undef HAVE_TIFF - -/* Define to 1 if `struct timeval' is declared by . */ -#undef HAVE_TIMEVAL - -/* Define if struct tm has the tm_gmtoff member. */ -#undef HAVE_TM_GMTOFF - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you have the `touchlock' function. */ -#undef HAVE_TOUCHLOCK - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#undef HAVE_TZNAME - -/* Define to 1 if you have the `tzset' function. */ -#undef HAVE_TZSET - -/* Define to 1 if you have the `ualarm' function. */ -#undef HAVE_UALARM - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#undef HAVE_UNSIGNED_LONG_LONG_INT - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIL_H - -/* Define to 1 if you have the `utimes' function. */ -#undef HAVE_UTIMES - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTMP_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_VFORK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WCHAR_H - -/* Define if you have the 'wchar_t' type. */ -#undef HAVE_WCHAR_T - -/* Define if you have a window system. */ -#undef HAVE_WINDOW_SYSTEM - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs - expects to use version 10. */ -#undef HAVE_X11 - -/* Define to 1 if you have the X11R6 or newer version of Xlib. */ -#undef HAVE_X11R6 - -/* Define if you have usable X11R6-style XIM support. */ -#undef HAVE_X11R6_XIM - -/* Define to 1 if you have the X11R6 or newer version of Xt. */ -#undef HAVE_X11XTR6 - -/* Define to 1 if you have the Xaw3d library (-lXaw3d). */ -#undef HAVE_XAW3D - -/* Define to 1 if you have the Xft library. */ -#undef HAVE_XFT - -/* Define to 1 if XIM is available */ -#undef HAVE_XIM - -/* Define to 1 if you have the XkbGetKeyboard function. */ -#undef HAVE_XKBGETKEYBOARD - -/* Define to 1 if you have the Xpm libary (-lXpm). */ -#undef HAVE_XPM - -/* Define to 1 if you have the `XrmSetDatabase' function. */ -#undef HAVE_XRMSETDATABASE - -/* Define to 1 if you have the `XScreenNumberOfScreen' function. */ -#undef HAVE_XSCREENNUMBEROFSCREEN - -/* Define to 1 if you have the `XScreenResourceString' function. */ -#undef HAVE_XSCREENRESOURCESTRING - -/* Define to 1 if you have the `XSetWMProtocols' function. */ -#undef HAVE_XSETWMPROTOCOLS - -/* Define if you have usable i18n support. */ -#undef HAVE_X_I18N - -/* Define to 1 if you have the SM library (-lSM). */ -#undef HAVE_X_SM - -/* Define to 1 if you want to use the X window system. */ -#undef HAVE_X_WINDOWS - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Define to 1 if you have the `__builtin_unwind_init' function. */ -#undef HAVE___BUILTIN_UNWIND_INIT - -/* Define to 1 if you have the `__executable_start' function. */ -#undef HAVE___EXECUTABLE_START - -/* Define to 1 if you have the `__fpending' function. */ -#undef HAVE___FPENDING - -/* Define to support using a Hesiod database to find the POP server. */ -#undef HESIOD - -/* Define to support Kerberos-authenticated POP mail retrieval. */ -#undef KERBEROS - -/* Define to use Kerberos 5 instead of Kerberos 4. */ -#undef KERBEROS5 - -/* Define to 1 if localtime caches TZ. */ -#undef LOCALTIME_CACHE - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* String giving fallback POP mail host. */ -#undef MAILHOST - -/* Define to unlink, rather than empty, mail spool after reading. */ -#undef MAIL_UNLINK_SPOOL - -/* Define if the mailer uses flock to interlock the mail spool. */ -#undef MAIL_USE_FLOCK - -/* Define if the mailer uses lockf to interlock the mail spool. */ -#undef MAIL_USE_LOCKF - -/* Define to support MMDF mailboxes in movemail. */ -#undef MAIL_USE_MMDF - -/* Define to support POP mail retrieval. */ -#undef MAIL_USE_POP - -/* Define to 1 if you don't have struct exception in math.h. */ -#undef NO_MATHERR - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Define to 1 if `NSInteger' is defined. */ -#undef NS_HAVE_NSINTEGER - -/* Define to 1 if you are using NS windowing under MacOS X. */ -#undef NS_IMPL_COCOA - -/* Define to 1 if you are using NS windowing under GNUstep. */ -#undef NS_IMPL_GNUSTEP - -/* Define to 1 if the nlist n_name member is a pointer */ -#undef N_NAME_POINTER - -/* Define if the C compiler is the linker. */ -#undef ORDINARY_LINK - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as `void' if your compiler accepts `void *'; otherwise define as - `char'. */ -#undef POINTER_TYPE - -/* Define to 1 if the C compiler supports function prototypes. */ -#undef PROTOTYPES - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'ptrdiff_t'. */ -#undef PTRDIFF_T_SUFFIX - -/* Define to 1 if readlink fails to recognize a trailing slash. */ -#undef READLINK_TRAILING_SLASH_BUG - -/* Define REL_ALLOC if you want to use the relocating allocator for buffer - space. */ -#undef REL_ALLOC - -/* Define to 1 if stat needs help when passed a directory name with a trailing - slash */ -#undef REPLACE_FUNC_STAT_DIR - -/* Define to 1 if stat needs help when passed a file name with a trailing - slash */ -#undef REPLACE_FUNC_STAT_FILE - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'sig_atomic_t'. */ -#undef SIG_ATOMIC_T_SUFFIX - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'size_t'. */ -#undef SIZE_T_SUFFIX - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if the `S_IS*' macros in do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 on System V Release 4. */ -#undef SVR4 - -/* Process async input synchronously. */ -#undef SYNC_INPUT - -/* Define to use system malloc. */ -#undef SYSTEM_MALLOC - -/* Define to 1 if you use terminfo instead of termcap. */ -#undef TERMINFO - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Define to 1 for Encore UMAX. */ -#undef UMAX - -/* Define to 1 for Encore UMAX 4.3 that has instead of - . */ -#undef UMAX4_3 - -/* Define to 1 if using GTK. */ -#undef USE_GTK - -/* Define this to use a lisp union for the Lisp_Object data type. */ -#undef USE_LISP_UNION_TYPE - -/* Define to 1 if using the Lucid X toolkit. */ -#undef USE_LUCID - -/* Define to use mmap to allocate buffer text. */ -#undef USE_MMAP_FOR_BUFFERS - -/* Define to 1 if using the Motif X toolkit. */ -#undef USE_MOTIF - -/* Define to 1 if we should use toolkit scroll bars. */ -#undef USE_TOOLKIT_SCROLL_BARS - -/* Define to 1 if we should use XIM, if it is available. */ -#undef USE_XIM - -/* Define to 1 if using an X toolkit. */ -#undef USE_X_TOOLKIT - -/* Version number of package */ -#undef VERSION - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'wchar_t'. */ -#undef WCHAR_T_SUFFIX - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'wint_t'. */ -#undef WINT_T_SUFFIX - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define this to check for malloc buffer overrun. */ -#undef XMALLOC_OVERRUN_CHECK - -/* Define to the type of the 6th arg of XRegisterIMInstantiateCallback, either - XPointer or XPointer*. */ -#undef XRegisterIMInstantiateCallback_arg6 - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -#undef _LARGEFILE_SOURCE - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define to 500 only on HP-UX. */ -#undef _XOPEN_SOURCE - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Define to rpl_ if the getopt replacement functions and variables should be - used. */ -#undef __GETOPT_PREFIX - -/* Define like PROTOTYPES; this can be used by system headers. */ -#undef __PROTOTYPES - -/* Define to compiler's equivalent of C99 restrict keyword in array - declarations. Define as empty for no equivalent. */ -#undef __restrict_arr - -/* Define to the used machine dependent file. */ -#undef config_machfile - -/* Define to the used os dependent file. */ -#undef config_opsysfile - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports - the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of - earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. - __APPLE__ && __MACH__ test for MacOS X. - __APPLE_CC__ tests for the Apple compiler and its version. - __STDC_VERSION__ tests for the C99 mode. */ -#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ -# define __GNUC_STDC_INLINE__ 1 -#endif - -/* Define to a type if does not define. */ -#undef mbstate_t - -/* Define to the name of the strftime replacement function. */ -#undef my_strftime - -/* Define to the type of st_nlink in struct stat, or a supertype. */ -#undef nlink_t - -/* Define to `int' if does not define. */ -#undef pid_t - -/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict or - __restrict__, even though the corresponding Sun C compiler ends up with - "#define restrict _Restrict" or "#define restrict __restrict__" in the - previous line. Perhaps some future version of Sun C++ will work with - restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT -# define _Restrict -# define __restrict__ -#endif - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to any substitute for sys_siglist. */ -#undef sys_siglist - -/* Define as a marker that can be attached to declarations that might not - be used. This helps to reduce warnings, such as from - GCC -Wunused-parameter. */ -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED __attribute__ ((__unused__)) -#else -# define _GL_UNUSED -#endif -/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name - is a misnomer outside of parameter lists. */ -#define _UNUSED_PARAMETER_ _GL_UNUSED - - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -#undef volatile - - -/* Define AMPERSAND_FULL_NAME if you use the convention - that & in the full name stands for the login id. */ -/* Turned on June 1996 supposing nobody will mind it. */ -#define AMPERSAND_FULL_NAME - -/* If using GNU, then support inline function declarations. */ -/* Don't try to switch on inline handling as detected by AC_C_INLINE - generally, because even if non-gcc compilers accept `inline', they - may reject `extern inline'. */ -#if defined (__GNUC__) -#define INLINE __inline__ -#else -#define INLINE -#endif - -/* `subprocesses' should be defined if you want to - have code for asynchronous subprocesses - (as used in M-x compile and M-x shell). - Only MSDOS does not support this (it overrides - this in its config_opsysfile below). */ - -#define subprocesses - -/* Include the os and machine dependent files. */ -#include config_opsysfile -#ifdef config_machfile -# include config_machfile -#endif - -/* GNUstep needs a bit more pure memory. Of the existing knobs, - SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. - (There is probably a better place to do this, but right now the - Cocoa side does this in s/darwin.h and we cannot parallel this - exactly since GNUstep is multi-OS. */ -#if defined HAVE_NS && defined NS_IMPL_GNUSTEP -# define SYSTEM_PURESIZE_EXTRA 30000 -#endif - -/* SIGTYPE is the macro we actually use. */ -#ifndef SIGTYPE -#define SIGTYPE RETSIGTYPE -#endif - -#ifdef emacs /* Don't do this for lib-src. */ -/* Tell regex.c to use a type compatible with Emacs. */ -#define RE_TRANSLATE_TYPE Lisp_Object -#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C) -#ifdef make_number -/* If make_number is a macro, use it. */ -#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) -#else -/* If make_number is a function, avoid it. */ -#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0)) -#endif -#endif - -/* These default definitions are good for almost all machines. - The exceptions override them in m/MACHINE.h. */ - -#ifndef BITS_PER_CHAR -#define BITS_PER_CHAR 8 -#endif - -#ifndef BITS_PER_SHORT -#define BITS_PER_SHORT 16 -#endif - -/* Note that lisp.h uses this in a preprocessor conditional, so it - would not work to use sizeof. That being so, we do all of them - without sizeof, for uniformity's sake. */ -#ifndef BITS_PER_INT -#define BITS_PER_INT 32 -#endif - -#ifndef BITS_PER_LONG -#ifdef _LP64 -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif -#endif - -/* Define if the compiler supports function prototypes. It may do so but - not define __STDC__ (e.g. DEC C by default) or may define it as zero. */ -#undef PROTOTYPES - -#include -#include - -#ifdef HAVE_ALLOCA_H -# include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#else -# include -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -#endif - -#ifndef HAVE_SIZE_T -typedef unsigned size_t; -#endif - -#ifndef HAVE_STRCHR -#define strchr(a, b) index (a, b) -#endif - -#ifndef HAVE_STRRCHR -#define strrchr(a, b) rindex (a, b) -#endif - -#if defined __GNUC__ && (__GNUC__ > 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) -#define NO_RETURN __attribute__ ((__noreturn__)) -#else -#define NO_RETURN /* nothing */ -#endif - -#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE -#endif - -#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) -#define EXTERNALLY_VISIBLE __attribute__((externally_visible)) -#else -#define EXTERNALLY_VISIBLE -#endif - -/* Some versions of GNU/Linux define noinline in their headers. */ -#ifdef noinline -#undef noinline -#endif - -/* These won't be used automatically yet. We also need to know, at least, - that the stack is continuous. */ -#ifdef __GNUC__ -# ifndef GC_SETJMP_WORKS - /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */ -# define GC_SETJMP_WORKS 1 -# endif -# ifndef GC_LISP_OBJECT_ALIGNMENT -# define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object)) -# endif -#endif - -#endif /* EMACS_CONFIG_H */ - -/* -Local Variables: -mode: c -End: -*/ - -- cgit v1.2.1