]> git.notmuchmail.org Git - notmuch/commitdiff
util: make remaining headers includable from C++
authorDavid Bremner <david@tethera.net>
Sat, 2 Mar 2019 20:26:06 +0000 (16:26 -0400)
committerDavid Bremner <david@tethera.net>
Tue, 12 Mar 2019 01:26:50 +0000 (22:26 -0300)
libnotmuch_util.a is supposed to be usable from the library and the
CLI, but much the library is compiled as C++. Add in appropriate
wrapping to prevent symbol mangling. These wrappers already existed in
string-util.h; it seems better to be consistent.

util/crypto.h
util/error_util.h
util/gmime-extra.h
util/hex-escape.h
util/talloc-extra.h
util/xutil.h
util/zlib-extra.h

index c384601c11d35772a727c55996f4c3180076481e..1a90f0e00321fc73d1e93d8808ae602222b5048e 100644 (file)
@@ -5,6 +5,10 @@
 #include "gmime-extra.h"
 #include "notmuch.h"
 
 #include "gmime-extra.h"
 #include "notmuch.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _notmuch_crypto {
     bool verify;
     notmuch_decryption_policy_t decrypt;
 typedef struct _notmuch_crypto {
     bool verify;
     notmuch_decryption_policy_t decrypt;
@@ -34,4 +38,7 @@ _notmuch_crypto_get_gmime_ctx_for_protocol (_notmuch_crypto_t *crypto,
 void
 _notmuch_crypto_cleanup (_notmuch_crypto_t *crypto);
 
 void
 _notmuch_crypto_cleanup (_notmuch_crypto_t *crypto);
 
+#ifdef __cplusplus
+}
+#endif
 #endif
 #endif
index 4bb338a2abeacd1253c1287c39f8d6769e1c5405..aa3b77c43fd92d95ac55babf345b977861644333 100644 (file)
 
 #include "function-attributes.h"
 
 
 #include "function-attributes.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* There's no point in continuing when we've detected that we've done
  * something wrong internally (as opposed to the user passing in a
  * bogus value).
 /* There's no point in continuing when we've detected that we've done
  * something wrong internally (as opposed to the user passing in a
  * bogus value).
@@ -44,4 +48,7 @@ _internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2) NORETURN_ATTRI
     _internal_error (format " (%s).\n",                        \
                     ##__VA_ARGS__, __location__)
 
     _internal_error (format " (%s).\n",                        \
                     ##__VA_ARGS__, __location__)
 
+#ifdef __cplusplus
+}
+#endif
 #endif
 #endif
index ca822b8cf53b4e0b1b0509b3dcb5d4d92d46ca54..5d8c52f783a7233f2d41fea529fc60574134c31b 100644 (file)
@@ -1,11 +1,13 @@
 #ifndef _GMIME_EXTRA_H
 #define _GMIME_EXTRA_H
 #include <gmime/gmime.h>
 #ifndef _GMIME_EXTRA_H
 #define _GMIME_EXTRA_H
 #include <gmime/gmime.h>
-
-GMimeStream *g_mime_stream_stdout_new(void);
-
 #include <talloc.h>
 
 #include <talloc.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GMimeStream *g_mime_stream_stdout_new(void);
 
 #if (GMIME_MAJOR_VERSION < 3)
 
 
 #if (GMIME_MAJOR_VERSION < 3)
 
@@ -100,4 +102,8 @@ gint64 g_mime_utils_header_decode_date_unix (const char *date);
  */
 const char * g_mime_certificate_get_valid_userid (GMimeCertificate *cert);
 
  */
 const char * g_mime_certificate_get_valid_userid (GMimeCertificate *cert);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 #endif
index 5182042e07b3dcde81c3cc594528dc2ae4754f23..50d946eda4463b4bbf539625ed9336697ee41312 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef _HEX_ESCAPE_H
 #define _HEX_ESCAPE_H
 
 #ifndef _HEX_ESCAPE_H
 #define _HEX_ESCAPE_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum hex_status {
     HEX_SUCCESS = 0,
     HEX_SYNTAX_ERROR,
 typedef enum hex_status {
     HEX_SUCCESS = 0,
     HEX_SYNTAX_ERROR,
@@ -38,4 +42,9 @@ hex_decode (void *talloc_ctx, const char *in, char **out,
  */
 hex_status_t
 hex_decode_inplace (char *s);
  */
 hex_status_t
 hex_decode_inplace (char *s);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 #endif
index eac5dc0534716a73c3d3e98d8158783f45cb5144..e2e617342a92544191ee9aca06d157494e76b96d 100644 (file)
@@ -3,6 +3,10 @@
 
 #include <talloc.h>
 
 
 #include <talloc.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Like talloc_strndup, but take an extra parameter for the internal talloc
  * name (for debugging) */
 
 /* Like talloc_strndup, but take an extra parameter for the internal talloc
  * name (for debugging) */
 
@@ -15,4 +19,8 @@ talloc_strndup_named_const (void *ctx, const char *str,
 
 #define talloc_strndup_debug(ctx, str, len) talloc_strndup_named_const (ctx, str, len, __location__)
 
 
 #define talloc_strndup_debug(ctx, str, len) talloc_strndup_named_const (ctx, str, len, __location__)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 #endif
index 4829f33c9ec8c73875d3f378382ad6c55625f6f8..e27070009b6839f51653f946bdc0971653915c68 100644 (file)
 #include <sys/types.h>
 #include <regex.h>
 
 #include <sys/types.h>
 #include <regex.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* xutil.c */
 void *
 xcalloc (size_t nmemb, size_t size);
 /* xutil.c */
 void *
 xcalloc (size_t nmemb, size_t size);
@@ -49,4 +53,8 @@ int
 xregexec (const regex_t *preg, const char *string,
          size_t nmatch, regmatch_t pmatch[], int eflags);
 
 xregexec (const regex_t *preg, const char *string,
          size_t nmatch, regmatch_t pmatch[], int eflags);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 #endif
index aedfd48fcb06b73e52ff3514e9fb152dec1b831e..209fa9989437d8cf77bf9ac60c739cb9fcb47a8f 100644 (file)
@@ -4,6 +4,10 @@
 #include "util.h"
 #include <zlib.h>
 
 #include "util.h"
 #include <zlib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Like getline, but read from a gzFile. Allocation is with talloc.
  * Returns:
  *
 /* Like getline, but read from a gzFile. Allocation is with talloc.
  * Returns:
  *
@@ -22,4 +26,9 @@ gz_getline (void *ctx, char **lineptr, ssize_t *bytes_read, gzFile stream);
 
 const char *
 gz_error_string (util_status_t status, gzFile stream);
 
 const char *
 gz_error_string (util_status_t status, gzFile stream);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 #endif