[gjs/master.windows: 13/18] gjs-util.c: Fix building gjs_open_bytes() on Windows



commit a76011f9c06bc0f8003a28825d79db85fefa1f39
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Feb 22 15:38:20 2019 +0800

    gjs-util.c: Fix building gjs_open_bytes() on Windows
    
    Show a message that the function is currently only supported on UNIX,
    due to the use of g_unix_open_pipe().

 libgjs-private/gjs-util.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/libgjs-private/gjs-util.c b/libgjs-private/gjs-util.c
index ea691f56..c110cc93 100644
--- a/libgjs-private/gjs-util.c
+++ b/libgjs-private/gjs-util.c
@@ -27,12 +27,15 @@
 #include <string.h>
 
 #include <gio/gio.h>
-#include <glib-unix.h>
 #include <glib.h>
 #include <glib/gi18n.h>
 
 #include "gjs-util.h"
 
+#ifdef G_OS_UNIX
+#    include <glib-unix.h>
+#endif
+
 char *
 gjs_format_int_alternative_output(int n)
 {
@@ -164,6 +167,7 @@ int gjs_open_bytes(GBytes* bytes, GError** error) {
     g_return_val_if_fail(bytes, -1);
     g_return_val_if_fail(error == NULL || *error == NULL, -1);
 
+#ifdef G_OS_UNIX
     if (!g_unix_open_pipe(pipefd, FD_CLOEXEC, error))
         return -1;
 
@@ -186,4 +190,7 @@ int gjs_open_bytes(GBytes* bytes, GError** error) {
     }
 
     return pipefd[0];
+#else
+    g_error("%s is currently supported on UNIX only", __func__);
+#endif
 }


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