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
|
|
@ -7,6 +7,10 @@ bill@newbreedsoftware.com
|
||||||
http://www.newbreedsoftware.com/tuxpaint/
|
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)
|
2004.November.22 (0.9.15)
|
||||||
* Enable more compuler warnings, and update code to prevent them.
|
* Enable more compuler warnings, and update code to prevent them.
|
||||||
Albert Cahalan <albert@users.sf.net>
|
Albert Cahalan <albert@users.sf.net>
|
||||||
|
|
|
||||||
|
|
@ -8249,11 +8249,11 @@ static Mix_Chunk * loadsound(const char * const fname)
|
||||||
|
|
||||||
static void strip_trailing_whitespace( char *buf )
|
static void strip_trailing_whitespace( char *buf )
|
||||||
{
|
{
|
||||||
while (buf[strlen(buf) - 1] == ' ' ||
|
unsigned i = strlen(buf);
|
||||||
buf[strlen(buf) - 1] == '\r' ||
|
while(i--)
|
||||||
buf[strlen(buf) - 1] == '\n')
|
|
||||||
{
|
{
|
||||||
buf[strlen(buf) - 1] = '\0';
|
if(!isspace(buf[i])) break;
|
||||||
|
buf[i] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue