emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118109: Cleanup terminal handling code.


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r118109: Cleanup terminal handling code.
Date: Tue, 14 Oct 2014 12:45:57 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118109
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-10-14 16:45:41 +0400
message:
  Cleanup terminal handling code.
  * dispextern.h (get_named_tty): Remove prototype but...
  * termhooks.h (get_named_terminal): ...resurrect it under
  more meaningful name.
  (get_terminal): Likewise, but with...
  (decode_live_terminal): ...this name.
  (decode_tty_terminal): Add prototype.
  * term.c (get_tty_terminal): Remove.
  (get_named_tty): Remove.
  (Ftty_display_color_p, Ftty_display_color_cells, Ftty_type)
  (Fcontrolling_tty_p, Fsuspend_tty, Fresume_tty):
  Use decode_tty_terminal.
  (Ftty_no_underline, Ftty_top_frame): Use decode_live_terminal.
  * terminal.c (get_terminal): Refactor to...
  (decode_terminal, decode_live_terminal): ...new functions.
  (decode_tty_terminal): Replacement for get_tty_terminal.
  (get_named_terminal): Likewise for get_named_tty.
  * coding.c (Fset_terminal_coding_system_internal)
  (Fterminal_coding_system, Fset_keyboard_coding_system_internal):
  (Fkeyboard_coding_system):
  * composite.c (Fcomposition_get_gstring):
  * dispnew.c (Fsend_string_to_terminal):
  * frame.c (Fmake_terminal_frame):
  * nsfns.m (check_ns_display_info):
  * w32fns.c, xfns.c (check_x_display_info):
  * xselect.c (frame_for_x_selection): Use decode_live_terminal.
  * keyboard.c (handle_interrupt_signal, handle_interrupt)
  (Fset_quit_char): Use get_named_terminal.
  (Fset_output_flow_control, Fset_input_meta_mode):
  Use decode_tty_terminal.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/coding.c                   coding.c-20091113204419-o5vbwnq5f7feedwu-1077
  src/composite.c                
composite.c-20091113204419-o5vbwnq5f7feedwu-1728
  src/dispextern.h               
dispextern.h-20091113204419-o5vbwnq5f7feedwu-218
  src/dispnew.c                  dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
  src/nsfns.m                    nsfns.m-20091113204419-o5vbwnq5f7feedwu-8741
  src/term.c                     term.c-20091113204419-o5vbwnq5f7feedwu-220
  src/termhooks.h                termhooks.h-20091113204419-o5vbwnq5f7feedwu-249
  src/terminal.c                 terminal.c-20091113204419-o5vbwnq5f7feedwu-6118
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
  src/xselect.c                  xselect.c-20091113204419-o5vbwnq5f7feedwu-543
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-10-13 12:44:03 +0000
+++ b/src/ChangeLog     2014-10-14 12:45:41 +0000
@@ -1,3 +1,36 @@
+2014-10-14  Dmitry Antipov  <address@hidden>
+
+       Cleanup terminal handling code.
+       * dispextern.h (get_named_tty): Remove prototype but...
+       * termhooks.h (get_named_terminal): ...resurrect it under
+       more meaningful name.
+       (get_terminal): Likewise, but with...
+       (decode_live_terminal): ...this name.
+       (decode_tty_terminal): Add prototype.
+       * term.c (get_tty_terminal): Remove.
+       (get_named_tty): Remove.
+       (Ftty_display_color_p, Ftty_display_color_cells, Ftty_type)
+       (Fcontrolling_tty_p, Fsuspend_tty, Fresume_tty):
+       Use decode_tty_terminal.
+       (Ftty_no_underline, Ftty_top_frame): Use decode_live_terminal.
+       * terminal.c (get_terminal): Refactor to...
+       (decode_terminal, decode_live_terminal): ...new functions.
+       (decode_tty_terminal): Replacement for get_tty_terminal.
+       (get_named_terminal): Likewise for get_named_tty.
+       * coding.c (Fset_terminal_coding_system_internal)
+       (Fterminal_coding_system, Fset_keyboard_coding_system_internal):
+       (Fkeyboard_coding_system):
+       * composite.c (Fcomposition_get_gstring):
+       * dispnew.c (Fsend_string_to_terminal):
+       * frame.c (Fmake_terminal_frame):
+       * nsfns.m (check_ns_display_info):
+       * w32fns.c, xfns.c (check_x_display_info):
+       * xselect.c (frame_for_x_selection): Use decode_live_terminal.
+       * keyboard.c (handle_interrupt_signal, handle_interrupt)
+       (Fset_quit_char): Use get_named_terminal.
+       (Fset_output_flow_control, Fset_input_meta_mode):
+       Use decode_tty_terminal.
+
 2014-10-13  Eli Zaretskii  <address@hidden>
 
        * w32term.h (ALIGN_STACK): Use _WIN64, not _W64, to distinguish

=== modified file 'src/coding.c'
--- a/src/coding.c      2014-10-09 04:23:09 +0000
+++ b/src/coding.c      2014-10-14 12:45:41 +0000
@@ -9759,7 +9759,7 @@
        doc: /* Internal use only.  */)
   (Lisp_Object coding_system, Lisp_Object terminal)
 {
-  struct terminal *term = get_terminal (terminal, 1);
+  struct terminal *term = decode_live_terminal (terminal);
   struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (term);
   CHECK_SYMBOL (coding_system);
   setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
@@ -9800,7 +9800,7 @@
   (Lisp_Object terminal)
 {
   struct coding_system *terminal_coding
-    = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
+    = TERMINAL_TERMINAL_CODING (decode_live_terminal (terminal));
   Lisp_Object coding_system = CODING_ID_NAME (terminal_coding->id);
 
   /* For backward compatibility, return nil if it is `undecided'.  */
@@ -9812,7 +9812,7 @@
        doc: /* Internal use only.  */)
   (Lisp_Object coding_system, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
   CHECK_SYMBOL (coding_system);
   if (NILP (coding_system))
     coding_system = Qno_conversion;
@@ -9831,7 +9831,7 @@
   (Lisp_Object terminal)
 {
   return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING
-                        (get_terminal (terminal, 1))->id);
+                        (decode_live_terminal (terminal))->id);
 }
 
 

=== modified file 'src/composite.c'
--- a/src/composite.c   2014-09-11 00:48:57 +0000
+++ b/src/composite.c   2014-10-14 12:45:41 +0000
@@ -1719,7 +1719,7 @@
   if (! FONT_OBJECT_P (font_object))
     {
       struct coding_system *coding;
-      struct terminal *terminal = get_terminal (font_object, 1);
+      struct terminal *terminal = decode_live_terminal (font_object);
 
       coding = ((TERMINAL_TERMINAL_CODING (terminal)->common_flags
                 & CODING_REQUIRE_ENCODING_MASK)

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2014-09-23 16:07:23 +0000
+++ b/src/dispextern.h  2014-10-14 12:45:41 +0000
@@ -3500,7 +3500,6 @@
 extern void produce_glyphs (struct it *);
 extern bool tty_capable_p (struct tty_display_info *, unsigned);
 extern void set_tty_color_mode (struct tty_display_info *, struct frame *);
-extern struct terminal *get_named_tty (const char *);
 extern void create_tty_output (struct frame *);
 extern struct terminal *init_tty (const char *, const char *, bool);
 extern void tty_append_glyph (struct it *);

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2014-10-02 15:33:55 +0000
+++ b/src/dispnew.c     2014-10-14 12:45:41 +0000
@@ -5611,16 +5611,13 @@
 when TERMINAL is nil.  */)
   (Lisp_Object string, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
   FILE *out;
 
   /* ??? Perhaps we should do something special for multibyte strings here.  */
   CHECK_STRING (string);
   block_input ();
 
-  if (!t)
-    error ("Unknown terminal device");
-
   if (t->type == output_initial)
     out = stdout;
   else if (t->type != output_termcap && t->type != output_msdos_raw)

=== modified file 'src/frame.c'
--- a/src/frame.c       2014-10-12 22:56:45 +0000
+++ b/src/frame.c       2014-10-14 12:45:41 +0000
@@ -964,7 +964,7 @@
     if (CONSP (terminal))
       {
         terminal = XCDR (terminal);
-        t = get_terminal (terminal, 1);
+        t = decode_live_terminal (terminal);
       }
 #ifdef MSDOS
     if (t && t != the_only_display_info.terminal)

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2014-10-08 22:05:48 +0000
+++ b/src/keyboard.c    2014-10-14 12:45:41 +0000
@@ -10349,7 +10349,7 @@
 handle_interrupt_signal (int sig)
 {
   /* See if we have an active terminal on our controlling tty.  */
-  struct terminal *terminal = get_named_tty ("/dev/tty");
+  struct terminal *terminal = get_named_terminal ("/dev/tty");
   if (!terminal)
     {
       /* If there are no frames there, let's pretend that we are a
@@ -10403,7 +10403,7 @@
   cancel_echoing ();
 
   /* XXX This code needs to be revised for multi-tty support.  */
-  if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty"))
+  if (!NILP (Vquit_flag) && get_named_terminal ("/dev/tty"))
     {
       if (! in_signal_handler)
        {
@@ -10615,9 +10615,10 @@
 See also `current-input-mode'.  */)
   (Lisp_Object flow, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_tty_terminal (terminal);
   struct tty_display_info *tty;
-  if (t == NULL || (t->type != output_termcap && t->type != output_msdos_raw))
+
+  if (!t)
     return Qnil;
   tty = t->display_info.tty;
 
@@ -10657,11 +10658,11 @@
 See also `current-input-mode'.  */)
   (Lisp_Object meta, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_tty_terminal (terminal);
   struct tty_display_info *tty;
   int new_meta;
 
-  if (t == NULL || (t->type != output_termcap && t->type != output_msdos_raw))
+  if (!t)
     return Qnil;
   tty = t->display_info.tty;
 
@@ -10698,9 +10699,10 @@
 See also `current-input-mode'.  */)
   (Lisp_Object quit)
 {
-  struct terminal *t = get_named_tty ("/dev/tty");
+  struct terminal *t = get_named_terminal ("/dev/tty");
   struct tty_display_info *tty;
-  if (t == NULL || (t->type != output_termcap && t->type != output_msdos_raw))
+
+  if (!t)
     return Qnil;
   tty = t->display_info.tty;
 

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2014-10-12 08:35:50 +0000
+++ b/src/nsfns.m       2014-10-14 12:45:41 +0000
@@ -133,7 +133,7 @@
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type != output_ns)
         error ("Terminal %d is not a Nextstep display", t->id);
@@ -2541,7 +2541,7 @@
 Internal use only, use `display-monitor-attributes-list' instead.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *term = get_terminal (terminal, 1);
+  struct terminal *term = decode_live_terminal (terminal);
   NSArray *screens;
   NSUInteger i, n_monitors;
   struct MonitorInfo *monitors;

=== modified file 'src/term.c'
--- a/src/term.c        2014-09-24 07:17:51 +0000
+++ b/src/term.c        2014-10-14 12:45:41 +0000
@@ -77,7 +77,6 @@
 static void tty_show_cursor (struct tty_display_info *);
 static void tty_hide_cursor (struct tty_display_info *);
 static void tty_background_highlight (struct tty_display_info *tty);
-static struct terminal *get_tty_terminal (Lisp_Object, bool);
 static void clear_tty_hooks (struct terminal *terminal);
 static void set_tty_hooks (struct terminal *terminal);
 static void dissociate_if_controlling_tty (int fd);
@@ -2032,11 +2031,9 @@
 TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_tty_terminal (terminal, 0);
-  if (!t)
-    return Qnil;
-  else
-    return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil;
+  struct terminal *t = decode_tty_terminal (terminal);
+
+  return (t && t->display_info.tty->TN_max_colors > 0) ? Qt : Qnil;
 }
 
 /* Return the number of supported colors.  */
@@ -2049,11 +2046,9 @@
 TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_tty_terminal (terminal, 0);
-  if (!t)
-    return make_number (0);
-  else
-    return make_number (t->display_info.tty->TN_max_colors);
+  struct terminal *t = decode_tty_terminal (terminal);
+
+  return make_number (t ? t->display_info.tty->TN_max_colors : 0);
 }
 
 #ifndef DOS_NT
@@ -2168,52 +2163,6 @@
 
 #endif /* !DOS_NT */
 
-
-
-/* Return the tty display object specified by TERMINAL. */
-
-static struct terminal *
-get_tty_terminal (Lisp_Object terminal, bool throw)
-{
-  struct terminal *t = get_terminal (terminal, throw);
-
-  if (t && t->type != output_termcap && t->type != output_msdos_raw)
-    {
-      if (throw)
-        error ("Device %d is not a termcap terminal device", t->id);
-      else
-        return NULL;
-    }
-
-  return t;
-}
-
-/* Return an active termcap device that uses the tty device with the
-   given name.
-
-   This function ignores suspended devices.
-
-   Returns NULL if the named terminal device is not opened.  */
-
-struct terminal *
-get_named_tty (const char *name)
-{
-  struct terminal *t;
-
-  eassert (name);
-
-  for (t = terminal_list; t; t = t->next_terminal)
-    {
-      if ((t->type == output_termcap || t->type == output_msdos_raw)
-          && !strcmp (t->display_info.tty->name, name)
-          && TERMINAL_ACTIVE_P (t))
-        return t;
-    }
-
-  return 0;
-}
-
-
 DEFUN ("tty-type", Ftty_type, Stty_type, 0, 1, 0,
        doc: /* Return the type of the tty device that TERMINAL uses.
 Returns nil if TERMINAL is not on a tty device.
@@ -2222,15 +2171,10 @@
 selected frame's terminal).  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
-
-  if (t->type != output_termcap && t->type != output_msdos_raw)
-    return Qnil;
-
-  if (t->display_info.tty->type)
-    return build_string (t->display_info.tty->type);
-  else
-    return Qnil;
+  struct terminal *t = decode_tty_terminal (terminal);
+
+  return (t && t->display_info.tty->type
+         ? build_string (t->display_info.tty->type) : Qnil);
 }
 
 DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0,
@@ -2241,13 +2185,9 @@
 TERMINAL is not on a tty device.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_tty_terminal (terminal);
 
-  if ((t->type != output_termcap && t->type != output_msdos_raw)
-      || strcmp (t->display_info.tty->name, DEV_TTY) != 0)
-    return Qnil;
-  else
-    return Qt;
+  return (t && !strcmp (t->display_info.tty->name, DEV_TTY) ? Qt : Qnil);
 }
 
 DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
@@ -2261,7 +2201,7 @@
 TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
 
   if (t->type == output_termcap)
     t->display_info.tty->TS_enter_underline_mode = 0;
@@ -2276,7 +2216,7 @@
 top-most frame on the text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
 
   if (t->type == output_termcap)
     return t->display_info.tty->top_frame;
@@ -2306,11 +2246,11 @@
 A suspended tty may be resumed by calling `resume-tty' on it.  */)
   (Lisp_Object tty)
 {
-  struct terminal *t = get_tty_terminal (tty, 1);
+  struct terminal *t = decode_tty_terminal (tty);
   FILE *f;
 
   if (!t)
-    error ("Unknown tty device");
+    error ("Attempt to suspend a non-text terminal device");
 
   f = t->display_info.tty->input;
 
@@ -2366,15 +2306,15 @@
 frame's terminal). */)
   (Lisp_Object tty)
 {
-  struct terminal *t = get_tty_terminal (tty, 1);
+  struct terminal *t = decode_tty_terminal (tty);
   int fd;
 
   if (!t)
-    error ("Unknown tty device");
+    error ("Attempt to resume a non-text terminal device");
 
   if (!t->display_info.tty->input)
     {
-      if (get_named_tty (t->display_info.tty->name))
+      if (get_named_terminal (t->display_info.tty->name))
         error ("Cannot resume display while another display is active on the 
same device");
 
 #ifdef MSDOS
@@ -4007,7 +3947,7 @@
   /* XXX Perhaps this should be made explicit by having init_tty
      always create a new terminal and separating terminal and frame
      creation on Lisp level.  */
-  terminal = get_named_tty (name);
+  terminal = get_named_terminal (name);
   if (terminal)
     return terminal;
 

=== modified file 'src/termhooks.h'
--- a/src/termhooks.h   2014-09-24 20:30:28 +0000
+++ b/src/termhooks.h   2014-10-14 12:45:41 +0000
@@ -681,7 +681,9 @@
   (t->type == output_ns ? t->display_info.ns->name_list_element : Qnil)
 #endif
 
-extern struct terminal *get_terminal (Lisp_Object terminal, bool);
+extern struct terminal *decode_live_terminal (Lisp_Object);
+extern struct terminal *decode_tty_terminal (Lisp_Object);
+extern struct terminal *get_named_terminal (const char *);
 extern struct terminal *create_terminal (enum output_method,
                                         struct redisplay_interface *);
 extern void delete_terminal (struct terminal *);

=== modified file 'src/terminal.c'
--- a/src/terminal.c    2014-07-21 01:41:59 +0000
+++ b/src/terminal.c    2014-10-14 12:45:41 +0000
@@ -37,7 +37,9 @@
 /* The initial terminal device, created by initial_term_init.  */
 struct terminal *initial_terminal;
 
+Lisp_Object Qrun_hook_with_args;
 static Lisp_Object Qterminal_live_p;
+static Lisp_Object Qdelete_terminal_functions;
 
 static void delete_initial_terminal (struct terminal *);
 
@@ -194,34 +196,66 @@
     (*FRAME_TERMINAL (f)->ins_del_lines_hook) (f, vpos, n);
 }
 
-
-
-
-/* Return the terminal object specified by TERMINAL.  TERMINAL may be
-   a terminal object, a frame, or nil for the terminal device of the
-   current frame.  If THROW is false, return NULL for failure,
-   otherwise throw an error.  */
-
-struct terminal *
-get_terminal (Lisp_Object terminal, bool throw)
+/* Return the terminal object specified by TERMINAL.  TERMINAL may
+   be a terminal object, a frame, or nil for the terminal device of
+   the current frame.  If TERMINAL is neither from the above or the
+   resulting terminal object is deleted, return NULL.  */
+
+static struct terminal *
+decode_terminal (Lisp_Object terminal)
 {
-  struct terminal *result = NULL;
+  struct terminal *t;
 
   if (NILP (terminal))
     terminal = selected_frame;
-
-  if (TERMINALP (terminal))
-    result = XTERMINAL (terminal);
-  else if (FRAMEP (terminal))
-    result = FRAME_TERMINAL (XFRAME (terminal));
-
-  if (result && !result->name)
-    result = NULL;
-
-  if (result == NULL && throw)
+  t = (TERMINALP (terminal)
+       ? XTERMINAL (terminal)
+       : FRAMEP (terminal) ? FRAME_TERMINAL (XFRAME (terminal)) : NULL);
+  return t && t->name ? t : NULL;
+}
+
+/* Like above, but throw an error if TERMINAL is not valid or deleted.  */
+
+struct terminal *
+decode_live_terminal (Lisp_Object terminal)
+{
+  struct terminal *t = decode_terminal (terminal);
+
+  if (!t)
     wrong_type_argument (Qterminal_live_p, terminal);
-
-  return result;
+  return t;
+}
+
+/* Like decode_terminal, but ensure that the resulting terminal object refers
+   to a text-based terminal device.  */
+
+struct terminal *
+decode_tty_terminal (Lisp_Object terminal)
+{
+  struct terminal *t = decode_live_terminal (terminal);
+
+  return (t->type == output_termcap || t->type == output_msdos_raw) ? t : NULL;
+}
+
+/* Return an active (not suspended) text-based terminal device that uses
+   the tty device with the given NAME, or NULL if the named terminal device
+   is not opened.  */
+
+struct terminal *
+get_named_terminal (const char *name)
+{
+  struct terminal *t;
+
+  eassert (name);
+
+  for (t = terminal_list; t; t = t->next_terminal)
+    {
+      if ((t->type == output_termcap || t->type == output_msdos_raw)
+          && !strcmp (t->display_info.tty->name, name)
+          && TERMINAL_ACTIVE_P (t))
+        return t;
+    }
+  return NULL;
 }
 
 /* Create a new terminal object of TYPE and add it to the terminal list.  RIF
@@ -308,8 +342,6 @@
     }
 }
 
-Lisp_Object Qrun_hook_with_args;
-static Lisp_Object Qdelete_terminal_functions;
 DEFUN ("delete-terminal", Fdelete_terminal, Sdelete_terminal, 0, 2, 0,
        doc: /* Delete TERMINAL by deleting all frames on it and closing the 
terminal.
 TERMINAL may be a terminal object, a frame, or nil (meaning the
@@ -319,7 +351,7 @@
 but if the second argument FORCE is non-nil, you may do so. */)
   (Lisp_Object terminal, Lisp_Object force)
 {
-  struct terminal *t = get_terminal (terminal, 0);
+  struct terminal *t = decode_terminal (terminal);
 
   if (!t)
     return Qnil;
@@ -380,9 +412,7 @@
 possible return values.  */)
   (Lisp_Object object)
 {
-  struct terminal *t;
-
-  t = get_terminal (object, 0);
+  struct terminal *t = decode_terminal (object);
 
   if (!t)
     return Qnil;
@@ -429,8 +459,7 @@
 selected frame's terminal). */)
   (Lisp_Object terminal)
 {
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
 
   return t->name ? build_string (t->name) : Qnil;
 }
@@ -467,9 +496,7 @@
 selected frame's terminal).  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
-  return Fcopy_alist (t->param_alist);
+  return Fcopy_alist (decode_live_terminal (terminal)->param_alist);
 }
 
 DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0,
@@ -478,12 +505,8 @@
 selected frame's terminal).  */)
   (Lisp_Object terminal, Lisp_Object parameter)
 {
-  Lisp_Object value;
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
   CHECK_SYMBOL (parameter);
-  value = Fcdr (Fassq (parameter, t->param_alist));
-  return value;
+  return Fcdr (Fassq (parameter, decode_live_terminal 
(terminal)->param_alist));
 }
 
 DEFUN ("set-terminal-parameter", Fset_terminal_parameter,
@@ -495,9 +518,7 @@
 selected frame's terminal).  */)
   (Lisp_Object terminal, Lisp_Object parameter, Lisp_Object value)
 {
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
-  return store_terminal_param (t, parameter, value);
+  return store_terminal_param (decode_live_terminal (terminal), parameter, 
value);
 }
 
 /* Initial frame has no device-dependent output data, but has

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-10-08 10:39:45 +0000
+++ b/src/w32fns.c      2014-10-14 12:45:41 +0000
@@ -276,7 +276,7 @@
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type != output_w32)
         error ("Terminal %d is not a W32 display", t->id);

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2014-10-03 05:31:17 +0000
+++ b/src/xfns.c        2014-10-14 12:45:41 +0000
@@ -159,7 +159,7 @@
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type != output_x_window)
         error ("Terminal %d is not an X display", t->id);

=== modified file 'src/xselect.c'
--- a/src/xselect.c     2014-10-03 02:20:52 +0000
+++ b/src/xselect.c     2014-10-14 12:45:41 +0000
@@ -1901,7 +1901,7 @@
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type == output_x_window)
        FOR_EACH_FRAME (tail, frame)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]