Remove redundant module checks and references.

This removes references that are no longer needed due to automatic
references created by module dependencies.

In addition this removes most calls to ast_module_check as they were
checking modules which are listed as dependencies.

Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
This commit is contained in:
Corey Farrell
2017-12-29 03:57:17 -05:00
parent 7ce34f4e6a
commit 527cf5a570
103 changed files with 143 additions and 760 deletions

View File

@@ -82,13 +82,12 @@ AST_OPTIONAL_API(int, ast_agi_register,
*
* Unregisters an AGI command.
*
* \param mod Pointer to the module_info structure for the module that is unregistering the command
* \param cmd Pointer to the descriptor for the command
* \return 1 on success, 0 if the command was not already registered
*
*/
AST_OPTIONAL_API(int, ast_agi_unregister,
(struct ast_module *mod, agi_command *cmd),
(agi_command *cmd),
{ return AST_OPTIONAL_API_UNAVAILABLE; });
/*!
@@ -116,7 +115,6 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple,
* Unregisters a group of AGI commands, provided as an array of struct agi_command
* entries.
*
* \param mod Pointer to the module_info structure for the module that is unregistering the commands
* \param cmd Pointer to the first entry in the array of command descriptors
* \param len Length of the array (use the ARRAY_LEN macro to determine this easily)
* \return 0 on success, -1 on failure, AST_OPTIONAL_API_UNAVAILABLE if res_agi is not loaded
@@ -125,7 +123,7 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple,
* remaining commands in the array; it will not reregister the already-unregistered commands.
*/
AST_OPTIONAL_API(int, ast_agi_unregister_multiple,
(struct ast_module *mod, struct agi_command *cmd, unsigned int len),
(struct agi_command *cmd, unsigned int len),
{ return AST_OPTIONAL_API_UNAVAILABLE; });
/*!

View File

@@ -268,14 +268,4 @@ void ast_ari_response_created(struct ast_ari_response *response,
*/
void ast_ari_response_alloc_failed(struct ast_ari_response *response);
/*! \brief Determines whether the res_ari module is loaded */
#define CHECK_ARI_MODULE_LOADED() \
do { \
if (!ast_module_check("res_ari.so") \
|| !ast_ari_oom_json()) { \
return AST_MODULE_LOAD_DECLINE; \
} \
} while(0)
#endif /* _ASTERISK_ARI_H */

View File

@@ -36,22 +36,6 @@ extern "C"
/* ------------------------------------------------------------------- */
/*!
* \brief Increase the external MWI resource module reference count.
* \since 12.1.0
*
* \return Nothing
*/
void ast_mwi_external_ref(void);
/*!
* \brief Decrease the external MWI resource module reference count.
* \since 12.1.0
*
* \return Nothing
*/
void ast_mwi_external_unref(void);
struct ast_mwi_mailbox_object;
/*! \brief Convienience unref function for mailbox object. */

View File

@@ -19,14 +19,6 @@
#ifndef _RES_PJPROJECT_H
#define _RES_PJPROJECT_H
/*! \brief Determines whether the res_pjproject module is loaded */
#define CHECK_PJPROJECT_MODULE_LOADED() \
do { \
if (!ast_module_check("res_pjproject.so")) { \
return AST_MODULE_LOAD_DECLINE; \
} \
} while(0)
/*!
* \brief Retrieve a pjproject build option
*
@@ -79,18 +71,4 @@ void ast_pjproject_log_intercept_begin(int fd);
*/
void ast_pjproject_log_intercept_end(void);
/*!
* \brief Increment the res_pjproject reference count.
*
* This ensures graceful shutdown happens in the proper order.
*/
void ast_pjproject_ref(void);
/*!
* \brief Decrement the res_pjproject reference count.
*
* This ensures graceful shutdown happens in the proper order.
*/
void ast_pjproject_unref(void);
#endif /* _RES_PJPROJECT_H */

View File

@@ -933,9 +933,7 @@ enum ast_sip_contact_filter {
* \retval 0 Success
* \retval -1 Failure
*/
#define ast_sip_register_service(module) \
__ast_sip_register_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)
int __ast_sip_register_service(pjsip_module *module, const char *file, int line, const char *func);
int ast_sip_register_service(pjsip_module *module);
/*!
* This is the opposite of ast_sip_register_service(). Unregistering a
@@ -944,9 +942,7 @@ int __ast_sip_register_service(pjsip_module *module, const char *file, int line,
*
* \param module The PJSIP module to unregister
*/
#define ast_sip_unregister_service(module) \
__ast_sip_unregister_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)
void __ast_sip_unregister_service(pjsip_module *module, const char *file, int line, const char *func);
void ast_sip_unregister_service(pjsip_module *module);
/*!
* \brief Register a SIP authenticator
@@ -2448,10 +2444,8 @@ struct ast_sip_endpoint_formatter {
* \brief Register an endpoint formatter.
*
* \param obj the formatter to register
* \retval 0 Success
* \retval -1 Failure
*/
int ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
void ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
/*!
* \brief Unregister an endpoint formatter.
@@ -2627,20 +2621,14 @@ struct ast_sip_supplement {
* \retval 0 Success
* \retval -1 Failure
*/
#define ast_sip_register_supplement(supplement) \
__ast_sip_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
int __ast_sip_register_supplement(struct ast_sip_supplement *supplement,
const char *file, int line, const char *func);
void ast_sip_register_supplement(struct ast_sip_supplement *supplement);
/*!
* \brief Unregister a an supplement to SIP out of dialog processing
*
* \param supplement The supplement to unregister
*/
#define ast_sip_unregister_supplement(supplement) \
__ast_sip_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
void __ast_sip_unregister_supplement(struct ast_sip_supplement *supplement,
const char *file, int line, const char *func);
void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement);
/*!
* \brief Retrieve the global MWI taskprocessor high water alert trigger level.
@@ -2764,15 +2752,6 @@ void ast_sip_get_default_realm(char *realm, size_t size);
*/
void ast_sip_get_default_from_user(char *from_user, size_t size);
/*! \brief Determines whether the res_pjsip module is loaded */
#define CHECK_PJSIP_MODULE_LOADED() \
do { \
if (!ast_module_check("res_pjsip.so") \
|| !ast_sip_get_pjsip_endpoint()) { \
return AST_MODULE_LOAD_DECLINE; \
} \
} while(0)
/*!
* \brief Retrieve the system keep alive interval setting.
*

View File

@@ -754,13 +754,4 @@ const char *ast_sip_subscription_get_body_subtype(struct ast_sip_subscription *s
*/
void ast_sip_subscription_destroy(struct ast_sip_subscription *sub);
/*! \brief Determines whether the res_pjsip_pubsub module is loaded */
#define CHECK_PJSIP_PUBSUB_MODULE_LOADED() \
do { \
CHECK_PJSIP_MODULE_LOADED(); \
if (!ast_module_check("res_pjsip_pubsub.so")) { \
return AST_MODULE_LOAD_DECLINE; \
} \
} while(0)
#endif /* RES_PJSIP_PUBSUB_H */

View File

@@ -579,23 +579,15 @@ void ast_sip_session_unregister_sdp_handler(struct ast_sip_session_sdp_handler *
* a module could reject an incoming request if desired.
*
* \param supplement The supplement to register
* \retval 0 Success
* \retval -1 Failure
*/
#define ast_sip_session_register_supplement(supplement) \
__ast_sip_session_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement,
const char *file, int line, const char *func);
void ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);
/*!
* \brief Unregister a an supplement to SIP session processing
*
* \param supplement The supplement to unregister
*/
#define ast_sip_session_unregister_supplement(supplement) \
__ast_sip_session_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement,
const char *file, int line, const char *func);
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement);
/*!
* \brief Add supplements to a SIP session
@@ -894,13 +886,4 @@ int ast_sip_session_media_set_write_callback(struct ast_sip_session *session, st
*/
struct ast_sip_session_media *ast_sip_session_media_get_transport(struct ast_sip_session *session, struct ast_sip_session_media *session_media);
/*! \brief Determines whether the res_pjsip_session module is loaded */
#define CHECK_PJSIP_SESSION_MODULE_LOADED() \
do { \
CHECK_PJSIP_MODULE_LOADED(); \
if (!ast_module_check("res_pjsip_session.so")) { \
return AST_MODULE_LOAD_DECLINE; \
} \
} while(0)
#endif /* _RES_PJSIP_SESSION_H */

View File

@@ -46,8 +46,8 @@
* functions.
*
* Since module unload order is based on reference counting, any module that
* uses the API defined in this file must call stasis_app_ref() when loaded,
* and stasis_app_unref() when unloaded.
* uses the API defined in this file must list "res_stasis" in the requires
* field.
*/
#include "asterisk/channel.h"
@@ -228,18 +228,6 @@ void stasis_app_register_event_source(struct stasis_app_event_source *obj);
*/
void stasis_app_register_event_sources(void);
/*!
* \brief Checks to see if the given object is a core event source
*
* \note core event sources are currently only endpoint, bridge, and channel.
*
* \param obj event source object to check
*
* \return non-zero if core event source, otherwise 0 (false)
*/
int stasis_app_is_core_event_source(struct stasis_app_event_source *obj);
/*!
* \brief Unregister an application event source.
*
@@ -849,20 +837,6 @@ struct ast_bridge *stasis_app_get_bridge(struct stasis_app_control *control);
*/
void stasis_app_bridge_destroy(const char *bridge_id);
/*!
* \brief Increment the res_stasis reference count.
*
* This ensures graceful shutdown happens in the proper order.
*/
void stasis_app_ref(void);
/*!
* \brief Decrement the res_stasis reference count.
*
* This ensures graceful shutdown happens in the proper order.
*/
void stasis_app_unref(void);
/*!
* \brief Get the Stasis message sanitizer for app_stasis applications
*