summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorAdrian Negreanu <adrian.m.negreanu@intel.com>2014-07-25 09:36:05 (GMT)
committerAdrian Negreanu <adrian.m.negreanu@intel.com>2014-07-25 09:38:49 (GMT)
commitd4601735b582b903f1ccb144f59b2030a7797b05 (patch)
tree3dde8567344ddafeacca2afd1a5343088ccba283 /src/util.cpp
parentc9d816aaf20c24c624407ba1c2eb4e00eff0c02f (diff)
downloadDoxygen-d4601735b582b903f1ccb144f59b2030a7797b05.zip
Doxygen-d4601735b582b903f1ccb144f59b2030a7797b05.tar.gz
Doxygen-d4601735b582b903f1ccb144f59b2030a7797b05.tar.bz2
removeRedundantWhiteSpace micro-optimization
Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 0113e62..4cd680d 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1667,10 +1667,11 @@ QCString removeRedundantWhiteSpace(const QCString &s)
uint l=s.length();
uint csp=0;
uint vsp=0;
+ char c;
for (i=0;i<l;i++)
{
nextChar:
- char c=s.at(i);
+ c=s.at(i);
// search for "const"
if (csp<6 && c==constScope[csp] && // character matches substring "const"
@@ -1705,7 +1706,7 @@ nextChar:
if (cc=='\\') // escaped character
{
growBuf.addChar(s.at(i+1));
- i+=2;
+ i+=2;
}
else if (cc=='"') // end of string
{ i++; goto nextChar; }
@@ -1737,14 +1738,16 @@ nextChar:
growBuf.addChar(',');
growBuf.addChar(' ');
}
- else if (i>0 &&
- ((isId(s.at(i)) && s.at(i-1)==')') ||
- (s.at(i)=='\'' && s.at(i-1)==' ')
+ else if (i>0 &&
+ (
+ (s.at(i-1)==')' && isId(c))
+ ||
+ (c=='\'' && s.at(i-1)==' ')
)
)
{
growBuf.addChar(' ');
- growBuf.addChar(s.at(i));
+ growBuf.addChar(c);
}
else if (c=='t' && csp==5 /*&& (i<5 || !isId(s.at(i-5)))*/ &&
!(isId(s.at(i+1)) /*|| s.at(i+1)==' '*/ ||