mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
vim_str2nr: cleanup #4104
Fixes unused assignments found by clang-scan.
This commit is contained in:
parent
45b378259e
commit
1937c6e480
@ -1791,7 +1791,6 @@ void vim_str2nr(char_u *start, int *prep, int *len,
|
|||||||
int pre = 0; // default is decimal
|
int pre = 0; // default is decimal
|
||||||
int negative = false;
|
int negative = false;
|
||||||
unsigned long un = 0;
|
unsigned long un = 0;
|
||||||
int n = 0;
|
|
||||||
|
|
||||||
if (ptr[0] == '-') {
|
if (ptr[0] == '-') {
|
||||||
negative = true;
|
negative = true;
|
||||||
@ -1818,7 +1817,7 @@ void vim_str2nr(char_u *start, int *prep, int *len,
|
|||||||
|
|
||||||
if (dooct) {
|
if (dooct) {
|
||||||
// Don't interpret "0", "08" or "0129" as octal.
|
// 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') {
|
if (ptr[n] > '7') {
|
||||||
// can't be octal
|
// can't be octal
|
||||||
pre = 0;
|
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.
|
// Do the string-to-numeric conversion "manually" to avoid sscanf quirks.
|
||||||
if ((pre == 'B') || (pre == 'b') || (dobin > 1)) {
|
if ((pre == 'B') || (pre == 'b') || (dobin > 1)) {
|
||||||
// bin
|
// bin
|
||||||
if (pre != 0) {
|
|
||||||
n += 2; // skip over "0b"
|
|
||||||
}
|
|
||||||
while ('0' <= *ptr && *ptr <= '1') {
|
while ('0' <= *ptr && *ptr <= '1') {
|
||||||
un = 2 * un + (unsigned long)(*ptr - '0');
|
un = 2 * un + (unsigned long)(*ptr - '0');
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -1849,11 +1845,8 @@ void vim_str2nr(char_u *start, int *prep, int *len,
|
|||||||
un = 8 * un + (unsigned long)(*ptr - '0');
|
un = 8 * un + (unsigned long)(*ptr - '0');
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
} else if (pre != 0 || dohex > 1) {
|
} else if ((pre == 'X') || (pre == 'x') || dohex > 1) {
|
||||||
// hex
|
// hex
|
||||||
if (pre != 0) {
|
|
||||||
n += 2; // skip over "0x"
|
|
||||||
}
|
|
||||||
while (ascii_isxdigit(*ptr)) {
|
while (ascii_isxdigit(*ptr)) {
|
||||||
un = 16 * un + (unsigned long)hex2nr(*ptr);
|
un = 16 * un + (unsigned long)hex2nr(*ptr);
|
||||||
ptr++;
|
ptr++;
|
||||||
|
Loading…
Reference in New Issue
Block a user