Explanation comment for complex casadm logic.
Different static analysis tools detects division by 0. To avoid reanalyzing this piece of code, explanation comment was added. Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
a48db4aadf
commit
488c76a8fc
@ -882,6 +882,10 @@ static int adjust_column_widths(struct view_t *this,
|
|||||||
|
|
||||||
for (i = 0 ; i != w ; ++i) {
|
for (i = 0 ; i != w ; ++i) {
|
||||||
int this_width = vector_get(&prv->col_w, i);
|
int this_width = vector_get(&prv->col_w, i);
|
||||||
|
/*
|
||||||
|
* This condition is exactly the same as in above loop, where
|
||||||
|
* above_avg_cols is incremented. So there is no risk of division by 0.
|
||||||
|
*/
|
||||||
if (this_width > avg_width) {
|
if (this_width > avg_width) {
|
||||||
int reduce_by = excess_width / above_avg_cols;
|
int reduce_by = excess_width / above_avg_cols;
|
||||||
vector_set(&prv->col_w, i, this_width - reduce_by);
|
vector_set(&prv->col_w, i, this_width - reduce_by);
|
||||||
|
Loading…
Reference in New Issue
Block a user