From 397eb9364b83ede4c4f82f52dff8ed1ecb414338 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 20 Sep 2012 01:41:45 +0200 Subject: options: handle alias options differently When setting an alias option, its value is not saved in the file-local options case. The ensure_backup function in m_config.c exits if it encounters an aliased option, because it should not be saved additionally to the original option. However, the original option is likely never saved in this case. Change it so that ensure_backup always accesses the original option. The original option is the one that first appears in the option list. --- m_config.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'm_config.h') diff --git a/m_config.h b/m_config.h index 80897ce0e4..6bb1f4ff35 100644 --- a/m_config.h +++ b/m_config.h @@ -43,10 +43,12 @@ struct m_config_option { void *data; // Raw value of the backup of the global value (or NULL). void *global_backup; - // See \ref ConfigOptionFlags. - unsigned int flags; // If this is a suboption, the option that contains this option. struct m_config_option *parent; + // If this option aliases another, more important option. The alias_owner + // option is the one that has the most correct option type for the data + // variable, and which is considered the original. + struct m_config_option *alias_owner; }; // Profiles allow to predefine some sets of options that can then @@ -91,9 +93,6 @@ typedef struct m_config { int (*includefunc)(struct m_config *conf, char *filename); } m_config_t; -// Set if another option already uses the same variable. -#define M_CFG_OPT_ALIAS (1 << 1) - // Create a new config object. struct m_config * m_config_new(void *optstruct, -- cgit v1.2.3