aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2013-08-04 07:53:29 +0000
committerTatsuya Kinoshita <tats@debian.org>2013-08-04 07:53:29 +0000
commitf59b4a57d87fdaf4a7b0c0e2202b7f67c86a1dc5 (patch)
tree27d4e84a59b79c2f09db0980fdd8ff401a496a87
parentMerge branch 'bug/execdict' (diff)
parentCheck length for Strchop() (diff)
downloadw3m-f59b4a57d87fdaf4a7b0c0e2202b7f67c86a1dc5.tar.gz
w3m-f59b4a57d87fdaf4a7b0c0e2202b7f67c86a1dc5.zip
Merge branch 'bug/strchop'
Diffstat (limited to '')
-rw-r--r--Str.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Str.c b/Str.c
index e5a0982..eff82a4 100644
--- a/Str.c
+++ b/Str.c
@@ -278,8 +278,8 @@ void
Strchop(Str s)
{
STR_LENGTH_CHECK(s);
- while ((s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r') &&
- s->length > 0) {
+ while (s->length > 0 &&
+ (s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r')) {
s->length--;
}
s->ptr[s->length] = '\0';