summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/find/function.c18
-rw-r--r--usr.bin/finger/util.c4
-rw-r--r--usr.bin/last/last.c10
-rw-r--r--usr.bin/paste/paste.c4
-rw-r--r--usr.bin/tset/map.c2
-rw-r--r--usr.bin/tsort/tsort.c10
6 files changed, 24 insertions, 24 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 7153891..3bb9271 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -601,20 +601,20 @@ c_exec(option, argvp)
errx(1, "%s: no command specified", option->name);
cnt = ap - *argvp + 1;
- if ((new->e_argv = malloc((u_int)cnt * sizeof(char *))) == NULL)
- err(1, (char *)NULL);
- if ((new->e_orig = malloc((u_int)cnt * sizeof(char *))) == NULL)
- err(1, (char *)NULL);
- if ((new->e_len = malloc((u_int)cnt * sizeof(int))) == NULL)
- err(1, (char *)NULL);
+ if ((new->e_argv = malloc(cnt * sizeof(char *))) == NULL)
+ err(1, NULL);
+ if ((new->e_orig = malloc(cnt * sizeof(char *))) == NULL)
+ err(1, NULL);
+ if ((new->e_len = malloc(cnt * sizeof(int))) == NULL)
+ err(1, NULL);
for (argv = *argvp, cnt = 0; argv < ap; ++argv, ++cnt) {
new->e_orig[cnt] = *argv;
for (p = *argv; *p; ++p)
if (p[0] == '{' && p[1] == '}') {
if ((new->e_argv[cnt] =
- malloc((u_int)MAXPATHLEN)) == NULL)
- err(1, (char *)NULL);
+ malloc(MAXPATHLEN)) == NULL)
+ err(1, NULL);
new->e_len[cnt] = MAXPATHLEN;
break;
}
@@ -1210,7 +1210,7 @@ f_regex(plan, entry)
FTSENT *entry;
{
char *str;
- size_t len;
+ int len;
regex_t *pre;
regmatch_t pmatch;
int errcode;
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
index 218b1bf..ec8df2e 100644
--- a/usr.bin/finger/util.c
+++ b/usr.bin/finger/util.c
@@ -244,7 +244,7 @@ palloc()
{
PERSON *p;
- if ((p = malloc((u_int) sizeof(PERSON))) == NULL)
+ if ((p = malloc(sizeof(PERSON))) == NULL)
err(1, NULL);
return(p);
}
@@ -255,7 +255,7 @@ walloc(pn)
{
WHERE *w;
- if ((w = malloc((u_int) sizeof(WHERE))) == NULL)
+ if ((w = malloc(sizeof(WHERE))) == NULL)
err(1, NULL);
if (pn->whead == NULL)
pn->whead = pn->wtail = w;
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index 5029a05..41e2492 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -290,7 +290,7 @@ doentry(bp)
/* add new one */
tt = malloc(sizeof(struct ttytab));
if (tt == NULL)
- err(1, "malloc failure");
+ errx(1, "malloc failure");
tt->logout = currentout;
strncpy(tt->tty, bp->ut_line, UT_LINESIZE);
LIST_INSERT_HEAD(&ttylist, tt, list);
@@ -418,8 +418,8 @@ addarg(type, arg)
{
ARG *cur;
- if (!(cur = (ARG *)malloc((u_int)sizeof(ARG))))
- err(1, "malloc failure");
+ if ((cur = malloc(sizeof(ARG))) == NULL)
+ errx(1, "malloc failure");
cur->next = arglist;
cur->type = type;
cur->name = arg;
@@ -468,8 +468,8 @@ ttyconv(arg)
*/
if (strlen(arg) == 2) {
/* either 6 for "ttyxx" or 8 for "console" */
- if (!(mval = malloc((u_int)8)))
- err(1, "malloc failure");
+ if ((mval = malloc(8)) == NULL)
+ errx(1, "malloc failure");
if (!strcmp(arg, "co"))
(void)strcpy(mval, "console");
else {
diff --git a/usr.bin/paste/paste.c b/usr.bin/paste/paste.c
index a910a36..ea75288 100644
--- a/usr.bin/paste/paste.c
+++ b/usr.bin/paste/paste.c
@@ -122,8 +122,8 @@ parallel(char **argv)
char buf[_POSIX2_LINE_MAX + 1];
for (cnt = 0, head = NULL; (p = *argv); ++argv, ++cnt) {
- if (!(lp = (LIST *)malloc((u_int)sizeof(LIST))))
- errx(1, "%s", strerror(ENOMEM));
+ if ((lp = malloc(sizeof(LIST))) == NULL)
+ err(1, NULL);
if (p[0] == '-' && !p[1])
lp->fp = stdin;
else if (!(lp->fp = fopen(p, "r")))
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c
index 3d6a7c1..a86d7c4 100644
--- a/usr.bin/tset/map.c
+++ b/usr.bin/tset/map.c
@@ -83,7 +83,7 @@ add_mapping(port, arg)
char *copy, *p, *termp;
copy = strdup(arg);
- mapp = malloc((u_int)sizeof(MAP));
+ mapp = malloc(sizeof(MAP));
if (copy == NULL || mapp == NULL)
errx(1, "malloc");
mapp->next = NULL;
diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c
index 2a6a132..1c71b40 100644
--- a/usr.bin/tsort/tsort.c
+++ b/usr.bin/tsort/tsort.c
@@ -106,7 +106,7 @@ int debug, longest, quiet;
void add_arc(char *, char *);
int find_cycle(NODE *, NODE *, int, int);
NODE *get_node(char *);
-void *grow_buf(void *, int);
+void *grow_buf(void *, size_t);
void remove_node(NODE *);
void clear_cycle(void);
void tsort(void);
@@ -192,9 +192,9 @@ main(argc, argv)
void *
grow_buf(bp, size)
void *bp;
- int size;
+ size_t size;
{
- if ((bp = realloc(bp, (u_int)size)) == NULL)
+ if ((bp = realloc(bp, size)) == NULL)
err(1, NULL);
return (bp);
}
@@ -335,8 +335,8 @@ tsort()
*/
for (cnt = 0, n = graph; n != NULL; n = n->n_next)
++cnt;
- cycle_buf = malloc((u_int)sizeof(NODE *) * cnt);
- longest_cycle = malloc((u_int)sizeof(NODE *) * cnt);
+ cycle_buf = malloc(sizeof(NODE *) * cnt);
+ longest_cycle = malloc(sizeof(NODE *) * cnt);
if (cycle_buf == NULL || longest_cycle == NULL)
err(1, NULL);
}
OpenPOWER on IntegriCloud