mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Use std::vector of const char* instead of std::string where meaningful
This avoids additional string allocation
This commit is contained in:
@@ -248,7 +248,7 @@ TEST_F(ImportBackendBayesTest, CreateTransInfo)
|
||||
|
||||
// check tokens created from transaction
|
||||
EXPECT_CALL(imap, findAccountBayes(AllOf(
|
||||
Each(Not(IsEmpty())), // tokens must not be empty strings
|
||||
Each(Not(StrEq(""))), // tokens must not be empty strings
|
||||
Each(Not(HasSubstr(" "))), // tokens must not contain separator
|
||||
Not(HasDuplicates()), // tokens must be unique
|
||||
Contains(StrEq(local_day_of_week)), // tokens must contain local day of week
|
||||
|
||||
@@ -85,7 +85,7 @@ gnc_account_imap_find_account_bayes (
|
||||
GList *tokens)
|
||||
{
|
||||
// \todo use std::list instead of std::vector, since GList is a double-linked list like std::list
|
||||
std::vector<std::string> tokenVec;
|
||||
std::vector<const char*> tokenVec;
|
||||
|
||||
for (auto token = tokens; token; token = token->next)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ gnc_account_imap_add_account_bayes (
|
||||
Account *acc)
|
||||
{
|
||||
// \todo use std::list instead of std::vector, since GList is a double-linked list like std::list
|
||||
std::vector<std::string> tokenVec;
|
||||
std::vector<const char*> tokenVec;
|
||||
|
||||
for (auto token = tokens; token; token = token->next)
|
||||
{
|
||||
|
||||
@@ -62,8 +62,8 @@ public:
|
||||
|
||||
MOCK_METHOD2(findAccount, Account *(const char*, const char*));
|
||||
MOCK_METHOD3(addAccount, void(const char*, const char*, Account*));
|
||||
MOCK_METHOD1(findAccountBayes, Account *(std::vector<std::string>));
|
||||
MOCK_METHOD2(addAccountBayes, void(std::vector<std::string>, Account*));
|
||||
MOCK_METHOD1(findAccountBayes, Account *(std::vector<const char*>));
|
||||
MOCK_METHOD2(addAccountBayes, void(std::vector<const char*>, Account*));
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user