Move _xcb_set_fd_flags to xcb_conn.c and make it static. xcb_util.c now has only...
authorJamey Sharp <jamey@minilop.net>
Fri, 24 Feb 2006 09:50:48 +0000 (01:50 -0800)
committerJamey Sharp <jamey@minilop.net>
Fri, 24 Feb 2006 09:50:48 +0000 (01:50 -0800)
src/xcb_conn.c
src/xcb_util.c
src/xcbint.h

index 698cf51..5839ed8 100644 (file)
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <sys/select.h>
+#include <sys/fcntl.h>
 
 #include "xcb.h"
 #include "xcbint.h"
 
+static int set_fd_flags(const int fd)
+{
+    long flags = fcntl(fd, F_GETFL, 0);
+    if(flags == -1)
+        return 0;
+    flags |= O_NONBLOCK;
+    if(fcntl(fd, F_SETFL, flags) == -1)
+        return 0;
+    if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+        return 0;
+    return 1;
+}
+
 static int write_setup(XCBConnection *c, XCBAuthInfo *auth_info)
 {
     static const char pad[3];
@@ -147,7 +161,7 @@ XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info)
     c->fd = fd;
 
     if(!(
-        _xcb_set_fd_flags(fd) &&
+        set_fd_flags(fd) &&
         pthread_mutex_init(&c->iolock, 0) == 0 &&
         _xcb_in_init(&c->in) &&
         _xcb_out_init(&c->out) &&
index b7f5ffa..3d6006c 100644 (file)
@@ -28,7 +28,6 @@
 #include <assert.h>
 #include <sys/select.h>
 #include <sys/socket.h>
-#include <sys/fcntl.h>
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <netdb.h>
@@ -197,22 +196,3 @@ int XCBSync(XCBConnection *c, XCBGenericError **e)
     free(reply);
     return reply != 0;
 }
-
-/* The functions beyond this point still use only public interfaces,
- * but are not themselves part of the public interface. So their
- * prototypes are in xcbint.h. */
-
-#include "xcbint.h"
-
-int _xcb_set_fd_flags(const int fd)
-{
-    long flags = fcntl(fd, F_GETFL, 0);
-    if(flags == -1)
-        return 0;
-    flags |= O_NONBLOCK;
-    if(fcntl(fd, F_SETFL, flags) == -1)
-        return 0;
-    if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
-        return 0;
-    return 1;
-}
index ae36ac5..34b7197 100644 (file)
@@ -37,6 +37,8 @@ enum workarounds {
     WORKAROUND_GLX_GET_FB_CONFIGS_BUG
 };
 
+#define XCB_PAD(i) (-(i) & 3)
+
 /* xcb_list.c */
 
 typedef struct _xcb_list _xcb_list;
@@ -68,13 +70,6 @@ void *_xcb_map_get(_xcb_map *q, unsigned int key);
 void *_xcb_map_remove(_xcb_map *q, unsigned int key);
 
 
-/* xcb_util.c */
-
-#define XCB_PAD(i) (-(i) & 3)
-
-int _xcb_set_fd_flags(const int fd);
-
-
 /* xcb_out.c */
 
 typedef struct _xcb_out {