(mc_config_has_param): use g_key_file_get_value()...

to check if a parameter exists.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2022-07-26 16:13:57 +03:00
parent 67ec86b570
commit cf660c7f9d

View File

@ -161,10 +161,16 @@ mc_config_deinit (mc_config_t * mc_config)
gboolean gboolean
mc_config_has_param (const mc_config_t * mc_config, const char *group, const gchar * param) mc_config_has_param (const mc_config_t * mc_config, const char *group, const gchar * param)
{ {
if (mc_config == NULL || group == NULL || param == NULL) char *value;
return FALSE; gboolean ret;
return g_key_file_has_key (mc_config->handle, group, param, NULL); g_return_val_if_fail (mc_config != NULL, FALSE);
value = g_key_file_get_value (mc_config->handle, group, param, NULL);
ret = value != NULL;
g_free (value);
return ret;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */