浏览代码

Move pipe compat wrapper in compat.c

Hugo Beauzée-Luyssen 9 年之前
父节点
当前提交
dc1877bf6d
共有 3 个文件被更改,包括 16 次插入9 次删除
  1. 12 0
      compat/compat.c
  2. 4 0
      compat/compat.h
  3. 0 9
      src/netbios_ns.c

+ 12 - 0
compat/compat.c

@@ -1,3 +1,5 @@
+#include "config.h"
+
 /* This file is just a placeholder so the library isn't empty */
 
 /* This function does strictly nothing. It's just here to avoid
@@ -6,3 +8,13 @@ int not_empty()
 {
     return 42;
 }
+
+#if !defined(HAVE_PIPE) && defined(HAVE__PIPE)
+
+#include <fcntl.h>
+
+static inline int pipe(int fds[2])
+{
+    return _pipe(fds, 32768, O_NOINHERIT | O_BINARY);
+}
+#endif

+ 4 - 0
compat/compat.h

@@ -62,3 +62,7 @@ char *strndup(const char *str, size_t n);
 # include "queue.h"
 #endif
 
+#if !defined(HAVE_PIPE) && defined(HAVE__PIPE)
+#define HAVE_PIPE
+int pipe(int fds[2]);
+#endif

+ 0 - 9
src/netbios_ns.c

@@ -155,15 +155,6 @@ error:
     return 0;
 }
 
-#ifndef HAVE_PIPE
-#ifdef HAVE__PIPE
-static inline int pipe(int fds[2])
-{
-    return _pipe(fds, 32768, O_NOINHERIT | O_BINARY);
-}
-#define HAVE_PIPE
-#endif
-#endif
 
 static int    ns_open_abort_pipe(netbios_ns *ns)
 {