diff options
author | Terry Wilson <twilson@digium.com> | 2012-06-07 20:32:07 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2012-06-07 20:32:07 +0000 |
commit | 9f704b5d59a91879ba30b90b817090b71ca36afe (patch) | |
tree | 81595af089d9d278d737e5b7d98d3c974e44205b /include | |
parent | ac6ec71fd23d4fe0ce9a7bdd43d9461b4732c713 (diff) |
Fix reloading an unchanged file with the Config Options API
Adding multiple file support broke reloading an unchanged file. This
adds an enum for return values for the aco_process_* functions and
ensures that the config is not applied if res is not ACO_PROCESS_OK.
Review: https://reviewboard.asterisk.org/r/1979/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/config_options.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/include/asterisk/config_options.h b/include/asterisk/config_options.h index 029434ac8..b697ecb54 100644 --- a/include/asterisk/config_options.h +++ b/include/asterisk/config_options.h @@ -386,15 +386,24 @@ typedef int (*aco_option_handler)(const struct aco_option *opt, struct ast_varia /*! \brief Allocate a container to hold config options */ struct ao2_container *aco_option_container_alloc(void); +/*! \brief Return values for the aco_process functions + */ +enum aco_process_status { + ACO_PROCESS_OK, /*!< \brief The config was processed and applied */ + ACO_PROCESS_UNCHANGED, /*!< \brief The config had not been edited and no changes applied */ + ACO_PROCESS_ERROR, /*!< \brief Their was an error and no changes were applied */ +}; + /*! \brief Process a config info via the options registered with an aco_info * * \param info The config_options_info to be used for handling the config * \param reload Whether or not this is a reload * - * \retval 0 Success - * \retval -1 Failure + * \retval ACO_PROCESS_OK Success + * \retval ACO_PROCESS_ERROR Failure + * \retval ACO_PROCESS_UNCHANGED No change due to unedited config file */ -int aco_process_config(struct aco_info *info, int reload); +enum aco_process_status aco_process_config(struct aco_info *info, int reload); /*! \brief Process config info from an ast_config via options registered with an aco_info * @@ -403,10 +412,10 @@ int aco_process_config(struct aco_info *info, int reload); * \param cfg A pointer to a loaded ast_config to parse * \param reload Whether or not this is a reload * - * \retval 0 Success - * \retval -1 Failure + * \retval ACO_PROCESS_OK Success + * \retval ACO_PROCESS_ERROR Failure */ -int aco_process_ast_config(struct aco_info *info, struct aco_file *file, struct ast_config *cfg); +enum aco_process_status aco_process_ast_config(struct aco_info *info, struct aco_file *file, struct ast_config *cfg); /*! \brief Parse each option defined in a config category * \param type The aco_type with the options for parsing |