summaryrefslogtreecommitdiff
path: root/usr.bin/tsort
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2002-05-17 05:11:07 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2002-05-17 05:11:07 +0000
commit47bca8b02cf7a0e85f952078ac29699abfd0891a (patch)
treecf78d7652b64bccf0e61a4cef6f041a454a5bc4c /usr.bin/tsort
parent03083777d91b03f227eaa9003c00d29751c35249 (diff)
downloadsrc-test-47bca8b02cf7a0e85f952078ac29699abfd0891a.tar.gz
src-test-47bca8b02cf7a0e85f952078ac29699abfd0891a.zip
Clean up malloc(3)'s argument. Remove casts which do nothing when we're
using sizeof() anyway. Use slightly more consistent (per-file) error reporting for malloc(3) returning NULL. If "malloc failed" was being printed, don't use err(3). If a NULL format is being used, use err(3). In one case errx(3) was being used with strerror(3), so just use err(3).
Notes
Notes: svn path=/head/; revision=96785
Diffstat (limited to 'usr.bin/tsort')
-rw-r--r--usr.bin/tsort/tsort.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c
index 2a6a1322158c7..1c71b40fd3e63 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);
}