Reformatting for readability. In ReadInput: delete source only if non-NULL.

This commit is contained in:
Ulrich Germann 2014-03-11 13:53:54 +00:00
parent a7c85780ee
commit b3043d9b00

View File

@ -182,7 +182,9 @@ void IOWrapper::Initialization(const std::vector<FactorType> &/*inputFactorOrder
}
InputType*IOWrapper::GetInput(InputType* inputType)
InputType*
IOWrapper::
GetInput(InputType* inputType)
{
if(inputType->Read(*m_inputStream, m_inputFactorOrder)) {
if (long x = inputType->GetTranslationId()) {
@ -605,7 +607,7 @@ void IOWrapper::OutputLatticeMBRNBestList(const vector<LatticeMBRSolution>& solu
bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source)
{
delete source;
if (source) delete source;
switch(inputType) {
case SentenceInput:
source = ioWrapper.GetInput(new Sentence);
@ -618,6 +620,7 @@ bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source
break;
default:
TRACE_ERR("Unknown input type: " << inputType << "\n");
source = NULL;
}
return (source ? true : false);
}