Remove the identical inner 'if' condition.
Use the %zu format specifier for size_t returned from strlen(),
according to: https://en.cppreference.com/w/c/string/byte/strlen
- Fixes the following Cppcheck warnings:
[src/rrd_cgi.c:349] (warning) Identical inner 'if' condition is
always true (outer condition is 'calcpr[i]' and inner condition is
'calcpr[i]'). [identicalInnerCondition]
[src/rrd_cgi.c:527] (portability) %zd in format string (no. 1)
requires 'ssize_t' but the argument type is 'size_t
{aka unsigned long}'. [invalidPrintfArgType_sint]
or
[src/rrd_cgi.c:527] (portability) %zd in format string (no. 1)
requires 'ssize_t' but the argument type is 'size_t
{aka unsigned long long}'. [invalidPrintfArgType_sint]
long i;
for (i = 0; calcpr[i]; i++) {
- if (calcpr[i]) {
- free(calcpr[i]);
- }
+ free(calcpr[i]);
}
if (calcpr) {
free(calcpr);
if (!filter) {
printf("Content-Type: text/html\n"
- "Content-Length: %zd\n", strlen(buffer));
+ "Content-Length: %zu\n", strlen(buffer));
if (labs(goodfor) > 0) {
time_t now;