[asterisk-commits] Remove unneeded uses of optional api providers. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 4 04:03:50 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: Remove unneeded uses of optional_api providers.
......................................................................


Remove unneeded uses of optional_api providers.

A few cases exist where headers of optional_api provders are included but
not needed.  This causes unneeded calls to ast_optional_api_use.

* Don't include optional_api.h from sip_api.h.
* Move 'struct ast_channel_monitor' to channel.h.
* Don't include monitor.h from chan_sip.c, channel.c or features.c.

The move of struct ast_channel_monitor is needed since channel.c depends on
it.  This has no effect on users of monitor.h since channel.h is included
from monitor.h.

ASTERISK-25051 #close
Reported by: Corey Farrell

Change-Id: I53ea65a9fc9693c89f8bcfd6120649bfcfbc3478
---
M channels/chan_sip.c
M include/asterisk/channel.h
M include/asterisk/monitor.h
M include/asterisk/sip_api.h
M main/channel.c
M main/features.c
6 files changed, 20 insertions(+), 24 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 3f9d9e7..1307a93 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -254,7 +254,6 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/dnsmgr.h"
 #include "asterisk/devicestate.h"
-#include "asterisk/monitor.h"
 #include "asterisk/netsock2.h"
 #include "asterisk/localtime.h"
 #include "asterisk/abstract_jb.h"
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index a120998..fe669ef 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -3905,6 +3905,26 @@
  */
 const char *ast_channel_amaflags2string(enum ama_flags flags);
 
+enum AST_MONITORING_STATE {
+	AST_MONITOR_RUNNING,
+	AST_MONITOR_PAUSED
+};
+
+/*! Responsible for channel monitoring data */
+struct ast_channel_monitor {
+	struct ast_filestream *read_stream;
+	struct ast_filestream *write_stream;
+	char read_filename[FILENAME_MAX];
+	char write_filename[FILENAME_MAX];
+	char filename_base[FILENAME_MAX];
+	char beep_id[64];
+	int filename_changed;
+	char *format;
+	int joinfiles;
+	enum AST_MONITORING_STATE state;
+	int (*stop)(struct ast_channel *chan, int need_lock);
+};
+
 /* ACCESSOR FUNTIONS */
 /*! \brief Set the channel name */
 void ast_channel_name_set(struct ast_channel *chan, const char *name);
diff --git a/include/asterisk/monitor.h b/include/asterisk/monitor.h
index 6030221..377cb62 100644
--- a/include/asterisk/monitor.h
+++ b/include/asterisk/monitor.h
@@ -26,30 +26,10 @@
 #include "asterisk/channel.h"
 #include "asterisk/optional_api.h"
 
-enum AST_MONITORING_STATE {
-	AST_MONITOR_RUNNING,
-	AST_MONITOR_PAUSED
-};
-
 /* Streams recording control */
 #define X_REC_IN	1
 #define X_REC_OUT	2
 #define X_JOIN		4
-
-/*! Responsible for channel monitoring data */
-struct ast_channel_monitor {
-	struct ast_filestream *read_stream;
-	struct ast_filestream *write_stream;
-	char read_filename[FILENAME_MAX];
-	char write_filename[FILENAME_MAX];
-	char filename_base[FILENAME_MAX];
-	char beep_id[64];
-	int filename_changed;
-	char *format;
-	int joinfiles;
-	enum AST_MONITORING_STATE state;
-	int (*stop)(struct ast_channel *chan, int need_lock);
-};
 
 /* Start monitoring a channel */
 AST_OPTIONAL_API(int, ast_monitor_start,
diff --git a/include/asterisk/sip_api.h b/include/asterisk/sip_api.h
index 2b8a3f2..fddac16 100644
--- a/include/asterisk/sip_api.h
+++ b/include/asterisk/sip_api.h
@@ -23,7 +23,6 @@
 extern "C" {
 #endif
 
-#include "asterisk/optional_api.h"
 #include "asterisk/config.h"
 
 #define AST_SIP_API_VERSION 1
diff --git a/main/channel.c b/main/channel.c
index c56f3ab..fa03f65 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -53,7 +53,6 @@
 #include "asterisk/chanvars.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/indications.h"
-#include "asterisk/monitor.h"
 #include "asterisk/causes.h"
 #include "asterisk/callerid.h"
 #include "asterisk/utils.h"
diff --git a/main/features.c b/main/features.c
index 2f04386..1810b15 100644
--- a/main/features.c
+++ b/main/features.c
@@ -66,7 +66,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/adsi.h"
 #include "asterisk/devicestate.h"
-#include "asterisk/monitor.h"
 #include "asterisk/audiohook.h"
 #include "asterisk/global_datastores.h"
 #include "asterisk/astobj2.h"

-- 
To view, visit https://gerrit.asterisk.org/340
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I53ea65a9fc9693c89f8bcfd6120649bfcfbc3478
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list