From 527cf5a57033820313356414b971fdf0f4382b21 Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Fri, 29 Dec 2017 03:57:17 -0500 Subject: 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 --- include/asterisk/agi.h | 6 ++---- include/asterisk/ari.h | 10 ---------- include/asterisk/res_mwi_external.h | 16 ---------------- include/asterisk/res_pjproject.h | 22 ---------------------- include/asterisk/res_pjsip.h | 31 +++++-------------------------- include/asterisk/res_pjsip_pubsub.h | 9 --------- include/asterisk/res_pjsip_session.h | 21 ++------------------- include/asterisk/stasis_app.h | 30 ++---------------------------- 8 files changed, 11 insertions(+), 134 deletions(-) (limited to 'include') diff --git a/include/asterisk/agi.h b/include/asterisk/agi.h index cb80f9570..568cd5d11 100644 --- a/include/asterisk/agi.h +++ b/include/asterisk/agi.h @@ -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; }); /*! diff --git a/include/asterisk/ari.h b/include/asterisk/ari.h index f83d5963f..865b4b00c 100644 --- a/include/asterisk/ari.h +++ b/include/asterisk/ari.h @@ -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 */ diff --git a/include/asterisk/res_mwi_external.h b/include/asterisk/res_mwi_external.h index 7698a1bd6..25de70003 100644 --- a/include/asterisk/res_mwi_external.h +++ b/include/asterisk/res_mwi_external.h @@ -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. */ diff --git a/include/asterisk/res_pjproject.h b/include/asterisk/res_pjproject.h index 8828b340c..4993be610 100644 --- a/include/asterisk/res_pjproject.h +++ b/include/asterisk/res_pjproject.h @@ -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 */ diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index 66b99b8f7..a3bd78222 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -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. * diff --git a/include/asterisk/res_pjsip_pubsub.h b/include/asterisk/res_pjsip_pubsub.h index cb51db31f..e9d59a085 100644 --- a/include/asterisk/res_pjsip_pubsub.h +++ b/include/asterisk/res_pjsip_pubsub.h @@ -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 */ diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h index 65d463821..f6ee0f00b 100644 --- a/include/asterisk/res_pjsip_session.h +++ b/include/asterisk/res_pjsip_session.h @@ -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 */ diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h index 8ef2bda1c..b0829ab73 100644 --- a/include/asterisk/stasis_app.h +++ b/include/asterisk/stasis_app.h @@ -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 * -- cgit v1.2.3