ithewei 5 年之前
父节点
当前提交
039d0b714e
共有 4 个文件被更改,包括 12 次插入20 次删除
  1. 2 6
      base/hbase.h
  2. 4 0
      base/hmutex.h
  3. 3 7
      base/htime.h
  4. 3 7
      base/hversion.h

+ 2 - 6
base/hbase.h

@@ -3,9 +3,7 @@
 
 #include "hdef.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_EXTERN_C
 
 //---------------------safe alloc/free---------------------------
 extern unsigned int g_alloc_cnt;
@@ -71,8 +69,6 @@ char* safe_strncat(char* dest, const char* src, size_t n);
 // 1 y on yes true enable
 bool getboolean(const char* str);
 
-#ifdef __cplusplus
-} // extern "C"
-#endif
+END_EXTERN_C
 
 #endif // HV_BASE_H_

+ 4 - 0
base/hmutex.h

@@ -4,6 +4,8 @@
 #include "hplatform.h"
 #include "htime.h"
 
+BEGIN_EXTERN_C
+
 #ifdef _MSC_VER
 #define hmutex_t                CRITICAL_SECTION
 #define hmutex_init             InitializeCriticalSection
@@ -186,6 +188,8 @@ static inline int hsem_wait_for(hsem_t* sem, unsigned int ms) {
 
 #endif
 
+END_EXTERN_C
+
 #ifdef __cplusplus
 #include <mutex>
 #include <condition_variable>

+ 3 - 7
base/htime.h

@@ -1,13 +1,11 @@
 #ifndef HV_TIME_H_
 #define HV_TIME_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "hplatform.h"
 #include "hdef.h"
 
+BEGIN_EXTERN_C
+
 #define SECONDS_PER_HOUR    3600
 #define SECONDS_PER_DAY     86400   // 24*3600
 #define SECONDS_PER_WEEK    604800  // 7*24*3600
@@ -112,8 +110,6 @@ const char* weekday_itoa(int weekday);
 
 datetime_t hv_compile_datetime();
 
-#ifdef __cplusplus
-} // extern "C"
-#endif
+END_EXTERN_C
 
 #endif // HV_TIME_H_

+ 3 - 7
base/hversion.h

@@ -1,12 +1,10 @@
 #ifndef HV_VERSION_H_
 #define HV_VERSION_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "hdef.h"
 
+BEGIN_EXTERN_C
+
 #define HV_VERSION_MAJOR    1
 #define HV_VERSION_MINOR    20
 #define HV_VERSION_PATCH    3
@@ -30,8 +28,6 @@ int version_atoi(const char* str);
 // 0x01020304 => 1.2.3.4
 void version_itoa(int hex, char* str);
 
-#ifdef __cplusplus
-} // extern "C"
-#endif
+END_EXTERN_C
 
 #endif // HV_VERSION_H_