[gjs/msvc.partial.fix: 3/4] console.cpp: Make code build on Windows
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/msvc.partial.fix: 3/4] console.cpp: Make code build on Windows
- Date: Thu, 11 Mar 2021 19:33:56 +0000 (UTC)
commit c810badd7ff723dd3d7c0cb43434bfe579dfe56b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Mar 8 15:49:23 2021 +0800
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.
modules/console.cpp | 5 +++++
1 file changed, 5 insertions(+)
---
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]