mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-18 08:47:00 +00:00
clean up: fix couple compiler warnings
src/sort.c:255:5: warning: no previous prototype for 'merge' src/sort.c:290:2: warning: ISO C90 forbids mixed declarations and code src/mustach-dhcpd-pools.c:67:5: warning: no previous prototype for 'must_put_err' src/output.c:109:26: warning: comparing floating point with == or != is unsafe (x5) Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
88a3f1eb53
commit
8fba5c5e6b
5 changed files with 27 additions and 24 deletions
29
src/output.c
29
src/output.c
|
|
@ -106,22 +106,21 @@ int shnet_output_helper(struct conf_t *state, struct output_helper_t *oh,
|
|||
{
|
||||
/* counts and calculations */
|
||||
oh->tc = shared_p->touched + shared_p->used;
|
||||
if (shared_p->available == 0) {
|
||||
if (fpclassify(shared_p->available) == FP_ZERO) {
|
||||
oh->percent = NAN;
|
||||
oh->tcp = NAN;
|
||||
oh->bup = NAN;
|
||||
} else {
|
||||
oh->percent = (double)(100 * shared_p->used) / shared_p->available;
|
||||
oh->tcp =
|
||||
(double)((100 * (shared_p->touched + shared_p->used)) / shared_p->available);
|
||||
if (state->backups_found == 1) {
|
||||
oh->bup = (double)(100 * shared_p->backups) / shared_p->available;
|
||||
}
|
||||
}
|
||||
/* set status */
|
||||
if (oh->percent == NAN)
|
||||
oh->status = STATUS_SUPPRESSED;
|
||||
else if (shared_p->available <= state->minsize)
|
||||
return 0;
|
||||
}
|
||||
|
||||
oh->percent = (double)(100 * shared_p->used) / shared_p->available;
|
||||
oh->tcp = (double)((100 * (shared_p->touched + shared_p->used)) / shared_p->available);
|
||||
if (state->backups_found == 1)
|
||||
oh->bup = (double)(100 * shared_p->backups) / shared_p->available;
|
||||
|
||||
/* set status */
|
||||
if (shared_p->available <= state->minsize)
|
||||
oh->status = STATUS_IGNORED;
|
||||
else if (state->critical < oh->percent && shared_p->used < state->crit_count)
|
||||
oh->status = STATUS_CRIT;
|
||||
|
|
@ -503,18 +502,18 @@ static int output_json(struct conf_t *state, const int print_mac_addreses)
|
|||
fprintf(outfile, "\"used\":%g, ", shared_p->used);
|
||||
fprintf(outfile, "\"touched\":%g, ", shared_p->touched);
|
||||
fprintf(outfile, "\"free\":%g, ", shared_p->available - shared_p->used);
|
||||
if (shared_p->available == 0)
|
||||
if (fpclassify(shared_p->available) == FP_ZERO)
|
||||
fprintf(outfile, "\"percent\":\"%g\", ", oh.percent);
|
||||
else
|
||||
fprintf(outfile, "\"percent\":%g, ", oh.percent);
|
||||
fprintf(outfile, "\"touch_count\":%g, ", oh.tc);
|
||||
if (shared_p->available == 0)
|
||||
if (fpclassify(shared_p->available) == FP_ZERO)
|
||||
fprintf(outfile, "\"touch_percent\":\"%g\", ", oh.tcp);
|
||||
else
|
||||
fprintf(outfile, "\"touch_percent\":%g, ", oh.tcp);
|
||||
if (state->backups_found == 1) {
|
||||
fprintf(outfile, "\"backup_count\":%g, ", shared_p->backups);
|
||||
if (shared_p->available == 0)
|
||||
if (fpclassify(shared_p->available) == FP_ZERO)
|
||||
fprintf(outfile, "\"backup_percent\":\"%g\", ", oh.bup);
|
||||
else
|
||||
fprintf(outfile, "\"backup_percent\":%g, ", oh.bup);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue