simplify strip_trailing_whitespace, now O(n)
This commit is contained in:
parent
f7679aed1c
commit
e5dbc33b29
2 changed files with 8 additions and 4 deletions
|
|
@ -8249,11 +8249,11 @@ static Mix_Chunk * loadsound(const char * const fname)
|
|||
|
||||
static void strip_trailing_whitespace( char *buf )
|
||||
{
|
||||
while (buf[strlen(buf) - 1] == ' ' ||
|
||||
buf[strlen(buf) - 1] == '\r' ||
|
||||
buf[strlen(buf) - 1] == '\n')
|
||||
unsigned i = strlen(buf);
|
||||
while(i--)
|
||||
{
|
||||
buf[strlen(buf) - 1] = '\0';
|
||||
if(!isspace(buf[i])) break;
|
||||
buf[i] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue