← Commit list

87b49beed

Denys Vlasenko
Denys Vlasenko
2018-12-14
SUCCESS Duration: 151s

Subject

bc: tweak bc_num_parseDecimal() for readability, logic is not changed

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

miscutils/bc.c+3 -3
@@ -2334,13 +2334,13 @@ static void bc_num_parseDecimal(BcNum *n, const char *val)
n->num[n->len] = val[i] - '0';
++n->len;
skip_dot:
- if ((ssize_t)--i == (ssize_t)-1) break;
- if (val[i] == '.') goto skip_dot;
+ if (i == 0) break;
+ if (val[--i] == '.') goto skip_dot;
}
break;
}
}
- // if this is reached, the value is entirely zero
+ // if for() exits without hitting if(), the value is entirely zero
}
// Note: n is already "bc_num_zero()"ed,