diff options
author | Timo Teräs <timo.teras@iki.fi> | 2011-01-03 19:15:35 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2011-01-03 19:15:35 +0200 |
commit | 1f42cc1aed32ebf160db5e812d2f57e654042522 (patch) | |
tree | 69eb7f56dae5303178567b27234cdbfd3537c6bb /src/version.c | |
parent | 1c7e8d2617d93daac1fe0c38c0279435331bb152 (diff) | |
download | aports-1f42cc1aed32ebf160db5e812d2f57e654042522.tar.bz2 aports-1f42cc1aed32ebf160db5e812d2f57e654042522.tar.xz |
version: fix evaluation order to make valgrind happy
otherwise we get reads from uninitialized/unallocated memory.
Diffstat (limited to 'src/version.c')
-rw-r--r-- | src/version.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/version.c b/src/version.c index 2de886a9bd..15757bc216 100644 --- a/src/version.c +++ b/src/version.c @@ -85,7 +85,7 @@ static int get_token(int *type, apk_blob_t *blob) case TOKEN_DIGIT_OR_ZERO: /* Leading zero digits get a special treatment */ if (blob->ptr[i] == '0') { - while (blob->ptr[i] == '0' && i < blob->len) + while (i < blob->len && blob->ptr[i] == '0') i++; nt = TOKEN_DIGIT; v = -i; @@ -94,7 +94,7 @@ static int get_token(int *type, apk_blob_t *blob) case TOKEN_DIGIT: case TOKEN_SUFFIX_NO: case TOKEN_REVISION_NO: - while (isdigit(blob->ptr[i]) && i < blob->len) { + while (i < blob->len && isdigit(blob->ptr[i])) { v *= 10; v += blob->ptr[i++] - '0'; } |