diff options
author | Jason Schulz <jason@schulz.name> | 2016-01-25 23:43:29 -0800 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-01-26 09:15:25 -0500 |
commit | 1937c6e480d20d6f7b00c9eb11f16678ce35e14a (patch) | |
tree | 1b6f8160a2fa23699bd63d120ed6aaf34ff5fe6b | |
parent | 45b378259ebc66530cfa2a3fdb2504f17a185a22 (diff) | |
download | rneovim-1937c6e480d20d6f7b00c9eb11f16678ce35e14a.tar.gz rneovim-1937c6e480d20d6f7b00c9eb11f16678ce35e14a.tar.bz2 rneovim-1937c6e480d20d6f7b00c9eb11f16678ce35e14a.zip |
vim_str2nr: cleanup #4104
Fixes unused assignments found by clang-scan.
-rw-r--r-- | src/nvim/charset.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 2a76983870..9c63eca1f2 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1791,7 +1791,6 @@ void vim_str2nr(char_u *start, int *prep, int *len, int pre = 0; // default is decimal int negative = false; unsigned long un = 0; - int n = 0; if (ptr[0] == '-') { negative = true; @@ -1818,7 +1817,7 @@ void vim_str2nr(char_u *start, int *prep, int *len, if (dooct) { // Don't interpret "0", "08" or "0129" as octal. - for (n = 1; ascii_isdigit(ptr[n]); ++n) { + for (int n = 1; ascii_isdigit(ptr[n]); ++n) { if (ptr[n] > '7') { // can't be octal pre = 0; @@ -1836,9 +1835,6 @@ void vim_str2nr(char_u *start, int *prep, int *len, // Do the string-to-numeric conversion "manually" to avoid sscanf quirks. if ((pre == 'B') || (pre == 'b') || (dobin > 1)) { // bin - if (pre != 0) { - n += 2; // skip over "0b" - } while ('0' <= *ptr && *ptr <= '1') { un = 2 * un + (unsigned long)(*ptr - '0'); ptr++; @@ -1849,11 +1845,8 @@ void vim_str2nr(char_u *start, int *prep, int *len, un = 8 * un + (unsigned long)(*ptr - '0'); ptr++; } - } else if (pre != 0 || dohex > 1) { + } else if ((pre == 'X') || (pre == 'x') || dohex > 1) { // hex - if (pre != 0) { - n += 2; // skip over "0x" - } while (ascii_isxdigit(*ptr)) { un = 16 * un + (unsigned long)hex2nr(*ptr); ptr++; |