From a2752828083a77421efdcd59938eeb21657c39a3 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 9 Aug 2012 09:14:23 +0400 Subject: [PATCH] Use TSET for write access to Lisp_Object slots of struct terminal. * termhooks.h (TSET): New macro. * coding.c, terminal.c, xselect.c: Adjust users. --- src/ChangeLog | 6 ++++++ src/coding.c | 4 ++-- src/termhooks.h | 4 ++++ src/terminal.c | 2 +- src/xselect.c | 8 ++++---- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4a570a51df4..2d65dcb0860 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-08-09 Dmitry Antipov + + Use TSET for write access to Lisp_Object slots of struct terminal. + * termhooks.h (TSET): New macro. + * coding.c, terminal.c, xselect.c: Adjust users. + 2012-08-08 Stefan Monnier * xdisp.c (safe_eval_handler): Remove prototype. Receive args describing diff --git a/src/coding.c b/src/coding.c index 12a7cf93c46..5bed11b8241 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9294,9 +9294,9 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern terminal_coding->src_multibyte = 1; terminal_coding->dst_multibyte = 0; if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) - term->charset_list = coding_charset_list (terminal_coding); + TSET (term, charset_list, coding_charset_list (terminal_coding)); else - term->charset_list = Fcons (make_number (charset_ascii), Qnil); + TSET (term, charset_list, Fcons (make_number (charset_ascii), Qnil)); return Qnil; } diff --git a/src/termhooks.h b/src/termhooks.h index 4cad4825cdd..78d8532e03f 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -321,6 +321,10 @@ 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 { diff --git a/src/terminal.c b/src/terminal.c index 4e03c162213..53610d9736f 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -446,7 +446,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)) { - t->param_alist = Fcons (Fcons (parameter, value), t->param_alist); + TSET (t, param_alist, Fcons (Fcons (parameter, value), t->param_alist)); return Qnil; } else diff --git a/src/xselect.c b/src/xselect.c index ff779b91944..664b5f92a15 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -353,8 +353,8 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, INTEGER_TO_CONS (timestamp), frame); prev_value = LOCAL_SELECTION (selection_name, dpyinfo); - dpyinfo->terminal->Vselection_alist - = Fcons (selection_data, dpyinfo->terminal->Vselection_alist); + TSET (dpyinfo->terminal, Vselection_alist, + 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 +989,7 @@ x_handle_selection_clear (struct input_event *event) break; } } - dpyinfo->terminal->Vselection_alist = Vselection_alist; + TSET (dpyinfo->terminal, Vselection_alist, Vselection_alist); /* Run the `x-lost-selection-functions' abnormal hook. */ { @@ -1039,7 +1039,7 @@ x_clear_frame_selections (FRAME_PTR f) args[1] = Fcar (Fcar (t->Vselection_alist)); Frun_hook_with_args (2, args); - t->Vselection_alist = XCDR (t->Vselection_alist); + TSET (t, Vselection_alist, XCDR (t->Vselection_alist)); } /* Delete elements after the beginning of Vselection_alist. */ -- 2.39.2