From 3f22b86fc7d9b66ff3e332b9a56350e93ddbd0aa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 17 Aug 2012 17:07:52 -0700 Subject: [PATCH] * termhooks.h (TSET): Remove. Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (TERMHOOKS_INLINE): New macro. (tset_charset_list, tset_selection_alist): New setter functions. * terminal.c (TERMHOOKS_INLINE): Define to EXTERN_INLINE, so that the corresponding functions are compiled into code. (tset_param_alist): New setter function. Fixes: debbugs:12215 --- src/ChangeLog | 12 ++++++++++++ src/coding.c | 8 ++++---- src/termhooks.h | 23 +++++++++++++++++++---- src/terminal.c | 12 +++++++++++- src/xselect.c | 9 +++++---- 5 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 403f76243a0..2175f48dabf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2012-08-18 Paul Eggert + + * termhooks.h (TSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + (TERMHOOKS_INLINE): New macro. + (tset_charset_list, tset_selection_alist): New setter functions. + * terminal.c (TERMHOOKS_INLINE): + Define to EXTERN_INLINE, so that the corresponding functions + are compiled into code. + (tset_param_alist): New setter function. + 2012-08-17 Paul Eggert * keyboard.h (KSET): Remove (Bug#12215). diff --git a/src/coding.c b/src/coding.c index c601a18b26e..290b9a5dbb6 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9302,10 +9302,10 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; terminal_coding->src_multibyte = 1; terminal_coding->dst_multibyte = 0; - if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) - TSET (term, charset_list, coding_charset_list (terminal_coding)); - else - TSET (term, charset_list, Fcons (make_number (charset_ascii), Qnil)); + tset_charset_list + (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK + ? coding_charset_list (terminal_coding) + : Fcons (make_number (charset_ascii), Qnil))); return Qnil; } diff --git a/src/termhooks.h b/src/termhooks.h index 78d8532e03f..46962a1217d 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -22,6 +22,11 @@ along with GNU Emacs. If not, see . */ #include "systime.h" /* for Time */ +INLINE_HEADER_BEGIN +#ifndef TERMHOOKS_INLINE +# define TERMHOOKS_INLINE INLINE +#endif + struct glyph; struct frame; @@ -321,10 +326,6 @@ struct ns_display_info; struct x_display_info; struct w32_display_info; -/* Most code should use this macro to set Lisp field in struct terminal. */ - -#define TSET(f, field, value) ((f)->field = (value)) - /* Terminal-local parameters. */ struct terminal { @@ -631,6 +632,18 @@ struct terminal void (*delete_terminal_hook) (struct terminal *); }; +/* Most code should use these functions to set Lisp fields in struct + terminal. */ +TERMHOOKS_INLINE void +tset_charset_list (struct terminal *t, Lisp_Object val) +{ + t->charset_list = val; +} +TERMHOOKS_INLINE void +tset_selection_alist (struct terminal *t, Lisp_Object val) +{ + t->Vselection_alist = val; +} /* Chain of all terminal devices currently in use. */ extern struct terminal *terminal_list; @@ -669,3 +682,5 @@ extern unsigned char *encode_terminal_code (struct glyph *, int, #ifdef HAVE_GPM extern void close_gpm (int gpm_fd); #endif + +INLINE_HEADER_END diff --git a/src/terminal.c b/src/terminal.c index 53610d9736f..d94164a4e40 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ #include + +#define TERMHOOKS_INLINE EXTERN_INLINE + #include #include @@ -39,6 +42,13 @@ struct terminal *initial_terminal; static void delete_initial_terminal (struct terminal *); +/* This setter is used only in this file, so it can be private. */ +static inline void +tset_param_alist (struct terminal *t, Lisp_Object val) +{ + t->param_alist = val; +} + void @@ -446,7 +456,7 @@ store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object val Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); if (EQ (old_alist_elt, Qnil)) { - TSET (t, param_alist, Fcons (Fcons (parameter, value), t->param_alist)); + tset_param_alist (t, Fcons (Fcons (parameter, value), t->param_alist)); return Qnil; } else diff --git a/src/xselect.c b/src/xselect.c index 664b5f92a15..463bd6e37b0 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -353,8 +353,9 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, INTEGER_TO_CONS (timestamp), frame); prev_value = LOCAL_SELECTION (selection_name, dpyinfo); - TSET (dpyinfo->terminal, Vselection_alist, - Fcons (selection_data, dpyinfo->terminal->Vselection_alist)); + tset_selection_alist + (dpyinfo->terminal, + Fcons (selection_data, dpyinfo->terminal->Vselection_alist)); /* If we already owned the selection, remove the old selection data. Don't use Fdelq as that may QUIT. */ @@ -989,7 +990,7 @@ x_handle_selection_clear (struct input_event *event) break; } } - TSET (dpyinfo->terminal, Vselection_alist, Vselection_alist); + tset_selection_alist (dpyinfo->terminal, Vselection_alist); /* Run the `x-lost-selection-functions' abnormal hook. */ { @@ -1039,7 +1040,7 @@ x_clear_frame_selections (FRAME_PTR f) args[1] = Fcar (Fcar (t->Vselection_alist)); Frun_hook_with_args (2, args); - TSET (t, Vselection_alist, XCDR (t->Vselection_alist)); + tset_selection_alist (t, XCDR (t->Vselection_alist)); } /* Delete elements after the beginning of Vselection_alist. */ -- 2.11.4.GIT