]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
use macro for EXTERN "C" begin and end lines in header files to clean up the headers...
authorMichael Jerris <mike@jerris.com>
Fri, 28 Apr 2006 20:04:08 +0000 (20:04 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 28 Apr 2006 20:04:08 +0000 (20:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1291 d0543943-73ff-0310-b7d9-9358b9ac24b2

22 files changed:
src/include/switch.h
src/include/switch_apr.h
src/include/switch_buffer.h
src/include/switch_caller.h
src/include/switch_channel.h
src/include/switch_config.h
src/include/switch_console.h
src/include/switch_core.h
src/include/switch_event.h
src/include/switch_frame.h
src/include/switch_ivr.h
src/include/switch_loadable_module.h
src/include/switch_log.h
src/include/switch_module_interfaces.h
src/include/switch_platform.h
src/include/switch_resample.h
src/include/switch_rtp.h
src/include/switch_sqlite.h
src/include/switch_stun.h
src/include/switch_types.h
src/include/switch_utils.h
src/switch_ivr.c

index 96f36a15b709604edad6b35b18d56a4073d1f843..67a04db7ecbed9e409155c6c8e0f3fbfe624fb62 100644 (file)
 #ifndef SWITCH_H
 #define SWITCH_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifdef __cplusplus\r
+#define BEGIN_EXTERN_C       extern "C" {\r
+#define END_EXTERN_C         }\r
+#else\r
+#define BEGIN_EXTERN_C\r
+#define END_EXTERN_C\r
+#endif\r
+
+BEGIN_EXTERN_C
 
 //Need to include this before any other includes (MSVC Bug)
 #include <switch_platform.h>
@@ -69,9 +75,8 @@ extern "C" {
 #include <switch_stun.h>
 #include <switch_stun.h>
 #include <switch_log.h>
-#ifdef __cplusplus
-}
-#endif
+
+END_EXTERN_C
 
 /** \mainpage FreeSWITCH
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
index ffdf3a0bd54da6d5959211299a640babc4838257..29d9e38d786ca737af2d45b53bfaed2ce39cf63c 100644 (file)
 #ifndef SWITCH_APR_H
 #define SWITCH_APR_H
 
-#ifdef __cplusplus
-extern "C" {
-#ifdef __FORMATBUG
-}
-#endif
-#endif
+BEGIN_EXTERN_C
 
 #include <apr.h>
 #include <apr_network_io.h>
@@ -1435,8 +1430,6 @@ SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock,
 /** @} */
 /** @} */
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index ff05db1a6cdc0c9ffd03dd14e1584e5b90f29911..582fbc0f4096329b3c681d90fb39477794428969 100644 (file)
 #ifndef SWITCH_BUFFER_H
 #define SWITCH_BUFFER_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /**
  * @defgroup switch_buffer Buffer Routines
  * @ingroup core1
@@ -111,10 +109,6 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_toss(switch_buffer *buffer, switch_s
 SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer *buffer);
 /** @} */
 
-
-#ifdef __cplusplus
-}
-#endif
-
+END_EXTERN_C
 
 #endif
index 7b09ec64625dc8f45cc7dac3a095ccf623ce3f4c..c2aeac4e22624cb3c55c84bac315f6ecd038a9a0 100644 (file)
 #ifndef SWITCH_CALLER_H
 #define SWITCH_CALLER_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef _FORMATBUG
-}
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /*! \brief Call Specific Data
  */
 struct switch_caller_profile {
@@ -186,10 +181,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_
 
 SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event *event);
 
-
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 /** @} */
 
index 34c805c27c5119c629ab098681b6583f3e867601..ba6487b1d21eda944e263e6e7554d8e967ceadfc 100644 (file)
 #ifndef SWITCH_CHANNEL_H
 #define SWITCH_CHANNEL_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __FORMATBUG
-}
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 struct switch_channel_timetable {
        switch_time_t created;
        switch_time_t answered;
@@ -380,8 +375,6 @@ SWITCH_DECLARE(switch_status) switch_channel_set_raw_mode (switch_channel *chann
 SWITCH_DECLARE(switch_status) switch_channel_get_raw_mode (switch_channel *channel, int *freq, int *bits, int *channels, int *ms, int *kbps);
 /** @} */
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index f2ea148271b75f027f682057eed104132ec98b80..b645efa37435fb427b42730513b123891e806817 100644 (file)
 #ifndef SWITCH_CONFIG_H
 #define SWITCH_CONFIG_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /*! \brief A simple file handle representing an open configuration file **/
 struct switch_config {
        /*! FILE stream buffer to the opened file */
@@ -106,9 +104,8 @@ SWITCH_DECLARE(void) switch_config_close_file(switch_config *cfg);
 */
 SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char **val);
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
+
 /** @} */
 
 #endif
index 39e1eb651fb5831644acc4f3fd4a92a0dae1d54c..2440f5d7fe7a654f3a79a2d0417e3faf196fd032 100644 (file)
 #ifndef SWITCH_CONSOLE_H
 #define SWITCH_CONSOLE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /*!
   \brief A simple comand loop that reads input from the terminal
 */
@@ -55,8 +53,6 @@ SWITCH_DECLARE(void) switch_console_loop(void);
 */
 SWITCH_DECLARE(void) switch_console_printf(switch_text_channel channel, char *file, const char *func, int line, char *fmt, ...);
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index 9366e54d84461b33e95691f9b3bcc390aa22794d..a9fb053895cbd0eedc4631f4c3420b2c96b2e414 100644 (file)
 #ifndef SWITCH_CORE_H
 #define SWITCH_CORE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef _FORMATBUG
-}
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 #define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
 #define SWITCH_MAX_STREAMS 128
 
@@ -984,10 +979,6 @@ SWITCH_DECLARE(void) switch_core_set_globals(void);
   \}
 */
 
-
-#ifdef __cplusplus
-}
-#endif
-
+END_EXTERN_C
 
 #endif
index 604d4ee9ea89e301ffd8af002d80e3c06a0d1524..8abdddb2704f737204e2521a985c54c0525e0e12 100644 (file)
 #ifndef SWITCH_EVENT_H
 #define SWITCH_EVENT_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /*! \brief An event Header */
 struct switch_event_header {
        /*! the header name */
@@ -288,8 +286,6 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event **event);
 #define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, data)
 ///\}
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index a0b5b6e433d947fac94a63bf25007d3e7360ebe6..c8788b9a92795535de378371dc0344d109d28bd4 100644 (file)
 #ifndef SWITCH_FRAME_H
 #define SWITCH_FRAME_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /*! \brief An abstraction of a data frame */
 struct switch_frame {
        /*! a pointer to the codec information */
@@ -70,8 +68,6 @@ struct switch_frame {
        switch_frame_flag flags;
 };
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index a3e474b993a906481142e12ee3cf620d6fd8fd4f..43a63add056e47d4e79fd0a51d91747f0ff75cd5 100644 (file)
 #ifndef SWITCH_IVR_H
 #define SWITCH_IVR_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /**
  * @defgroup switch_ivr IVR Library
  * @ingroup core1
@@ -179,9 +177,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_session_transfer(switch_core_session *s
 
 /** @} */
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
 
index b63fe1e2fe342430ed711871c291d57dec0c0c8a..42e38e4993c740f09e4e222c827e2c77a08cdb70 100644 (file)
 #ifndef SWITCH_LOADABLE_MODULE_H
 #define SWITCH_LOADABLE_MODULE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /*!
   \defgroup mods Loadable Module Functions
   \ingroup core1
@@ -240,8 +238,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void);
 SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void);
 ///\}
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index 9aeb4870939f2010ea13012b33b9b0d7545919be..a5a3f76398edc89e33d0f2792cf9215a855a5d1c 100644 (file)
 #ifndef SWITCH_LOG_H
 #define SWITCH_LOG_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef _FORMATBUG
-}
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 ///\defgroup log Logger Routines
 ///\ingroup core1
 ///\{
@@ -122,8 +117,6 @@ SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level level);
 SWITCH_DECLARE(switch_log_level) switch_log_str2level(const char *str);
 
 ///\}
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index 74a766d63540aa41df8bd3cae56b5bbd505dd353..e3ab2b911d7f48773e93e7c89200b04aa78c5204 100644 (file)
 #ifndef SWITCH_MODULE_INTERFACES_H
 #define SWITCH_MODULE_INTERFACES_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
+BEGIN_EXTERN_C
+
 /*! \brief A table of functions to execute at various states 
 */
 struct switch_state_handler_table {
@@ -513,8 +511,6 @@ struct switch_api_interface {
        const struct switch_api_interface *next;
 };
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index 3b157ee2728efe6a94a6d48e3ec7217b84dfa253..db427fa11b25db30f075699a472f69e94a42235b 100644 (file)
@@ -34,9 +34,7 @@
 #ifndef SWITCH_PLATFORM_H
 #define SWITCH_PLATFORM_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_EXTERN_C
 
 #ifdef __ICC
 #pragma warning (disable:810 869 981 279 1469 188)
@@ -153,8 +151,6 @@ typedef unsigned long       in_addr_t;
 #define DoxyDefine(x)
 #endif
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index a385d5ed20e296b6d887a3f06164f1559f3a0803..d2737b8270c3aa03d13655e166c43b0570d3cd44 100644 (file)
 #ifndef SWITCH_RESAMPLE_H
 #define SWITCH_RESAMPLE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include <stdlib.h>
 #include <switch.h>
+BEGIN_EXTERN_C
+#include <stdlib.h>
 
 /*!
   \defgroup resamp Audio Resample Functions
@@ -158,10 +156,7 @@ SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len);
 
 ///\}
 
-#ifdef __cplusplus
-}
-#endif
-
+END_EXTERN_C
 
 #endif
 
index 350a704310e633f544f98746e7dc4cc7c4e2b114..1a336f14f3c65b8cebcb8acf0b20efb693095253 100644 (file)
 #ifndef SWITCH_RTP_H
 #define SWITCH_RTP_H
 
-#ifdef __cplusplus
-extern "C" {
-#ifdef _FORMATBUG
-}
-#endif
-#endif
+BEGIN_EXTERN_C
 
 #define SWITCH_RTP_MAX_BUF_LEN 16384
 
@@ -328,8 +323,6 @@ SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp *rtp_session);
   \}
 */
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index cc893dce19a127d0d83567c24b312dee9eed55e8..296eba5e231f2cb9db999a3e0cf42c197f4524ad 100644 (file)
@@ -35,9 +35,7 @@
 #ifndef SWITCH_SQLITE_H
 #define SWITCH_SQLITE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_EXTERN_C
 
 #include <sqlite3.h>
 
@@ -1806,10 +1804,6 @@ DoxyDefine(void switch_core_db_free(char *z);)
 /** @} */
 /** @} */
 
-
-
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index 46b768d9a3708a19efaee028d7e4291d16c19b7d..c9af3bc6d75497b4a7bbe2b32c333a76e29e4f6c 100644 (file)
@@ -36,6 +36,9 @@
 */
 #ifndef _SWITCH_STUN_PARSER_H
 #define _SWITCH_STUN_PARSER_H
+
+BEGIN_EXTERN_C
+
 #define SWITCH_STUN_DEFAULT_PORT 3478
 #define SWITCH_STUN_PACKET_MIN_LEN 20
 
@@ -236,4 +239,7 @@ SWITCH_DECLARE(switch_status) switch_stun_lookup (char **ip,
 */
 #define switch_stun_packet_length(packet) ntohs(packet->header.length) + sizeof(switch_stun_packet_header_t)
 ///\}
+
+END_EXTERN_C
+
 #endif
index b6c36cd74ccd30f0cb7cd7528211f9b98fc864a5..b0726fb69752f7331b23c459f54ac8afd22b3ba5 100644 (file)
 #ifndef SWITCH_TYPES_H
 #define SWITCH_TYPES_H
 
-#ifdef __cplusplus
-extern "C" {
-#ifdef _FORMATBUG
-}
-#endif
-#endif
-
 #include <switch.h>
-#include <switch_platform.h>
+
+BEGIN_EXTERN_C
 
 #ifdef WIN32
 #define SWITCH_PATH_SEPARATOR "\\"
@@ -681,9 +675,6 @@ struct switch_channel;
 /*! \brief A core session representing a call and all of it's resources */
 struct switch_core_session;
 
-
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index 26629d93ac8847722f73c6dc1890c6bb3cc597e7..681ba1db8567bc84b175d6ce4883010c7c7d4c94 100644 (file)
 #ifndef SWITCH_UTILS_H
 #define SWITCH_UTILS_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <switch.h>
 
-
+BEGIN_EXTERN_C
 
 #ifndef snprintf
 #define snprintf apr_snprintf
@@ -182,8 +178,6 @@ SWITCH_DECLARE(switch_status) switch_string_match(const char *string, size_t str
 
 #define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK
 
-#ifdef __cplusplus
-}
-#endif
+END_EXTERN_C
 
 #endif
index 90d65c43078acc6dd32262bc28e56c8a84c2fc61..97051c1f6bfa797be7415f47a581c483df49b5d5 100644 (file)
@@ -454,11 +454,11 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session,
                        }
                } else { /* time off the channel (if you must) */
                        switch_frame *read_frame;
-
+                       switch_status status; 
                        while (switch_channel_test_flag(channel, CF_HOLD)) {
                                switch_yield(10000);
                        }
-                       switch_status status = switch_core_session_read_frame(session, &read_frame, -1, 0);
+                       status = switch_core_session_read_frame(session, &read_frame, -1, 0);
                        if (!SWITCH_READ_ACCEPTABLE(status)) {
                                break;
                        }