###############################################################################
# libconfig
LIBCONFIG= libconfig.a
-LIBCONFIGOBJS= config/account.o config/address.o config/bool.o config/command.o config/dump.o \
+LIBCONFIGOBJS= config/address.o config/bool.o config/cfgaccount.o config/command.o config/dump.o \
config/long.o config/magic.o config/mbtable.o config/number.o \
config/path.o config/quad.o config/regex.o config/set.o \
config/sort.o config/string.o
*/
/**
- * @page config-account Account-specific config items
+ * @page config-cfgaccount Account-specific config items
*
* A collection of account-specific config items.
*/
#include "mutt/logging.h"
#include "mutt/memory.h"
#include "mutt/string2.h"
-#include "account.h"
+#include "cfgaccount.h"
#include "inheritance.h"
#include "set.h"
#include "types.h"
/**
- * ac_create - Create an Account
+ * ac_create - Create an CfgAccount
* @param cs Config items
- * @param name Name of Account
+ * @param name Name of CfgAccount
* @param var_names List of config items (NULL terminated)
- * @retval ptr New Account object
+ * @retval ptr New CfgAccount object
*/
-struct Account *ac_create(const struct ConfigSet *cs, const char *name,
+struct CfgAccount *ac_create(const struct ConfigSet *cs, const char *name,
const char *var_names[])
{
if (!cs || !name || !var_names)
for (; var_names[count]; count++)
;
- struct Account *ac = mutt_mem_calloc(1, sizeof(*ac));
+ struct CfgAccount *ac = mutt_mem_calloc(1, sizeof(*ac));
ac->name = mutt_str_strdup(name);
ac->cs = cs;
ac->var_names = var_names;
}
/**
- * ac_free - Free an Account object
+ * ac_free - Free an CfgAccount object
* @param cs Config items
- * @param ac Account to free
+ * @param ac CfgAccount to free
*/
-void ac_free(const struct ConfigSet *cs, struct Account **ac)
+void ac_free(const struct ConfigSet *cs, struct CfgAccount **ac)
{
if (!cs || !ac || !*ac)
return; /* LCOV_EXCL_LINE */
}
/**
- * ac_set_value - Set an Account-specific config item
- * @param ac Account-specific config items
- * @param vid Value ID (index into Account's HashElem's)
+ * ac_set_value - Set an CfgAccount-specific config item
+ * @param ac CfgAccount-specific config items
+ * @param vid Value ID (index into CfgAccount's HashElem's)
* @param value Native pointer/value to set
* @param err Buffer for error messages
* @retval int Result, e.g. #CSR_SUCCESS
*/
-int ac_set_value(const struct Account *ac, size_t vid, intptr_t value, struct Buffer *err)
+int ac_set_value(const struct CfgAccount *ac, size_t vid, intptr_t value, struct Buffer *err)
{
if (!ac)
return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
/**
* ac_get_value - Get an account-specific config item
* @param ac Account-specific config items
- * @param vid Value ID (index into Account's HashElem's)
+ * @param vid Value ID (index into CfgAccount's HashElem's)
* @param result Buffer for results or error messages
* @retval int Result, e.g. #CSR_SUCCESS
*/
-int ac_get_value(const struct Account *ac, size_t vid, struct Buffer *result)
+int ac_get_value(const struct CfgAccount *ac, size_t vid, struct Buffer *result)
{
if (!ac)
return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
struct ConfigSet;
/**
- * struct Account - Account-local config items
+ * struct CfgAccount - Account-local config items
*/
-struct Account
+struct CfgAccount
{
char *name; /**< Name of Account */
const struct ConfigSet *cs; /**< Parent ConfigSet */
struct HashElem **vars; /**< Array of the HashElems of local config items */
};
-struct Account *ac_create(const struct ConfigSet *cs, const char *name, const char *var_names[]);
-void ac_free(const struct ConfigSet *cs, struct Account **ac);
+struct CfgAccount *ac_create(const struct ConfigSet *cs, const char *name, const char *var_names[]);
+void ac_free(const struct ConfigSet *cs, struct CfgAccount **ac);
-int ac_set_value(const struct Account *ac, size_t vid, intptr_t value, struct Buffer *err);
-int ac_get_value(const struct Account *ac, size_t vid, struct Buffer *result);
+int ac_set_value(const struct CfgAccount *ac, size_t vid, intptr_t value, struct Buffer *err);
+int ac_get_value(const struct CfgAccount *ac, size_t vid, struct Buffer *result);
#endif /* _CONFIG_ACCOUNT_H */
{
struct HashElem *parent; /**< HashElem of parent config item */
const char *name; /**< Name of this config item */
- struct Account *ac; /**< Account holding this config item */
+ struct CfgAccount *ac; /**< CfgAccount holding this config item */
intptr_t var; /**< (Pointer to) value, of config item */
};
*
* User configurable variables.
*
- * | File | Description |
- * | :--------------- | :---------------------- |
- * | config/account.c | @subpage config-account |
- * | config/address.c | @subpage config-address |
- * | config/bool.c | @subpage config-bool |
- * | config/command.c | @subpage config-command |
- * | config/dump.c | @subpage config-dump |
- * | config/long.c | @subpage config-long |
- * | config/magic.c | @subpage config-magic |
- * | config/mbtable.c | @subpage config-mbtable |
- * | config/number.c | @subpage config-number |
- * | config/path.c | @subpage config-path |
- * | config/quad.c | @subpage config-quad |
- * | config/regex.c | @subpage config-regex |
- * | config/set.c | @subpage config-set |
- * | config/sort.c | @subpage config-sort |
- * | config/string.c | @subpage config-string |
+ * | File | Description |
+ * | :------------------ | :------------------------- |
+ * | config/address.c | @subpage config-address |
+ * | config/bool.c | @subpage config-bool |
+ * | config/cfgaccount.c | @subpage config-cfgaccount |
+ * | config/command.c | @subpage config-command |
+ * | config/dump.c | @subpage config-dump |
+ * | config/long.c | @subpage config-long |
+ * | config/magic.c | @subpage config-magic |
+ * | config/mbtable.c | @subpage config-mbtable |
+ * | config/number.c | @subpage config-number |
+ * | config/path.c | @subpage config-path |
+ * | config/quad.c | @subpage config-quad |
+ * | config/regex.c | @subpage config-regex |
+ * | config/set.c | @subpage config-set |
+ * | config/sort.c | @subpage config-sort |
+ * | config/string.c | @subpage config-string |
*/
#ifndef MUTT_CONFIG_LIB_H
#define MUTT_CONFIG_LIB_H
-#include "account.h"
#include "address.h"
#include "bool.h"
+#include "cfgaccount.h"
#include "command.h"
#include "dump.h"
#include "inheritance.h"
/**
* @file
- * Test code for the Account object
+ * Test code for the CfgAccount object
*
* @authors
* Copyright (C) 2017-2018 Richard Russon <rich@flatcap.org>
NULL,
};
- struct Account *ac = ac_create(cs, account, BrokenVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, BrokenVarStr);
if (TEST_CHECK(!ac))
{
TEST_MSG("Expected error:\n");
return;
}
- const char *AccountVarStr2[] = {
+ const char *CfgAccountVarStr2[] = {
"Apple",
"Apple",
NULL,
};
TEST_MSG("Expect error for next test\n");
- ac = ac_create(cs, account, AccountVarStr2);
+ ac = ac_create(cs, account, CfgAccountVarStr2);
if (!TEST_CHECK(!ac))
{
ac_free(cs, &ac);
}
account = "fruit";
- const char *AccountVarStr[] = {
+ const char *CfgAccountVarStr[] = {
"Apple",
"Cherry",
NULL,
};
- ac = ac_create(cs, account, AccountVarStr);
+ ac = ac_create(cs, account, CfgAccountVarStr);
if (!TEST_CHECK(ac != NULL))
return;
}
else
{
- TEST_MSG("%s = %s\n", AccountVarStr[index], err.data);
+ TEST_MSG("%s = %s\n", CfgAccountVarStr[index], err.data);
}
index++;
}
else
{
- TEST_MSG("%s = %s\n", AccountVarStr[index], err.data);
+ TEST_MSG("%s = %s\n", CfgAccountVarStr[index], err.data);
}
mutt_buffer_reset(&err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarAddr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarAddr);
// set parent
mutt_buffer_reset(err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
VarMango = false;
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
mutt_buffer_reset(err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
VarOlive = 123;
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
mutt_buffer_reset(err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarMb);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarMb);
// set parent
mutt_buffer_reset(err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
VarOlive = 123;
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
mutt_buffer_reset(err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
mutt_buffer_reset(err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarRegex);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarRegex);
// set parent
mutt_buffer_reset(err);
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
VarStrawberry = SORT_SUBJECT;
NULL,
};
- struct Account *ac = ac_create(cs, account, AccountVarStr);
+ struct CfgAccount *ac = ac_create(cs, account, AccountVarStr);
// set parent
mutt_buffer_reset(err);