strings: Fix PVS/V547: condition already checked by surrounding if

This commit is contained in:
ZyX
2018-04-22 20:05:32 +03:00
parent b9b17a58da
commit 0eaecbaf47

View File

@@ -1376,16 +1376,14 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap,
}
// insert zero padding as requested by precision or min field width
if (number_of_zeros_to_pad > 0) {
size_t zn = number_of_zeros_to_pad;
if (str_avail) {
size_t avail = str_m - str_l;
memset(str + str_l, '0', MIN(zn, avail));
str_avail = zn < avail;
}
assert(zn <= SIZE_MAX - str_l);
str_l += zn;
size_t zn = number_of_zeros_to_pad;
if (str_avail) {
size_t avail = str_m - str_l;
memset(str + str_l, '0', MIN(zn, avail));
str_avail = zn < avail;
}
assert(zn <= SIZE_MAX - str_l);
str_l += zn;
}
// insert formatted string