summaryrefslogtreecommitdiff
path: root/src/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-17 07:02:03 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-17 07:02:03 -0500
commitbc31e4838bae16748352901634d264af9b045369 (patch)
treee319e90204eecc02dd788a0112dd9541d393cc0e /src/textual.cc
parent2aa37bca36ffc04a48317aaaecf347d20682e44d (diff)
downloadfork-ledger-bc31e4838bae16748352901634d264af9b045369.tar.gz
fork-ledger-bc31e4838bae16748352901634d264af9b045369.tar.bz2
fork-ledger-bc31e4838bae16748352901634d264af9b045369.zip
Fixed #711: Parsing of alias directive
Diffstat (limited to 'src/textual.cc')
-rw-r--r--src/textual.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/textual.cc b/src/textual.cc
index 8856af5d..0cb7fb81 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -982,27 +982,23 @@ void instance_t::account_alias_directive(account_t * account, string alias)
// (account), add a reference to the account in the `account_aliases'
// map, which is used by the post parser to resolve alias references.
trim(alias);
-#if defined(DEBUG_ON)
std::pair<accounts_map::iterator, bool> result =
-#endif
context.journal->account_aliases.insert
(accounts_map::value_type(alias, account));
-#if defined(DEBUG_ON)
- assert(result.second);
-#endif
+ if (! result.second)
+ (*result.first).second = account;
}
void instance_t::alias_directive(char * line)
{
- char * b = next_element(line);
- if (char * e = std::strchr(b, '=')) {
+ if (char * e = std::strchr(line, '=')) {
char * z = e - 1;
while (std::isspace(*z))
*z-- = '\0';
*e++ = '\0';
e = skip_ws(e);
- account_alias_directive(top_account()->find_account(e), b);
+ account_alias_directive(top_account()->find_account(e), line);
}
}