Fix more lint problems.

This commit is contained in:
christos 2005-07-16 19:50:32 +00:00
parent ed7ae36357
commit 41d3ce981c

View File

@ -1,4 +1,4 @@
/* $NetBSD: pkill.c,v 1.11 2005/07/16 16:20:35 christos Exp $ */ /* $NetBSD: pkill.c,v 1.12 2005/07/16 19:50:32 christos Exp $ */
/*- /*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: pkill.c,v 1.11 2005/07/16 16:20:35 christos Exp $"); __RCSID("$NetBSD: pkill.c,v 1.12 2005/07/16 19:50:32 christos Exp $");
#endif /* !lint */ #endif /* !lint */
#include <sys/types.h> #include <sys/types.h>
@ -244,7 +244,7 @@ main(int argc, char **argv)
* Allocate memory which will be used to keep track of the * Allocate memory which will be used to keep track of the
* selection. * selection.
*/ */
if ((selected = calloc(1, nproc)) == NULL) if ((selected = calloc((size_t)1, (size_t)nproc)) == NULL)
err(STATUS_ERROR, "Cannot allocate memory for %d processes", err(STATUS_ERROR, "Cannot allocate memory for %d processes",
nproc); nproc);
@ -253,7 +253,7 @@ main(int argc, char **argv)
*/ */
for (; *argv != NULL; argv++) { for (; *argv != NULL; argv++) {
if ((rv = regcomp(&reg, *argv, cflags)) != 0) { if ((rv = regcomp(&reg, *argv, cflags)) != 0) {
regerror(rv, &reg, buf, sizeof(buf)); (void)regerror(rv, &reg, buf, sizeof(buf));
errx(STATUS_BADUSAGE, errx(STATUS_BADUSAGE,
"Cannot compile regular expression `%s' (%s)", "Cannot compile regular expression `%s' (%s)",
*argv, buf); *argv, buf);
@ -288,7 +288,7 @@ main(int argc, char **argv)
} else } else
selected[i] = 1; selected[i] = 1;
} else if (rv != REG_NOMATCH) { } else if (rv != REG_NOMATCH) {
regerror(rv, &reg, buf, sizeof(buf)); (void)regerror(rv, &reg, buf, sizeof(buf));
errx(STATUS_ERROR, errx(STATUS_ERROR,
"Regular expression evaluation error (%s)", "Regular expression evaluation error (%s)",
buf); buf);
@ -384,7 +384,7 @@ main(int argc, char **argv)
} }
} }
(void)memset(selected, 0, nproc); (void)memset(selected, 0, (size_t)nproc);
if (bestidx != -1) if (bestidx != -1)
selected[bestidx] = 1; selected[bestidx] = 1;
} }
@ -407,7 +407,7 @@ main(int argc, char **argv)
rv |= (*action)(kp); rv |= (*action)(kp);
} }
exit(rv ? STATUS_MATCH : STATUS_NOMATCH); return rv ? STATUS_MATCH : STATUS_NOMATCH;
} }
static void static void
@ -514,6 +514,7 @@ makelist(struct listhead *head, enum listtype type, char *src)
break; break;
case LT_TTY: case LT_TTY:
usage(); usage();
/*NOTREACHED*/
default: default:
break; break;
} }