summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2021-03-08 15:49:23 +0800
committerPhilip Chimento <philip.chimento@gmail.com>2021-03-11 11:32:15 -0800
commitc810badd7ff723dd3d7c0cb43434bfe579dfe56b (patch)
tree28d3fad6e535cd0ee517dba1622b039b4d51219d
parent24a7c3e28e7e47c5f9b154cda8b4d886e172eec4 (diff)
downloadgjs-c810badd7ff723dd3d7c0cb43434bfe579dfe56b.tar.gz
console.cpp: Make code build on Windows
The new code that tries to detect Ctrl+C almost built fine on Windows, except that Windows does not have sigjmp_buf, siglongjmp() and sigsetjmp(). For Windows we have near-equivilents jmp_buf, longjmp() and setjmp(), so use them. The mask parameter for sigsetgmp() does not apply on Windows, so just discard it when calling setjmp() in its place.
-rw-r--r--modules/console.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/console.cpp b/modules/console.cpp
index 6a48b5a9..2ef511aa 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -8,6 +8,11 @@
#ifdef HAVE_SIGNAL_H
# include <setjmp.h>
# include <signal.h>
+# ifdef _WIN32
+# define sigjmp_buf jmp_buf
+# define siglongjmp(e, v) longjmp (e, v)
+# define sigsetjmp(v, m) setjmp (v)
+# endif
#endif
#ifdef HAVE_READLINE_READLINE_H