ICU-8697 C review fixes #2: less convoluted code

X-SVN-Rev: 31510
This commit is contained in:
Peter Edberg 2012-02-24 22:54:57 +00:00
parent faced7a2f0
commit 22eb317bb2
2 changed files with 4 additions and 6 deletions

View File

@ -1597,7 +1597,6 @@ DecimalFormat::parse(const UnicodeString& text,
CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& text,
ParsePosition& pos) const {
CurrencyAmount* currAmtToReturn = NULL;
Formattable parseResult;
int32_t start = pos.getIndex();
UChar curbuf[4];
@ -1608,10 +1607,10 @@ CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& text,
if (U_FAILURE(ec)) {
pos.setIndex(start); // indicate failure
} else {
currAmtToReturn = currAmt.orphan();
return currAmt.orphan();
}
}
return currAmtToReturn;
return NULL;
}
/**

View File

@ -627,7 +627,6 @@ NumberFormat::parse(const UnicodeString& text,
CurrencyAmount* NumberFormat::parseCurrency(const UnicodeString& text,
ParsePosition& pos) const {
// Default implementation only -- subclasses should override
CurrencyAmount* currAmtToReturn = NULL;
Formattable parseResult;
int32_t start = pos.getIndex();
parse(text, parseResult, pos);
@ -640,11 +639,11 @@ CurrencyAmount* NumberFormat::parseCurrency(const UnicodeString& text,
if (U_FAILURE(ec)) {
pos.setIndex(start); // indicate failure
} else {
currAmtToReturn = currAmt.orphan();
return currAmt.orphan();
}
}
}
return currAmtToReturn;
return NULL;
}
// -------------------------------------