Permalink
Browse files

removeRedundantWhiteSpace micro-optimization

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
  • Loading branch information...
groleo committed Jul 25, 2014
1 parent c9d816a commit d4601735b582b903f1ccb144f59b2030a7797b05
Showing with 9 additions and 6 deletions.
  1. +9 −6 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 @@ QCString removeRedundantWhiteSpace(const QCString &s)
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 @@ QCString removeRedundantWhiteSpace(const QCString &s)
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)==' '*/ ||

0 comments on commit d460173

Please sign in to comment.