From 5089d4a559eb3a0a0f008ad00ba8c5ed8bbc94c6 Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Tue, 29 Dec 2015 23:15:01 +0100 Subject: fix compiler warnings in hurd/utils utils: Fix compiler warnings. * utils/rpcscan.c (setup_extract_target): Remove name variable. * utils/rpcscan.c (setup_extract_target): Fix bad initializer. * utils/rpctrace.c (new_send_wrapper, wrap_all_threads, wrap_new_thread, wrap_new_task, traced_spawn): Fix format strings. * utils/rpctrace.c (trace_and_forward): Cast to unsigned int. * utils/rpctrace.c (trace_and_forward): Use memcmp instead of pointer dereferencing to compare structures. * utils/rpctrace.c (wrap_all_threads): Cast to vm_address_t. * utils/rpctrace.c (main): Fix bad initializer. * utils/shd.c (run): Initialize save0. * utils/vminfo.c: Fix format strings. * utils/vmstat.c: Remove PSEP macro and expand the code. * utils/w.c (add_utmp_procs): Remove unused pos variable. --- utils/vmstat.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'utils/vmstat.c') diff --git a/utils/vmstat.c b/utils/vmstat.c index 92a36726..bdd1d812 100644 --- a/utils/vmstat.c +++ b/utils/vmstat.c @@ -477,10 +477,6 @@ main (int argc, char **argv) ? size_units \ : ((field)->type == PAGESZ ? 0 : state.vmstats.pagesize)) - /* Prints SEP if the variable FIRST is 0, otherwise, prints START (if - it's non-zero), and sets first to 0. */ -#define PSEP(sep, start) \ - (first ? (first = 0, (start && fputs (start, stdout))) : fputs (sep, stdout)) #define PVAL(val, field, width, sign) \ print_val (val, (field)->type, SIZE_UNITS (field), width, sign) /* Intuit the likely maximum field width of FIELD. */ @@ -539,7 +535,13 @@ main (int argc, char **argv) const_fields &= ~(1 << (field - fields)); else { - PSEP (", ", "("); + if (first) + { + first = 0; + fputs("(", stdout); + } + else + fputs(",", stdout); printf ("%s: ", field->name); PVAL (val, field, 0, 0); } @@ -570,7 +572,10 @@ main (int argc, char **argv) for (field = fields, num = 0, first = 1; field->name; field++, num++) if (output_fields & (1 << (field - fields))) { - PSEP (" ", 0); + if (first) + first = 0; + else + fputs (" ", stdout); fprintf (stdout, "%*s", fwidths[num], field->hdr); } putchar ('\n'); @@ -601,7 +606,10 @@ main (int argc, char **argv) val -= vm_state_get_field (&prev_state, field); } - PSEP (" ", 0); + if (first) + first = 0; + else + fputs (" ", stdout); PVAL (val, field, fwidths[num], sign); } } -- cgit v1.2.3