From: Jim Warner Date: Fri, 12 May 2017 05:02:00 +0000 (-0500) Subject: misc: eliminate all those remaining gcc -Wall warnings X-Git-Tag: v4.0.0~726 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=618a813baaefc9d744575955abbf5df506db9636;p=procps-ng misc: eliminate all those remaining gcc -Wall warnings Reference(s): proc/readproc.c: In function 'statm2proc' proc/readproc.c:600:9: warning: variable 'num' set but not used [-Wunused-but-set-variable] proc/stat.c: In function 'stat_derive_unique': proc/stat.c:429:1: warning: no return statement in function returning non-void [-Wreturn-type] ps/parser.c: In function 'arg_type': ps/parser.c:1098:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] ps/parser.c:1099:34: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' lib/signals.c: In function 'strtosig': lib/signals.c:243:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation] lib/signals.c:245:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' slabtop.c: In function 'print_summary': slabtop.c:223:29: warning: unused variable 'stats' [-Wunused-variable] watch.c: In function 'process_ansi': watch.c:232:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation] watch.c:235:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' Signed-off-by: Jim Warner --- diff --git a/lib/signals.c b/lib/signals.c index a9d0ebb4..d85c1fd9 100644 --- a/lib/signals.c +++ b/lib/signals.c @@ -242,7 +242,7 @@ char *strtosig(const char *restrict s) numsignal = strtol(s,&endp,10); if(*endp || endp==s) free(p); - return NULL; /* not valid */ + return NULL; /* not valid */ } if (numsignal){ for (i = 0; i < number_of_signals; i++){ diff --git a/proc/readproc.c b/proc/readproc.c index a79be990..9f4bdb34 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -597,11 +597,9 @@ LEAVE(0x160); ///////////////////////////////////////////////////////////////////////// static void statm2proc(const char* s, proc_t *restrict P) { - int num; - num = sscanf(s, "%lu %lu %lu %lu %lu %lu %lu", + sscanf(s, "%lu %lu %lu %lu %lu %lu %lu", &P->size, &P->resident, &P->share, &P->trs, &P->lrs, &P->drs, &P->dt); -/* fprintf(stderr, "statm2proc converted %d fields.\n",num); */ } static int file2str(const char *directory, const char *what, struct utlbuf_s *ub) { diff --git a/proc/stat.c b/proc/stat.c index 84ce7c5e..34aeda4d 100644 --- a/proc/stat.c +++ b/proc/stat.c @@ -415,7 +415,7 @@ static inline void stat_cleanup_stacks_all ( } // end: stat_cleanup_stacks_all -static inline int stat_derive_unique ( +static inline void stat_derive_unique ( struct hist_tic *this) { /* note: we exclude guest tics from xtot since ... diff --git a/ps/parser.c b/ps/parser.c index d1373aab..bdfe5b43 100644 --- a/ps/parser.c +++ b/ps/parser.c @@ -1096,7 +1096,7 @@ static int arg_type(const char *str){ if((tmp>='a') && (tmp<='z')) return ARG_GNU; if((tmp>='A') && (tmp<='Z')) return ARG_GNU; if(tmp=='\0') return ARG_END; - return ARG_FAIL; + return ARG_FAIL; } /* First assume sysv, because that is the POSIX and Unix98 standard. */ diff --git a/slabtop.c b/slabtop.c index 7cc67252..8497d6c7 100644 --- a/slabtop.c +++ b/slabtop.c @@ -220,7 +220,6 @@ static void print_summary (void) tot_MIN, tot_AVG, tot_MAX }; struct slabinfo_stack *p; - struct slabinfo_result *stats; if (!(p = procps_slabinfo_select(Slab_info, items, MAXTBL(items)))) xerrx(EXIT_FAILURE, _("Error getting slab summary results")); diff --git a/watch.c b/watch.c index 40daa27d..017601df 100644 --- a/watch.c +++ b/watch.c @@ -232,8 +232,8 @@ static void process_ansi(FILE * fp) if (buf[0] == '\0') set_ansi_attribute(0); - for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) { - if (!set_ansi_attribute(strtol(numstart, &endptr, 10))) + for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) { + if (!set_ansi_attribute(strtol(numstart, &endptr, 10))) break; if (numstart == endptr) set_ansi_attribute(0); /* [m treated as [0m */