From e0bd691bdf3f1ce19dcebfe46d830a0fc408e3d5 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 7 Feb 2012 21:32:32 -0600 Subject: Iterative cleanups on cmp.c: silence warnings, only free if TOYBOX_FREE, use xopen(), style cleanup on curly brackets. --- toys/cmp.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'toys') diff --git a/toys/cmp.c b/toys/cmp.c index f1e980e7..0ee0ca7e 100644 --- a/toys/cmp.c +++ b/toys/cmp.c @@ -30,14 +30,13 @@ int get_fd(char *file) int fd; if (!strcmp(file,"-")) fd=0; - else if (0>(fd = open(file, O_RDONLY, 0))) { - perror_exit("%s", file); - } + else fd = xopen(file, O_RDONLY); return fd; } void do_cmp(int fd1, int fd2, char *file1, char *file2, char *buf1, char *buf2, - size_t size) { + size_t size) +{ int i, len1, len2, min_len; size_t byte_no = 1, line_no = 1; @@ -49,15 +48,13 @@ void do_cmp(int fd1, int fd2, char *file1, char *file2, char *buf1, char *buf2, for (i=0; i