(parse_entry): Allow for the possibility that a transaction might end
with EOF.
This commit is contained in:
parent
c0d2ec851d
commit
4819302633
1 changed files with 7 additions and 1 deletions
|
|
@ -338,17 +338,23 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
|
||||||
TIMER_START(entry_xacts);
|
TIMER_START(entry_xacts);
|
||||||
|
|
||||||
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
|
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
|
||||||
|
line[0] = '\0';
|
||||||
in.getline(line, MAX_LINE);
|
in.getline(line, MAX_LINE);
|
||||||
if (in.eof())
|
if (in.eof() && line[0] == '\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
linenum++;
|
linenum++;
|
||||||
if (line[0] == ' ' || line[0] == '\t' || line[0] == '\r') {
|
if (line[0] == ' ' || line[0] == '\t' || line[0] == '\r') {
|
||||||
char * p = skip_ws(line);
|
char * p = skip_ws(line);
|
||||||
if (! *p || *p == '\r')
|
if (! *p || *p == '\r')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transaction_t * xact = parse_transaction(line, master))
|
if (transaction_t * xact = parse_transaction(line, master))
|
||||||
curr->add_transaction(xact);
|
curr->add_transaction(xact);
|
||||||
|
|
||||||
|
if (in.eof())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER_STOP(entry_xacts);
|
TIMER_STOP(entry_xacts);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue