summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric NOULARD <eric.noulard@gmail.com>2012-01-24 22:38:22 (GMT)
committerEric NOULARD <eric.noulard@gmail.com>2012-01-24 22:38:22 (GMT)
commit62b589b4cd73fa59b5902f8f0a5779a6a77947aa (patch)
treeb61ed0d4d6e12503817018606d7f08fb8f3b65b6
parent751713f54b70d955334818f534139f9b59cc66e6 (diff)
downloadCMake-62b589b4cd73fa59b5902f8f0a5779a6a77947aa.zip
CMake-62b589b4cd73fa59b5902f8f0a5779a6a77947aa.tar.gz
CMake-62b589b4cd73fa59b5902f8f0a5779a6a77947aa.tar.bz2
Suppress unused var, beautify code, avoid 1 extra newline.
There remains extra newlines in text Formatter output but the parser does not seem to be the culprit. The formatter should be.
-rw-r--r--Source/cmDocumentation.cxx43
1 files changed, 25 insertions, 18 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index f032592..8aa4721 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -724,7 +724,6 @@ void cmDocumentation::addCMakeStandardDocSections()
//----------------------------------------------------------------------------
void cmDocumentation::addCTestStandardDocSections()
{
- cmDocumentationSection *sec;
// This is currently done for backward compatibility reason
// We may suppress some of these.
addCMakeStandardDocSections();
@@ -749,12 +748,16 @@ void cmDocumentation::addCPackStandardDocSections()
static void trim(std::string& s)
{
std::string::size_type pos = s.find_last_not_of(' ');
- if(pos != std::string::npos) {
+ if(pos != std::string::npos)
+ {
s.erase(pos + 1);
pos = s.find_first_not_of(' ');
if(pos != std::string::npos) s.erase(0, pos);
- }
- else s.erase(s.begin(), s.end());
+ }
+ else
+ {
+ s.erase(s.begin(), s.end());
+ }
}
int cmDocumentation::GetStructuredDocFromFile(
@@ -792,7 +795,8 @@ int cmDocumentation::GetStructuredDocFromFile(
if(line.size() && line[0] == '#')
{
/* handle structured doc context */
- if (line[1]=='#') {
+ if (line[1]=='#')
+ {
std::string mkword = line.substr(2,std::string::npos);
if (mkword=="macro")
{
@@ -904,7 +908,10 @@ int cmDocumentation::GetStructuredDocFromFile(
inBrief = false;
full = "";
} else {
- full += "\n";
+ if (full.length()>0)
+ {
+ full += "\n";
+ }
// the first paragraph of full has ended
inFullFirstParagraph = false;
}
@@ -949,18 +956,18 @@ int cmDocumentation::GetStructuredDocFromFile(
*text += "\n";
newParagraph = true;
}
- // Skip #, and leave space for pre-formatted
- if (inFullFirstParagraph)
- {
- std::string temp = line.c_str()+1;
- trim(temp);
- *text += " " + temp;
- }
- else
- {
- *text += line.c_str()+1;
- *text += "\n";
- }
+ // Skip #, and leave space for pre-formatted
+ if (inFullFirstParagraph)
+ {
+ std::string temp = line.c_str()+1;
+ trim(temp);
+ *text += " " + temp;
+ }
+ else
+ {
+ *text += line.c_str()+1;
+ *text += "\n";
+ }
}
else if(line[1] == ' ')
{