libmpm

morphux C package management library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/libmpm

commit c7f2c0a5bbb61e3ee90ba35dc93d8c58e00838d4
parent 8215c9f5b27d780c962fbab03dd24efec892c6b9
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 24 Jul 2017 19:05:41 +0200

Fix(Config): get_opt_from_name is now a public function

Diffstat:
Minc/config.h | 10++++++++++
Msrc/config.c | 12++----------
2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/inc/config.h b/inc/config.h @@ -142,4 +142,14 @@ bool get_conf_int_from_name(config_t *ptr, const char *str, int *ret); */ cfg_type_t get_type_from_name(config_t *ptr, const char *str); +/*! + * \brief Get an cfg_opt_t pointer from a common name + * + * \param ptr Configuration context + * \param str Name of the member (Ex: "download.something") + * + * \return A pointer on the option on success, NULL on failure + */ +cfg_opt_t *get_opt_from_name(config_t *ptr, const char *str); + #endif /* CONFIG_H */ diff --git a/src/config.c b/src/config.c @@ -139,15 +139,7 @@ void config_get_error_string(config_t *ptr) { strcpy(g_error, ""); } -/*! - * \brief Get an cfg_opt_t pointer from a common name - * - * \param ptr Configuration context - * \param str Name of the member (Ex: "download.something") - * - * \return A pointer on the option on success, NULL on failure - */ -static cfg_opt_t *get_opt_from_name(config_t *ptr, const char *str) +cfg_opt_t *get_opt_from_name(config_t *ptr, const char *str) { cfg_t *sec; cfg_opt_t *opt = NULL; @@ -214,6 +206,6 @@ bool get_conf_int_from_name(config_t *ptr, const char *str, int *ret) { /* Cannot not be a int */ assert(opt->type == CFGT_INT); - *ret = cfg_opt_getnint(opt, 0); + *ret = cfg_opt_getnint(opt, 0); return true; }