mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 20:19:53 +00:00
cmDocumentation: use ofstream local variable
This commit is contained in:
parent
ba8571ff2d
commit
1ef22a26c9
@ -129,28 +129,19 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
|
||||
this->CurrentArgument = i->Argument;
|
||||
// If a file name was given, use it. Otherwise, default to the
|
||||
// given stream.
|
||||
cmsys::ofstream* fout = CM_NULLPTR;
|
||||
cmsys::ofstream fout;
|
||||
std::ostream* s = &os;
|
||||
if (!i->Filename.empty()) {
|
||||
fout = new cmsys::ofstream(i->Filename.c_str());
|
||||
if (fout) {
|
||||
s = fout;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
fout.open(i->Filename.c_str());
|
||||
s = &fout;
|
||||
} else if (++count > 1) {
|
||||
os << "\n\n";
|
||||
}
|
||||
|
||||
// Print this documentation type to the stream.
|
||||
if (!this->PrintDocumentation(i->HelpType, *s) || !*s) {
|
||||
if (!this->PrintDocumentation(i->HelpType, *s) || s->fail()) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
// Close the file if we wrote one.
|
||||
if (fout) {
|
||||
delete fout;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user