emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/gnus-cloud 204ce6f 57/61: Merge branch 'master' of


From: Teodor Zlatanov
Subject: [Emacs-diffs] scratch/gnus-cloud 204ce6f 57/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Fri, 1 Jul 2016 17:37:57 +0000 (UTC)

branch: scratch/gnus-cloud
commit 204ce6f15b5605b657184f3563ed162122638271
Merge: 0d58111 fd6a133
Author: Ted Zlatanov <address@hidden>
Commit: Ted Zlatanov <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 src/frame.c |   79 +++++++++++++++++++++++------------------------------------
 src/lread.c |   24 ++++++++++--------
 2 files changed, 45 insertions(+), 58 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index aa06a38..540b69f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3110,70 +3110,58 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
   /* Record in these vectors all the parms specified.  */
   Lisp_Object *parms;
   Lisp_Object *values;
-  ptrdiff_t i, p;
+  ptrdiff_t i, j, size;
   bool left_no_change = 0, top_no_change = 0;
 #ifdef HAVE_X_WINDOWS
   bool icon_left_no_change = 0, icon_top_no_change = 0;
 #endif
 
-  i = 0;
-  for (tail = alist; CONSP (tail); tail = XCDR (tail))
-    i++;
+  for (size = 0, tail = alist; CONSP (tail); tail = XCDR (tail))
+    size++;
 
   USE_SAFE_ALLOCA;
-  SAFE_ALLOCA_LISP (parms, 2 * i);
-  values = parms + i;
+  SAFE_ALLOCA_LISP (parms, 2 * size);
+  values = parms + size;
 
   /* Extract parm names and values into those vectors.  */
 
-  i = 0;
+  i = 0, j = size - 1;
   for (tail = alist; CONSP (tail); tail = XCDR (tail))
     {
-      Lisp_Object elt;
-
-      elt = XCAR (tail);
-      parms[i] = Fcar (elt);
-      values[i] = Fcdr (elt);
-      i++;
-    }
-  /* TAIL and ALIST are not used again below here.  */
-  alist = tail = Qnil;
-
-  top = left = Qunbound;
-  icon_left = icon_top = Qunbound;
+      Lisp_Object elt = XCAR (tail), prop = Fcar (elt), val = Fcdr (elt);
 
-  /* Process foreground_color and background_color before anything else.
-     They are independent of other properties, but other properties (e.g.,
-     cursor_color) are dependent upon them.  */
-  /* Process default font as well, since fringe widths depends on it.  */
-  for (p = 0; p < i; p++)
-    {
-      Lisp_Object prop, val;
+      /* Some properties are independent of other properties, but other
+        properties are dependent upon them.  These special properties
+        are foreground_color, background_color (affects cursor_color)
+        and font (affects fringe widths); they're recorded starting
+        from the end of PARMS and VALUES to process them first by using
+        reverse iteration.  */
 
-      prop = parms[p];
-      val = values[p];
       if (EQ (prop, Qforeground_color)
          || EQ (prop, Qbackground_color)
          || EQ (prop, Qfont))
        {
-         register Lisp_Object param_index, old_value;
-
-         old_value = get_frame_param (f, prop);
-         if (NILP (Fequal (val, old_value)))
-           {
-             store_frame_param (f, prop, val);
-
-             param_index = Fget (prop, Qx_frame_parameter);
-             if (NATNUMP (param_index)
-                 && XFASTINT (param_index) < ARRAYELTS (frame_parms)
-                  && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
-                (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) 
(f, val, old_value);
-           }
+         parms[j] = prop;
+         values[j] = val;
+         j--;
+       }
+      else
+       {
+         parms[i] = prop;
+         values[i] = val;
+         i++;
        }
     }
 
-  /* Now process them in reverse of specified order.  */
-  while (i-- != 0)
+  /* TAIL and ALIST are not used again below here.  */
+  alist = tail = Qnil;
+
+  top = left = Qunbound;
+  icon_left = icon_top = Qunbound;
+
+  /* Reverse order is used to make sure that special
+     properties noticed above are processed first.  */
+  for (i = size - 1; i >= 0; i--)
     {
       Lisp_Object prop, val;
 
@@ -3221,11 +3209,6 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
          fullscreen = val;
          fullscreen_change = true;
        }
-      else if (EQ (prop, Qforeground_color)
-              || EQ (prop, Qbackground_color)
-              || EQ (prop, Qfont))
-       /* Processed above.  */
-       continue;
       else
        {
          register Lisp_Object param_index, old_value;
diff --git a/src/lread.c b/src/lread.c
index 5c47f78..ecd4827 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1464,6 +1464,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
 
   for (; CONSP (path); path = XCDR (path))
     {
+      ptrdiff_t baselen, prefixlen;
+
       filename = Fexpand_file_name (str, XCAR (path));
       if (!complete_filename_p (filename))
        /* If there are non-absolute elts in PATH (eg ".").  */
@@ -1485,6 +1487,14 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
          fn = SAFE_ALLOCA (fn_size);
        }
 
+      /* Copy FILENAME's data to FN but remove starting /: if any.  */
+      prefixlen = ((SCHARS (filename) > 2
+                   && SREF (filename, 0) == '/'
+                   && SREF (filename, 1) == ':')
+                  ? 2 : 0);
+      baselen = SBYTES (filename) - prefixlen;
+      memcpy (fn, SDATA (filename) + prefixlen, baselen);
+
       /* Loop over suffixes.  */
       for (tail = NILP (suffixes) ? list1 (empty_unibyte_string) : suffixes;
           CONSP (tail); tail = XCDR (tail))
@@ -1493,16 +1503,10 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
          ptrdiff_t fnlen, lsuffix = SBYTES (suffix);
          Lisp_Object handler;
 
-         /* Concatenate path element/specified name with the suffix.
-            If the directory starts with /:, remove that.  */
-         int prefixlen = ((SCHARS (filename) > 2
-                           && SREF (filename, 0) == '/'
-                           && SREF (filename, 1) == ':')
-                          ? 2 : 0);
-         fnlen = SBYTES (filename) - prefixlen;
-         memcpy (fn, SDATA (filename) + prefixlen, fnlen);
-         memcpy (fn + fnlen, SDATA (suffix), lsuffix + 1);
-         fnlen += lsuffix;
+         /* Make complete filename by appending SUFFIX.  */
+         memcpy (fn + baselen, SDATA (suffix), lsuffix + 1);
+         fnlen = baselen + lsuffix;
+
          /* Check that the file exists and is not a directory.  */
          /* We used to only check for handlers on non-absolute file names:
                if (absolute)



reply via email to

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