emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114710: Remove port-specific display name lists to


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114710: Remove port-specific display name lists to avoid extra
Date: Fri, 18 Oct 2013 12:58:08 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114710
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2013-10-18 16:57:44 +0400
message:
  Remove port-specific display name lists to avoid extra
  complexity and data duplication with display info lists.
  * xterm.h (x_display_name_list): Remove declaration.
  * xterm.c (x_display_name_list): Remove.
  (x_term_init, x_delete_display, syms_of_xterm): Adjust users.
  * xfns.c (x_display_info_for_name, Fx_display_list):
  Likewise.  Use x_display_list where appropriate.
  * w32term.h (w32_display_name_list): Remove declaration.
  * w32term.c (w32_display_name_list): Remove.
  (w32_initialize_display_info, x_delete_display, syms_of_w32term):
  Adjust users.
  * w32fns.c (x_display_info_for_name, Fx_display_list):
  Likewise.  Use x_display_list where appropriate.
  * nsterm.h (ns_display_name_list): Remove declaration.
  * nsterm.m (ns_display_name_list): Remove.
  (ns_term_init, syms_of_nsterm): Adjust users.
  * nsfns.m (ns_display_info_for_name, Fx_display_list):
  Likewise.  Use x_display_list where appropriate.
  * termhooks.h (TERMINAL_FONT_CACHE): New macro.
  * alloc.c (toplevel) [HAVE_WINDOW_SYSTEM]: Include TERM_HEADER.
  (mark_terminals): Mark per-terminal font cache.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
  src/nsfns.m                    nsfns.m-20091113204419-o5vbwnq5f7feedwu-8741
  src/nsterm.h                   nsterm.h-20091113204419-o5vbwnq5f7feedwu-8746
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
  src/termhooks.h                termhooks.h-20091113204419-o5vbwnq5f7feedwu-249
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/w32term.h                  w32term.h-20091113204419-o5vbwnq5f7feedwu-954
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
  src/xterm.h                    xterm.h-20091113204419-o5vbwnq5f7feedwu-228
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-18 04:27:34 +0000
+++ b/src/ChangeLog     2013-10-18 12:57:44 +0000
@@ -1,3 +1,27 @@
+2013-10-18  Dmitry Antipov  <address@hidden>
+
+       Remove port-specific display name lists to avoid extra
+       complexity and data duplication with display info lists.
+       * xterm.h (x_display_name_list): Remove declaration.
+       * xterm.c (x_display_name_list): Remove.
+       (x_term_init, x_delete_display, syms_of_xterm): Adjust users.
+       * xfns.c (x_display_info_for_name, Fx_display_list):
+       Likewise.  Use x_display_list where appropriate.
+       * w32term.h (w32_display_name_list): Remove declaration.
+       * w32term.c (w32_display_name_list): Remove.
+       (w32_initialize_display_info, x_delete_display, syms_of_w32term):
+       Adjust users.
+       * w32fns.c (x_display_info_for_name, Fx_display_list):
+       Likewise.  Use x_display_list where appropriate.
+       * nsterm.h (ns_display_name_list): Remove declaration.
+       * nsterm.m (ns_display_name_list): Remove.
+       (ns_term_init, syms_of_nsterm): Adjust users.
+       * nsfns.m (ns_display_info_for_name, Fx_display_list):
+       Likewise.  Use x_display_list where appropriate.
+       * termhooks.h (TERMINAL_FONT_CACHE): New macro.
+       * alloc.c (toplevel) [HAVE_WINDOW_SYSTEM]: Include TERM_HEADER.
+       (mark_terminals): Mark per-terminal font cache.
+
 2013-10-17  Barry O'Reilly  <address@hidden>
 
        Don't run timers in input-pending-p.  Its new check-timers param

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2013-10-11 06:32:29 +0000
+++ b/src/alloc.c       2013-10-18 12:57:44 +0000
@@ -42,6 +42,9 @@
 #include "frame.h"
 #include "blockinput.h"
 #include "termhooks.h"         /* For struct terminal.  */
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
 
 #include <verify.h>
 
@@ -6115,6 +6118,9 @@
         it might have been marked already.  Make sure the image cache
         gets marked.  */
       mark_image_cache (t->image_cache);
+      /* FIXME: currently font cache may grow too large
+        and probably needs special finalization.  */
+      mark_object (TERMINAL_FONT_CACHE (t));
 #endif /* HAVE_WINDOW_SYSTEM */
       if (!VECTOR_MARKED_P (t))
        mark_vectorlike ((struct Lisp_Vector *)t);

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2013-10-09 18:50:14 +0000
+++ b/src/nsfns.m       2013-10-18 12:57:44 +0000
@@ -175,20 +175,13 @@
 struct ns_display_info *
 ns_display_info_for_name (Lisp_Object name)
 {
-  Lisp_Object names;
   struct ns_display_info *dpyinfo;
 
   CHECK_STRING (name);
 
-  for (dpyinfo = x_display_list, names = ns_display_name_list;
-       dpyinfo;
-       dpyinfo = dpyinfo->next, names = XCDR (names))
-    {
-      Lisp_Object tem;
-      tem = Fstring_equal (XCAR (XCAR (names)), name);
-      if (!NILP (tem))
-        return dpyinfo;
-    }
+  for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
+    if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
+      return dpyinfo;
 
   error ("Emacs for OpenStep does not yet support multi-display.");
 
@@ -1843,11 +1836,11 @@
        doc: /* Return the list of display names that Emacs has connections to. 
 */)
      (void)
 {
-  Lisp_Object tail, result;
+  Lisp_Object result = Qnil;
+  struct ns_display_info *ndi;
 
-  result = Qnil;
-  for (tail = ns_display_name_list; CONSP (tail); tail = XCDR (tail))
-    result = Fcons (XCAR (XCAR (tail)), result);
+  for (ndi = x_display_list; ndi; ndi = ndi->next)
+    result = Fcons (XCAR (ndi->name_list_element), result);
 
   return result;
 }

=== modified file 'src/nsterm.h'
--- a/src/nsterm.h      2013-10-15 02:45:03 +0000
+++ b/src/nsterm.h      2013-10-18 12:57:44 +0000
@@ -552,8 +552,7 @@
   /* The generic display parameters corresponding to this NS display. */
   struct terminal *terminal;
 
-  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
-     The same cons cell also appears in ns_display_name_list.  */
+  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).  */
   Lisp_Object name_list_element;
 
   /* The number of fonts loaded. */
@@ -624,7 +623,6 @@
 /* This is a chain of structures for all the NS displays currently in use.  */
 extern struct ns_display_info *x_display_list;
 
-extern Lisp_Object ns_display_name_list;
 extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name);
 
 struct ns_output

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2013-10-15 02:45:03 +0000
+++ b/src/nsterm.m      2013-10-18 12:57:44 +0000
@@ -184,7 +184,6 @@
 
 /* Display variables */
 struct ns_display_info *x_display_list; /* Chain of existing displays */
-Lisp_Object ns_display_name_list;
 long context_menu_value = 0;
 
 /* display update */
@@ -4173,10 +4172,7 @@
   dpyinfo->next = x_display_list;
   x_display_list = dpyinfo;
 
-  /* Put it on ns_display_name_list */
-  ns_display_name_list = Fcons (Fcons (display_name, Qnil),
-                                ns_display_name_list);
-  dpyinfo->name_list_element = XCAR (ns_display_name_list);
+  dpyinfo->name_list_element = Fcons (display_name, Qnil);
 
   terminal->name = xstrdup (SSDATA (display_name));
 
@@ -7460,9 +7456,6 @@
                "Whether to confirm application quit using dialog.");
   ns_confirm_quit = Qnil;
 
-  staticpro (&ns_display_name_list);
-  ns_display_name_list = Qnil;
-
   DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar,
                doc: /* Non-nil means that the menu bar is hidden, but appears 
when the mouse is near.
 Only works on OSX 10.6 or later.  */);

=== modified file 'src/termhooks.h'
--- a/src/termhooks.h   2013-10-17 06:42:21 +0000
+++ b/src/termhooks.h   2013-10-18 12:57:44 +0000
@@ -623,6 +623,19 @@
   (((d)->type != output_termcap && (d)->type != output_msdos_raw)      \
    || (d)->display_info.tty->input)
 
+/* Return font cache data for the specified terminal.  The historical
+   name is grossly misleading, actually it is (NAME . FONT-LIST-CACHE).  */
+#if defined (HAVE_X_WINDOWS)
+#define TERMINAL_FONT_CACHE(t)                                         \
+  (t->type == output_x_window ? t->display_info.x->name_list_element : Qnil)
+#elif defined (HAVE_NTGUI)
+#define TERMINAL_FONT_CACHE(t)                                         \
+  (t->type == output_w32 ? t->display_info.w32->name_list_element : Qnil)
+#elif defined (HAVE_NS)
+#define TERMINAL_FONT_CACHE(t)                                         \
+  (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 *create_terminal (void);
 extern void delete_terminal (struct terminal *);

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2013-09-26 07:37:16 +0000
+++ b/src/w32fns.c      2013-10-18 12:57:44 +0000
@@ -5126,20 +5126,13 @@
 struct w32_display_info *
 x_display_info_for_name (Lisp_Object name)
 {
-  Lisp_Object names;
   struct w32_display_info *dpyinfo;
 
   CHECK_STRING (name);
 
-  for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
-       dpyinfo && !NILP (w32_display_name_list);
-       dpyinfo = dpyinfo->next, names = XCDR (names))
-    {
-      Lisp_Object tem;
-      tem = Fstring_equal (XCAR (XCAR (names)), name);
-      if (!NILP (tem))
-       return dpyinfo;
-    }
+  for (dpyinfo = &one_w32_display_info; dpyinfo; dpyinfo = dpyinfo->next)
+    if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
+      return dpyinfo;
 
   /* Use this general default value to start with.  */
   Vx_resource_name = Vinvocation_name;
@@ -5274,11 +5267,11 @@
        doc: /* Return the list of display names that Emacs has connections to. 
 */)
   (void)
 {
-  Lisp_Object tail, result;
+  Lisp_Object result = Qnil;
+  struct w32_display_info *wdi;
 
-  result = Qnil;
-  for (tail = w32_display_name_list; CONSP (tail); tail = XCDR (tail))
-    result = Fcons (XCAR (XCAR (tail)), result);
+  for (wdi = x_display_list; wdi; wdi = wdi->next)
+    result = Fcons (XCAR (wdi->name_list_element), result);
 
   return result;
 }

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2013-10-14 12:19:21 +0000
+++ b/src/w32term.c     2013-10-18 12:57:44 +0000
@@ -99,13 +99,6 @@
 struct w32_display_info one_w32_display_info;
 struct w32_display_info *x_display_list;
 
-/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
-   one for each element of w32_display_list and in the same order.
-   NAME is the name of the frame.
-   FONT-LIST-CACHE records previous values returned by x-list-fonts.  */
-Lisp_Object w32_display_name_list;
-
-
 #if _WIN32_WINNT < 0x0500 && !defined(_W64)
 /* Pre Windows 2000, this was not available, but define it here so
    that Emacs compiled on such a platform will run on newer versions.
@@ -6105,11 +6098,7 @@
 
   memset (dpyinfo, 0, sizeof (*dpyinfo));
 
-  /* Put it on w32_display_name_list.  */
-  w32_display_name_list = Fcons (Fcons (display_name, Qnil),
-                                 w32_display_name_list);
-  dpyinfo->name_list_element = XCAR (w32_display_name_list);
-
+  dpyinfo->name_list_element = Fcons (display_name, Qnil);
   dpyinfo->w32_id_name = xmalloc (SCHARS (Vinvocation_name)
                                  + SCHARS (Vsystem_name) + 2);
   sprintf (dpyinfo->w32_id_name, "address@hidden",
@@ -6357,27 +6346,7 @@
 void
 x_delete_display (struct w32_display_info *dpyinfo)
 {
-  /* Discard this display from w32_display_name_list and w32_display_list.
-     We can't use Fdelq because that can quit.  */
-  if (! NILP (w32_display_name_list)
-      && EQ (XCAR (w32_display_name_list), dpyinfo->name_list_element))
-    w32_display_name_list = XCDR (w32_display_name_list);
-  else
-    {
-      Lisp_Object tail;
-
-      tail = w32_display_name_list;
-      while (CONSP (tail) && CONSP (XCDR (tail)))
-       {
-         if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element))
-           {
-             XSETCDR (tail, XCDR (XCDR (tail)));
-             break;
-           }
-         tail = XCDR (tail);
-       }
-    }
-
+  /* FIXME: the only display info apparently can't be deleted.  */
   /* free palette table */
   {
     struct w32_palette_entry * plist;
@@ -6515,9 +6484,6 @@
 void
 syms_of_w32term (void)
 {
-  staticpro (&w32_display_name_list);
-  w32_display_name_list = Qnil;
-
   DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
 
   DEFSYM (Qadded, "added");

=== modified file 'src/w32term.h'
--- a/src/w32term.h     2013-09-29 18:38:56 +0000
+++ b/src/w32term.h     2013-10-18 12:57:44 +0000
@@ -86,8 +86,7 @@
   /* The generic display parameters corresponding to this w32 display.  */
   struct terminal *terminal;
 
-  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
-     The same cons cell also appears in x_display_name_list.  */
+  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).  */
   Lisp_Object name_list_element;
 
   /* Number of frames that are on this display.  */
@@ -216,12 +215,6 @@
 extern struct w32_display_info *x_display_list;
 extern struct w32_display_info one_w32_display_info;
 
-/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
-   one for each element of w32_display_list and in the same order.
-   NAME is the name of the frame.
-   FONT-LIST-CACHE records previous values returned by x-list-fonts.  */
-extern Lisp_Object w32_display_name_list;
-
 extern struct frame *x_window_to_frame (struct w32_display_info *, HWND);
 
 struct w32_display_info *x_display_info_for_name (Lisp_Object);

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2013-09-22 09:48:21 +0000
+++ b/src/xfns.c        2013-10-18 12:57:44 +0000
@@ -4242,20 +4242,13 @@
 static struct x_display_info *
 x_display_info_for_name (Lisp_Object name)
 {
-  Lisp_Object names;
   struct x_display_info *dpyinfo;
 
   CHECK_STRING (name);
 
-  for (dpyinfo = x_display_list, names = x_display_name_list;
-       dpyinfo;
-       dpyinfo = dpyinfo->next, names = XCDR (names))
-    {
-      Lisp_Object tem;
-      tem = Fstring_equal (XCAR (XCAR (names)), name);
-      if (!NILP (tem))
-       return dpyinfo;
-    }
+  for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
+    if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
+      return dpyinfo;
 
   /* Use this general default value to start with.  */
   Vx_resource_name = Vinvocation_name;
@@ -4338,11 +4331,11 @@
        doc: /* Return the list of display names that Emacs has connections to. 
 */)
   (void)
 {
-  Lisp_Object tail, result;
+  Lisp_Object result = Qnil;
+  struct x_display_info *xdi;
 
-  result = Qnil;
-  for (tail = x_display_name_list; CONSP (tail); tail = XCDR (tail))
-    result = Fcons (XCAR (XCAR (tail)), result);
+  for (xdi = x_display_list; xdi; xdi = xdi->next)
+    result = Fcons (XCAR (xdi->name_list_element), result);
 
   return result;
 }

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-10-14 12:19:21 +0000
+++ b/src/xterm.c       2013-10-18 12:57:44 +0000
@@ -148,13 +148,6 @@
 
 struct x_display_info *x_display_list;
 
-/* This is a list of cons cells, each of the form (NAME
-   . FONT-LIST-CACHE), one for each element of x_display_list and in
-   the same order.  NAME is the name of the frame.  FONT-LIST-CACHE
-   records previous values returned by x-list-fonts.  */
-
-Lisp_Object x_display_name_list;
-
 #ifdef USE_X_TOOLKIT
 
 /* The application context for Xt use.  */
@@ -9894,11 +9887,9 @@
 
   {
     struct x_display_info *share;
-    Lisp_Object tail;
 
-    for (share = x_display_list, tail = x_display_name_list; share;
-        share = share->next, tail = XCDR (tail))
-      if (same_x_server (SSDATA (XCAR (XCAR (tail))),
+    for (share = x_display_list; share; share = share->next)
+      if (same_x_server (SSDATA (XCAR (share->name_list_element)),
                         SSDATA (display_name)))
        break;
     if (share)
@@ -9944,11 +9935,7 @@
   dpyinfo->next = x_display_list;
   x_display_list = dpyinfo;
 
-  /* Put it on x_display_name_list as well, to keep them parallel.  */
-  x_display_name_list = Fcons (Fcons (display_name, Qnil),
-                              x_display_name_list);
-  dpyinfo->name_list_element = XCAR (x_display_name_list);
-
+  dpyinfo->name_list_element = Fcons (display_name, Qnil);
   dpyinfo->display = dpy;
 
   /* Set the name of the terminal. */
@@ -10275,27 +10262,6 @@
         break;
       }
 
-  /* Discard this display from x_display_name_list and x_display_list.
-     We can't use Fdelq because that can quit.  */
-  if (! NILP (x_display_name_list)
-      && EQ (XCAR (x_display_name_list), dpyinfo->name_list_element))
-    x_display_name_list = XCDR (x_display_name_list);
-  else
-    {
-      Lisp_Object tail;
-
-      tail = x_display_name_list;
-      while (CONSP (tail) && CONSP (XCDR (tail)))
-       {
-         if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element))
-           {
-             XSETCDR (tail, XCDR (XCDR (tail)));
-             break;
-           }
-         tail = XCDR (tail);
-       }
-    }
-
   if (next_noop_dpyinfo == dpyinfo)
     next_noop_dpyinfo = dpyinfo->next;
 
@@ -10565,9 +10531,6 @@
 {
   x_error_message = NULL;
 
-  staticpro (&x_display_name_list);
-  x_display_name_list = Qnil;
-
   DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
   DEFSYM (Qlatin_1, "latin-1");
 

=== modified file 'src/xterm.h'
--- a/src/xterm.h       2013-09-29 18:38:56 +0000
+++ b/src/xterm.h       2013-10-18 12:57:44 +0000
@@ -142,8 +142,7 @@
   /* This says how to access this display in Xlib.  */
   Display *display;
 
-  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
-     The same cons cell also appears in x_display_name_list.  */
+  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).  */
   Lisp_Object name_list_element;
 
   /* Number of frames that are on this display.  */
@@ -412,12 +411,6 @@
 /* This is a chain of structures for all the X displays currently in use.  */
 extern struct x_display_info *x_display_list;
 
-/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
-   one for each element of x_display_list and in the same order.
-   NAME is the name of the frame.
-   FONT-LIST-CACHE records previous values returned by x-list-fonts.  */
-extern Lisp_Object x_display_name_list;
-
 extern struct x_display_info *x_display_info_for_display (Display *);
 extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
 extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);


reply via email to

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