MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / CollapseWhitespace

Method CollapseWhitespace

sourcecommon/tinyxml2.cpp:135–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133
134
135void StrPair::CollapseWhitespace()
136{
137 // Adjusting _start would cause undefined behavior on delete[]
138 TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 );
139 // Trim leading space.
140 _start = XMLUtil::SkipWhiteSpace( _start );
141
142 if ( _start && *_start ) {
143 char* p = _start; // the read pointer
144 char* q = _start; // the write pointer
145
146 while( *p ) {
147 if ( XMLUtil::IsWhiteSpace( *p )) {
148 p = XMLUtil::SkipWhiteSpace( p );
149 if ( *p == 0 ) {
150 break; // don't write to q; this trims the trailing space.
151 }
152 *q = ' ';
153 ++q;
154 }
155 *q = *p;
156 ++q;
157 ++p;
158 }
159 *q = 0;
160 }
161}
162
163
164const char* StrPair::GetStr()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected