* termhooks.h (TSET): Remove.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 18 Aug 2012 00:07:52 +0000 (17:07 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 18 Aug 2012 00:07:52 +0000 (17:07 -0700)
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
src/coding.c
src/termhooks.h
src/terminal.c
src/xselect.c

index 403f762..2175f48 100644 (file)
@@ -1,3 +1,15 @@
+2012-08-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * 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  <eggert@cs.ucla.edu>
 
        * keyboard.h (KSET): Remove (Bug#12215).
index c601a18..290b9a5 100644 (file)
@@ -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;
 }
 
index 78d8532..46962a1 100644 (file)
@@ -22,6 +22,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "systime.h" /* for Time */
 
+INLINE_HEADER_BEGIN
+#ifndef TERMHOOKS_INLINE
+# define TERMHOOKS_INLINE INLINE
+#endif
+
 struct glyph;
 struct frame;
 \f
@@ -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
index 53610d9..d94164a 100644 (file)
@@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
+
+#define TERMHOOKS_INLINE EXTERN_INLINE
+
 #include <stdio.h>
 #include <setjmp.h>
 
@@ -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;
+}
+
 \f
 
 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
index 664b5f9..463bd6e 100644 (file)
@@ -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.  */