From 52828751bf608797a9bd3411c5896032a6d0e3bf Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 11 Oct 2018 13:59:48 +0100 Subject: [PATCH] rename config Account --- Makefile.autosetup | 2 +- config/{account.c => cfgaccount.c} | 32 +++++++++++++------------- config/{account.h => cfgaccount.h} | 12 +++++----- config/inheritance.h | 2 +- config/lib.h | 36 +++++++++++++++--------------- test/config/account.c | 16 ++++++------- test/config/address.c | 2 +- test/config/bool.c | 2 +- test/config/command.c | 2 +- test/config/long.c | 2 +- test/config/magic.c | 2 +- test/config/mbtable.c | 2 +- test/config/number.c | 2 +- test/config/path.c | 2 +- test/config/quad.c | 2 +- test/config/regex.c | 2 +- test/config/sort.c | 2 +- test/config/string.c | 2 +- 18 files changed, 62 insertions(+), 62 deletions(-) rename config/{account.c => cfgaccount.c} (81%) rename config/{account.h => cfgaccount.h} (75%) diff --git a/Makefile.autosetup b/Makefile.autosetup index 697134f1c..d86f1b2fa 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -224,7 +224,7 @@ ALLOBJS+= $(PGPEWRAPOBJS) ############################################################################### # 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 diff --git a/config/account.c b/config/cfgaccount.c similarity index 81% rename from config/account.c rename to config/cfgaccount.c index f140aee53..fa61dcf49 100644 --- a/config/account.c +++ b/config/cfgaccount.c @@ -21,7 +21,7 @@ */ /** - * @page config-account Account-specific config items + * @page config-cfgaccount Account-specific config items * * A collection of account-specific config items. */ @@ -35,19 +35,19 @@ #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) @@ -57,7 +57,7 @@ struct Account *ac_create(const struct ConfigSet *cs, const char *name, 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; @@ -95,11 +95,11 @@ struct Account *ac_create(const struct ConfigSet *cs, const char *name, } /** - * 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 */ @@ -127,14 +127,14 @@ void ac_free(const struct ConfigSet *cs, struct Account **ac) } /** - * 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 */ @@ -148,11 +148,11 @@ int ac_set_value(const struct Account *ac, size_t vid, intptr_t value, struct Bu /** * 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 */ diff --git a/config/account.h b/config/cfgaccount.h similarity index 75% rename from config/account.h rename to config/cfgaccount.h index f6824f952..90ded6bd3 100644 --- a/config/account.h +++ b/config/cfgaccount.h @@ -29,9 +29,9 @@ struct Buffer; 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 */ @@ -40,10 +40,10 @@ struct Account 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 */ diff --git a/config/inheritance.h b/config/inheritance.h index f5aadf5d0..616f7309e 100644 --- a/config/inheritance.h +++ b/config/inheritance.h @@ -32,7 +32,7 @@ struct Inheritance { 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 */ }; diff --git a/config/lib.h b/config/lib.h index 5a6523038..72f8a1bbd 100644 --- a/config/lib.h +++ b/config/lib.h @@ -25,31 +25,31 @@ * * 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" diff --git a/test/config/account.c b/test/config/account.c index 935d20029..70241370f 100644 --- a/test/config/account.c +++ b/test/config/account.c @@ -1,6 +1,6 @@ /** * @file - * Test code for the Account object + * Test code for the CfgAccount object * * @authors * Copyright (C) 2017-2018 Richard Russon @@ -68,7 +68,7 @@ void config_account(void) 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"); @@ -80,14 +80,14 @@ void config_account(void) 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); @@ -96,13 +96,13 @@ void config_account(void) } 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; @@ -134,7 +134,7 @@ void config_account(void) } else { - TEST_MSG("%s = %s\n", AccountVarStr[index], err.data); + TEST_MSG("%s = %s\n", CfgAccountVarStr[index], err.data); } index++; @@ -146,7 +146,7 @@ void config_account(void) } else { - TEST_MSG("%s = %s\n", AccountVarStr[index], err.data); + TEST_MSG("%s = %s\n", CfgAccountVarStr[index], err.data); } mutt_buffer_reset(&err); diff --git a/test/config/address.c b/test/config/address.c index 87f2a3eba..1b748b21d 100644 --- a/test/config/address.c +++ b/test/config/address.c @@ -546,7 +546,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarAddr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarAddr); // set parent mutt_buffer_reset(err); diff --git a/test/config/bool.c b/test/config/bool.c index 477b5f203..22b738227 100644 --- a/test/config/bool.c +++ b/test/config/bool.c @@ -525,7 +525,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent VarMango = false; diff --git a/test/config/command.c b/test/config/command.c index 3f7b1dddf..2e8bfbbce 100644 --- a/test/config/command.c +++ b/test/config/command.c @@ -573,7 +573,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent mutt_buffer_reset(err); diff --git a/test/config/long.c b/test/config/long.c index 7b7aefd32..208b780d4 100644 --- a/test/config/long.c +++ b/test/config/long.c @@ -520,7 +520,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent VarOlive = 123; diff --git a/test/config/magic.c b/test/config/magic.c index f981e83b7..32e17da68 100644 --- a/test/config/magic.c +++ b/test/config/magic.c @@ -511,7 +511,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent mutt_buffer_reset(err); diff --git a/test/config/mbtable.c b/test/config/mbtable.c index 1f7923616..f59112134 100644 --- a/test/config/mbtable.c +++ b/test/config/mbtable.c @@ -562,7 +562,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarMb); + struct CfgAccount *ac = ac_create(cs, account, AccountVarMb); // set parent mutt_buffer_reset(err); diff --git a/test/config/number.c b/test/config/number.c index 53e8f0d89..701b419b5 100644 --- a/test/config/number.c +++ b/test/config/number.c @@ -539,7 +539,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent VarOlive = 123; diff --git a/test/config/path.c b/test/config/path.c index 6a81fe059..bbaa80299 100644 --- a/test/config/path.c +++ b/test/config/path.c @@ -573,7 +573,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent mutt_buffer_reset(err); diff --git a/test/config/quad.c b/test/config/quad.c index b2e2ab2b8..9090889ce 100644 --- a/test/config/quad.c +++ b/test/config/quad.c @@ -532,7 +532,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent mutt_buffer_reset(err); diff --git a/test/config/regex.c b/test/config/regex.c index f7db0aa9a..e07151a70 100644 --- a/test/config/regex.c +++ b/test/config/regex.c @@ -614,7 +614,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarRegex); + struct CfgAccount *ac = ac_create(cs, account, AccountVarRegex); // set parent mutt_buffer_reset(err); diff --git a/test/config/sort.c b/test/config/sort.c index 1409b4e1f..423db6d12 100644 --- a/test/config/sort.c +++ b/test/config/sort.c @@ -636,7 +636,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent VarStrawberry = SORT_SUBJECT; diff --git a/test/config/string.c b/test/config/string.c index 37fc451ff..ef605c206 100644 --- a/test/config/string.c +++ b/test/config/string.c @@ -573,7 +573,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) NULL, }; - struct Account *ac = ac_create(cs, account, AccountVarStr); + struct CfgAccount *ac = ac_create(cs, account, AccountVarStr); // set parent mutt_buffer_reset(err); -- 2.40.0