MCPcopy Create free account
hub / github.com/ddnet/ddnet / str_clean_whitespaces

Function str_clean_whitespaces

src/base/str.cpp:295–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295void str_clean_whitespaces(char *str)
296{
297 char *read = str;
298 char *write = str;
299
300 /* skip initial whitespace */
301 while(*read == ' ')
302 read++;
303
304 /* end of read string is detected in the loop */
305 while(true)
306 {
307 /* skip whitespace */
308 int found_whitespace = 0;
309 for(; *read == ' '; read++)
310 found_whitespace = 1;
311 /* if not at the end of the string, put a found whitespace here */
312 if(*read)
313 {
314 if(found_whitespace)
315 *write++ = ' ';
316 *write++ = *read++;
317 }
318 else
319 {
320 *write = 0;
321 break;
322 }
323 }
324}
325
326char *str_skip_to_whitespace(char *str)
327{

Callers 4

ProcessServerInfoMethod · 0.85
TranslateSysMsgMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected