diff options
| author | Sebastian Schuberth <sschuberth@gmail.com> | 2011-09-09 09:32:39 +0200 |
|---|---|---|
| committer | Sebastian Schuberth <sschuberth@gmail.com> | 2011-09-12 22:22:59 +0200 |
| commit | 79a343968a4a91c98fae1afa61cdadc5b573c93d (patch) | |
| tree | dd0fdf25df109bac1053e171f5b9362f579dca44 /src/config_file.c | |
| parent | bac47f1ff8c6684671c67000c747a6b0a7f2c6dc (diff) | |
| download | libgit2-79a343968a4a91c98fae1afa61cdadc5b573c93d.tar.gz | |
Fix a bug and GCC warning introduced in 932669b
For unsigned types, the comparison >= 0 is always true, so avoid it by using
a post-decrement and integrating the initial assigment into the loop body.
No change in behavior is intended.
Diffstat (limited to 'src/config_file.c')
| -rw-r--r-- | src/config_file.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/config_file.c b/src/config_file.c index 7fb54a6c0..4515c593e 100644 --- a/src/config_file.c +++ b/src/config_file.c @@ -553,10 +553,8 @@ static char *cfg_readline(diskfile_backend *cfg) memcpy(line, line_src, line_len); - line[line_len] = '\0'; - - while (--line_len >= 0 && isspace(line[line_len])) - line[line_len] = '\0'; + do line[line_len] = '\0'; + while (line_len-- > 0 && isspace(line[line_len])); if (*line_end == '\n') line_end++; |
