simplify strip_trailing_whitespace, now O(n)

This commit is contained in:
Albert Cahalan 2004-11-23 18:37:59 +00:00
parent f7679aed1c
commit e5dbc33b29
2 changed files with 8 additions and 4 deletions

View file

@ -7,6 +7,10 @@ bill@newbreedsoftware.com
http://www.newbreedsoftware.com/tuxpaint/
2004.November.23 (0.9.15)
* simplify strip_trailing_whitespace, now O(n)
Albert Cahalan <albert@users.sf.net>
2004.November.22 (0.9.15)
* Enable more compuler warnings, and update code to prevent them.
Albert Cahalan <albert@users.sf.net>

View file

@ -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';
}
}