MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / CollapseWhitespace

Method CollapseWhitespace

externals/tinyxml2/tinyxml2.cpp:252–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250
251
252void StrPair::CollapseWhitespace()
253{
254 // Adjusting _start would cause undefined behavior on delete[]
255 TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 );
256 // Trim leading space.
257 _start = XMLUtil::SkipWhiteSpace( _start, 0 );
258
259 if ( *_start ) {
260 const char* p = _start; // the read pointer
261 char* q = _start; // the write pointer
262
263 while( *p ) {
264 if ( XMLUtil::IsWhiteSpace( *p )) {
265 p = XMLUtil::SkipWhiteSpace( p, 0 );
266 if ( *p == 0 ) {
267 break; // don't write to q; this trims the trailing space.
268 }
269 *q = ' ';
270 ++q;
271 }
272 *q = *p;
273 ++q;
274 ++p;
275 }
276 *q = 0;
277 }
278}
279
280
281const char* StrPair::GetStr()

Callers

nothing calls this directly

Calls 2

SkipWhiteSpaceFunction · 0.85
IsWhiteSpaceFunction · 0.85

Tested by

no test coverage detected