From 58f97730dbbb3d3cbc84d344a156d7e467598756 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Fri, 13 Mar 2020 03:21:10 +0100 Subject: [PATCH] config: Add DeleteConfigOption function --- src/config.c | 5 +++++ src/config.h | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index f8a457a..c7ea736 100644 --- a/src/config.c +++ b/src/config.c @@ -62,6 +62,11 @@ SYMBOL_EXPORT const char* GetConfigOptionDefault(struct Game* game, char* sectio return ret; } +SYMBOL_EXPORT void DeleteConfigOption(struct Game* game, char* section, char* name) { + al_remove_config_key(game->_priv.config, section, name); + StoreConfig(game); +} + SYMBOL_EXPORT void DeinitConfig(struct Game* game) { al_destroy_config(game->_priv.config); } diff --git a/src/config.h b/src/config.h index 2102c74..af0e1f7 100644 --- a/src/config.h +++ b/src/config.h @@ -27,10 +27,12 @@ void InitConfig(struct Game* game); /*! \brief Returns value of requested config entry. */ const char* GetConfigOption(struct Game* game, char* section, char* name); -/*! \brief Returns value of requested config entry, or def if no such entry exists. */ +/*! \brief Returns value of requested config entry, or `def` if no such entry exists. */ const char* GetConfigOptionDefault(struct Game* game, char* section, char* name, const char* def); -/*! \brief Sets new value of requested config entry, or created new if no such entry exists. */ +/*! \brief Sets a new value of requested config entry, or creates a new one if no such entry exists. */ void SetConfigOption(struct Game* game, char* section, char* name, char* value); +/*! \brief Deletes an existing config entry. */ +void DeleteConfigOption(struct Game* game, char* section, char* name); /*! \brief Writes config from memory to file. */ void DeinitConfig(struct Game* game);