Merge branch 'bug/strchop'

This commit is contained in:
Tatsuya Kinoshita
2013-08-04 16:53:29 +09:00

4
Str.c
View File

@@ -278,8 +278,8 @@ void
Strchop(Str s) Strchop(Str s)
{ {
STR_LENGTH_CHECK(s); STR_LENGTH_CHECK(s);
while ((s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r') && while (s->length > 0 &&
s->length > 0) { (s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r')) {
s->length--; s->length--;
} }
s->ptr[s->length] = '\0'; s->ptr[s->length] = '\0';