186 lines
4.0 KiB
Diff
186 lines
4.0 KiB
Diff
|
|
From e434d404d0db719440cc911729d225417a49b4f4 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Guy Harris <gharris@sonic.net>
|
||
|
|
Date: Tue, 16 Mar 2021 04:33:00 -0700
|
||
|
|
Subject: [PATCH] Move even more headers outside extern "C".
|
||
|
|
|
||
|
|
If a header declares a function, or anything else requiring the extern
|
||
|
|
"C" decoration, have it wrap the declaration itself; don't rely on the
|
||
|
|
header itself being included inside extern "C".
|
||
|
|
---
|
||
|
|
wsutil/cpu_info.h | 2 --
|
||
|
|
wsutil/file_util.h | 12 ++++++------
|
||
|
|
wsutil/plugins.h | 7 +++----
|
||
|
|
wsutil/processes.h | 19 ++++++++++++++-----
|
||
|
|
wsutil/time_util.h | 4 ++--
|
||
|
|
wsutil/unicode-utils.h | 10 ++++++----
|
||
|
|
6 files changed, 31 insertions(+), 23 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/wsutil/cpu_info.h b/wsutil/cpu_info.h
|
||
|
|
index 3579576..145b1be 100644
|
||
|
|
--- a/wsutil/cpu_info.h
|
||
|
|
+++ b/wsutil/cpu_info.h
|
||
|
|
@@ -17,8 +17,6 @@
|
||
|
|
extern "C" {
|
||
|
|
#endif /* __cplusplus */
|
||
|
|
|
||
|
|
-#include "ws_symbol_export.h"
|
||
|
|
-
|
||
|
|
WS_DLL_PUBLIC void get_cpu_info(GString *str);
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
diff --git a/wsutil/file_util.h b/wsutil/file_util.h
|
||
|
|
index 5d8f41a..1e8b726 100644
|
||
|
|
--- a/wsutil/file_util.h
|
||
|
|
+++ b/wsutil/file_util.h
|
||
|
|
@@ -15,10 +15,6 @@
|
||
|
|
|
||
|
|
#include "ws_symbol_export.h"
|
||
|
|
|
||
|
|
-#ifdef __cplusplus
|
||
|
|
-extern "C" {
|
||
|
|
-#endif /* __cplusplus */
|
||
|
|
-
|
||
|
|
#ifdef _WIN32
|
||
|
|
#include <io.h> /* for _read(), _write(), etc. */
|
||
|
|
#include <gmodule.h>
|
||
|
|
@@ -36,6 +32,12 @@ extern "C" {
|
||
|
|
#include <sys/stat.h> /* for stat() and struct stat */
|
||
|
|
#endif
|
||
|
|
|
||
|
|
+#include <stdio.h>
|
||
|
|
+
|
||
|
|
+#ifdef __cplusplus
|
||
|
|
+extern "C" {
|
||
|
|
+#endif /* __cplusplus */
|
||
|
|
+
|
||
|
|
/*
|
||
|
|
* Visual C++ on Win32 systems doesn't define these. (Old UNIX systems don't
|
||
|
|
* define them either.)
|
||
|
|
@@ -55,8 +57,6 @@ extern "C" {
|
||
|
|
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||
|
|
#endif
|
||
|
|
|
||
|
|
-#include <stdio.h>
|
||
|
|
-
|
||
|
|
#ifdef _WIN32
|
||
|
|
|
||
|
|
/*
|
||
|
|
diff --git a/wsutil/plugins.h b/wsutil/plugins.h
|
||
|
|
index 1a76c78..5ab8d0a 100644
|
||
|
|
--- a/wsutil/plugins.h
|
||
|
|
+++ b/wsutil/plugins.h
|
||
|
|
@@ -13,14 +13,13 @@
|
||
|
|
|
||
|
|
#include <glib.h>
|
||
|
|
|
||
|
|
+#include <gmodule.h>
|
||
|
|
+#include "ws_symbol_export.h"
|
||
|
|
+
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
#endif /* __cplusplus */
|
||
|
|
|
||
|
|
-#include <gmodule.h>
|
||
|
|
-
|
||
|
|
-#include "ws_symbol_export.h"
|
||
|
|
-
|
||
|
|
typedef void (*plugin_register_func)(void);
|
||
|
|
|
||
|
|
typedef void plugins_t;
|
||
|
|
diff --git a/wsutil/processes.h b/wsutil/processes.h
|
||
|
|
index 03c76e8..61655c8 100644
|
||
|
|
--- a/wsutil/processes.h
|
||
|
|
+++ b/wsutil/processes.h
|
||
|
|
@@ -13,6 +13,20 @@
|
||
|
|
|
||
|
|
#include "ws_symbol_export.h"
|
||
|
|
|
||
|
|
+#ifdef _WIN32
|
||
|
|
+/*
|
||
|
|
+ * On Windows, a process ID is a HANDLE.
|
||
|
|
+ * Include <windows.h> to make sure HANDLE is defined.
|
||
|
|
+ */
|
||
|
|
+#include <windows.h>
|
||
|
|
+#else
|
||
|
|
+/*
|
||
|
|
+ * On UN*X, a process ID is a pid_t.
|
||
|
|
+ * Include <sys/types.h> to make sure pid_t is defined.
|
||
|
|
+ */
|
||
|
|
+#include <sys/types.h>
|
||
|
|
+#endif
|
||
|
|
+
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
#endif /* __cplusplus */
|
||
|
|
@@ -20,9 +34,7 @@ extern "C" {
|
||
|
|
#ifdef _WIN32
|
||
|
|
/*
|
||
|
|
* On Windows, a process ID is a HANDLE.
|
||
|
|
- * Include <windows.h> to make sure HANDLE is defined.
|
||
|
|
*/
|
||
|
|
-#include <windows.h>
|
||
|
|
|
||
|
|
typedef HANDLE ws_process_id;
|
||
|
|
|
||
|
|
@@ -30,10 +42,7 @@ typedef HANDLE ws_process_id;
|
||
|
|
#else
|
||
|
|
/*
|
||
|
|
* On UN*X, a process ID is a pid_t.
|
||
|
|
- * Include <sys/types.h> to make sure pid_t is defined.
|
||
|
|
*/
|
||
|
|
-#include <sys/types.h>
|
||
|
|
-
|
||
|
|
typedef pid_t ws_process_id;
|
||
|
|
|
||
|
|
#define WS_INVALID_PID -1
|
||
|
|
diff --git a/wsutil/time_util.h b/wsutil/time_util.h
|
||
|
|
index 1cd430d..045ab6a 100644
|
||
|
|
--- a/wsutil/time_util.h
|
||
|
|
+++ b/wsutil/time_util.h
|
||
|
|
@@ -12,12 +12,12 @@
|
||
|
|
|
||
|
|
#include "ws_symbol_export.h"
|
||
|
|
|
||
|
|
+#include <time.h>
|
||
|
|
+
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
#endif /* __cplusplus */
|
||
|
|
|
||
|
|
-#include <time.h>
|
||
|
|
-
|
||
|
|
WS_DLL_PUBLIC
|
||
|
|
time_t mktime_utc(struct tm *tm);
|
||
|
|
|
||
|
|
diff --git a/wsutil/unicode-utils.h b/wsutil/unicode-utils.h
|
||
|
|
index 8bb06ee..b7ab394 100644
|
||
|
|
--- a/wsutil/unicode-utils.h
|
||
|
|
+++ b/wsutil/unicode-utils.h
|
||
|
|
@@ -15,6 +15,12 @@
|
||
|
|
|
||
|
|
#include <glib.h>
|
||
|
|
|
||
|
|
+#ifdef _WIN32
|
||
|
|
+#include <windows.h>
|
||
|
|
+#include <tchar.h>
|
||
|
|
+#include <wchar.h>
|
||
|
|
+#endif
|
||
|
|
+
|
||
|
|
/**
|
||
|
|
* @file
|
||
|
|
* Unicode convenience routines.
|
||
|
|
@@ -29,10 +35,6 @@ int ws_utf8_char_len(guint8 ch);
|
||
|
|
|
||
|
|
#ifdef _WIN32
|
||
|
|
|
||
|
|
-#include <windows.h>
|
||
|
|
-#include <tchar.h>
|
||
|
|
-#include <wchar.h>
|
||
|
|
-
|
||
|
|
/** Given a UTF-8 string, convert it to UTF-16. This is meant to be used
|
||
|
|
* to convert between GTK+ 2.x (UTF-8) to Windows (UTF-16).
|
||
|
|
*
|
||
|
|
--
|
||
|
|
GitLab
|
||
|
|
|