From 923c432977db208892129fcd889f646111760e41 Mon Sep 17 00:00:00 2001
From: Deomid Ryabkov <rojer@cesanta.com>
Date: Mon, 18 Apr 2016 16:04:45 +0100
Subject: [PATCH] Add C++ externs to common headers

Closes cesanta/mongoose#649

PUBLISHED_FROM=7d331576ba8f75a7a4ebf833e056dc22f6eda811
---
 mongoose.c |  2 ++
 mongoose.h | 30 ++++++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/mongoose.c b/mongoose.c
index 13f907ee4..b33b42c56 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -531,6 +531,8 @@ typedef int cs_dirent_dummy;
  * All rights reserved
  */
 
+/* Amalgamated: #include "common/cs_time.h" */
+
 #ifndef _WIN32
 #include <stddef.h>
 #if !defined(CS_PLATFORM) || \
diff --git a/mongoose.h b/mongoose.h
index 38d5425c4..9626e4d8d 100644
--- a/mongoose.h
+++ b/mongoose.h
@@ -735,6 +735,14 @@ int sl_fs_init();
 #ifndef CS_COMMON_CS_DBG_H_
 #define CS_COMMON_CS_DBG_H_
 
+#ifndef CS_DISABLE_STDIO
+#include <stdio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 enum cs_log_level {
   LL_NONE = -1,
   LL_ERROR = 0,
@@ -751,8 +759,6 @@ void cs_log_set_level(enum cs_log_level level);
 
 #ifndef CS_DISABLE_STDIO
 
-#include <stdio.h>
-
 void cs_log_set_file(FILE *file);
 
 extern enum cs_log_level cs_log_level;
@@ -786,6 +792,10 @@ void cs_log_printf(const char *fmt, ...);
 
 #endif
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* CS_COMMON_CS_DBG_H_ */
 /*
  * Copyright (c) 2014-2016 Cesanta Software Limited
@@ -795,9 +805,17 @@ void cs_log_printf(const char *fmt, ...);
 #ifndef CS_COMMON_CS_TIME_H_
 #define CS_COMMON_CS_TIME_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 /* Sub-second granularity time(). */
 double cs_time();
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* CS_COMMON_CS_TIME_H_ */
 /*
  * Copyright (c) 2015 Cesanta Software Limited
@@ -1102,6 +1120,10 @@ int json_emit_va(char *buf, int buf_len, const char *fmt, va_list);
 #ifndef CS_COMMON_CS_DIRENT_H_
 #define CS_COMMON_CS_DIRENT_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 #ifdef CS_ENABLE_SPIFFS
 
 #include <spiffs.h>
@@ -1125,6 +1147,10 @@ int closedir(DIR *dir);
 struct dirent *readdir(DIR *dir);
 #endif
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* CS_COMMON_CS_DIRENT_H_ */
 /*
  * Copyright (c) 2014 Cesanta Software Limited
-- 
GitLab