]> code.delx.au - gnu-emacs/blobdiff - src/xselect.c
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / src / xselect.c
index de9386bd7d98291f68a0e1096721832b837e25dd..f43efab827b643457dc8962913fe8afd1ab93709 100644 (file)
@@ -1,5 +1,5 @@
 /* X Selection processing for Emacs.
-   Copyright (C) 1993-1997, 2000-2012 Free Software Foundation, Inc.
+   Copyright (C) 1993-1997, 2000-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1940,7 +1940,7 @@ x_handle_selection_notify (XSelectionEvent *event)
 static struct frame *
 frame_for_x_selection (Lisp_Object object)
 {
-  Lisp_Object tail;
+  Lisp_Object tail, frame;
   struct frame *f;
 
   if (NILP (object))
@@ -1949,9 +1949,9 @@ frame_for_x_selection (Lisp_Object object)
       if (FRAME_X_P (f) && FRAME_LIVE_P (f))
        return f;
 
-      for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
+      FOR_EACH_FRAME (tail, frame)
        {
-         f = XFRAME (XCAR (tail));
+         f = XFRAME (frame);
          if (FRAME_X_P (f) && FRAME_LIVE_P (f))
            return f;
        }
@@ -1959,15 +1959,14 @@ frame_for_x_selection (Lisp_Object object)
   else if (TERMINALP (object))
     {
       struct terminal *t = get_terminal (object, 1);
+
       if (t->type == output_x_window)
-       {
-         for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
-           {
-             f = XFRAME (XCAR (tail));
-             if (FRAME_LIVE_P (f) && f->terminal == t)
-               return f;
-           }
-       }
+       FOR_EACH_FRAME (tail, frame)
+         {
+           f = XFRAME (frame);
+           if (FRAME_LIVE_P (f) && f->terminal == t)
+             return f;
+         }
     }
   else if (FRAMEP (object))
     {