[Xcb-commit] xcb-util/convenient xcb_aux.c,1.2,1.3

Jamey Sharp xcb-commit at lists.freedesktop.org
Mon Dec 12 11:18:17 PST 2005


Update of /cvs/xcb/xcb-util/convenient
In directory gabe:/tmp/cvs-serv6818

Modified Files:
	xcb_aux.c 
Log Message:
Rewrite GetScreen using simplest-possible code, in my opinion. :-)


Index: xcb_aux.c
===================================================================
RCS file: /cvs/xcb/xcb-util/convenient/xcb_aux.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xcb_aux.c	11 Dec 2005 22:15:36 -0000	1.2
+++ xcb_aux.c	12 Dec 2005 19:18:15 -0000	1.3
@@ -31,17 +31,11 @@
 XCBAuxGetScreen (XCBConnection *c,
 		 int            screen)
 {
-  XCBSCREENIter i;
-  int           cur;
-  
-  if (!c) return NULL;
-  
-  i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c));
-  if (screen > i.rem - 1) return NULL; /* screen must be */
-                                       /* between 0 and i.rem - 1 */
-  for (cur = 0; cur < screen; XCBSCREENNext(&i), ++cur) {}
-  
-  return i.data;
+  XCBSCREENIter i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c));
+  for (; i.rem; --screen, XCBSCREENNext(&i))
+    if (screen == 0)
+      return i.data;
+  return 0;
 }
 
 XCBVISUALTYPE *



More information about the xcb-commit mailing list