misc: eliminate a couple of miscellaneous gcc warnings

This commit just address the two warnings shown below.

Reference(s):
pgrep.c: In function `select_procs':
pgrep.c:535:12: warning: variable `now' set but not used [-Wunused-but-set-variable]
  535 |     time_t now;
      |            ^~~

pidof.c: In function `select_procs':
pidof.c:201:9: warning: `stat_cmd' may be used uninitialized in this function [-Wmaybe-uninitialized]
  201 |        !strcmp(program, stat_cmd) ||
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2020-06-28 00:00:00 -05:00 committed by Craig Small
parent 97458da808
commit c8864e8010
2 changed files with 0 additions and 6 deletions

View File

@ -529,12 +529,10 @@ static struct el * select_procs (int *num)
char *cmdoutput = xmalloc(cmdlen);
char *task_cmdline;
enum pids_fetch_type which;
time_t now;
double uptime_secs;
preg = do_regcomp();
now = time(NULL);
if (procps_uptime(&uptime_secs, NULL) < 0)
xerrx(EXIT_FAILURE, "uptime");

View File

@ -145,7 +145,6 @@ static void select_procs (void)
static int size = 0;
char *cmd_arg0, *cmd_arg0base;
char *cmd_arg1, *cmd_arg1base;
char *stat_cmd;
char *program_base;
char *root_link;
char *exe_link;
@ -196,9 +195,6 @@ static void select_procs (void)
if (!strcmp(program, cmd_arg0base) ||
!strcmp(program_base, cmd_arg0) ||
!strcmp(program, cmd_arg0) ||
!strcmp(program, stat_cmd) ||
!strcmp(program, exe_link_base) ||
!strcmp(program, exe_link))
{