diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-06-25 17:28:01 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-06-25 17:28:01 +0000 |
commit | eb6f7b4d0070223320a03e2d2aa5f8233add9b48 (patch) | |
tree | 890ccd2baef7006ea610f78d06342cd1d0af99d8 | |
parent | 03e24ebd61add479731484628a49928297e26fb3 (diff) |
o remove useless cast to int from gzread() call
o maxPatternLen should be size_t since that's what it is compared against
o remove useless casts of NULL to various pointer types
-rw-r--r-- | usr.bin/grep/binary.c | 4 | ||||
-rw-r--r-- | usr.bin/grep/grep.c | 16 | ||||
-rw-r--r-- | usr.bin/grep/grep.h | 5 | ||||
-rw-r--r-- | usr.bin/grep/util.c | 4 |
4 files changed, 15 insertions, 14 deletions
diff --git a/usr.bin/grep/binary.c b/usr.bin/grep/binary.c index 076cad484d7..8ea47a6316e 100644 --- a/usr.bin/grep/binary.c +++ b/usr.bin/grep/binary.c @@ -1,4 +1,4 @@ -/* $OpenBSD: binary.c,v 1.6 2003/06/25 04:03:47 tedu Exp $ */ +/* $OpenBSD: binary.c,v 1.7 2003/06/25 17:28:00 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -64,7 +64,7 @@ gzbin_file(gzFile *f) if (gzseek(f, 0L, SEEK_SET) == -1) return 0; - if ((m = (int)gzread(f, buf, BUFFER_SIZE)) == 0) + if ((m = gzread(f, buf, BUFFER_SIZE)) == 0) return 0; for (i = 0; i < m; i++) diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index c43d98f2c24..0f703123d9b 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.16 2003/06/24 18:45:30 tedu Exp $ */ +/* $OpenBSD: grep.c,v 1.17 2003/06/25 17:28:00 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -95,7 +95,7 @@ int first; /* flag whether or not this is our first match */ int tail; /* lines left to print */ int lead; /* number of lines in leading context queue */ int boleol; /* At least one pattern has a bol or eol */ -int maxPatternLen; /* Longest length of all patterns */ +size_t maxPatternLen; /* Longest length of all patterns */ extern char *__progname; @@ -261,28 +261,28 @@ main(int argc, char *argv[]) } while ((c = getopt_long(argc, argv, optstr, - long_options, (int *)NULL)) != -1) { + long_options, NULL)) != -1) { switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': tmp = argv[optind - 1]; if (tmp[0] == '-' && tmp[1] == c && !tmp[2]) - Aflag = Bflag = strtol(++tmp, (char **)NULL, 10); + Aflag = Bflag = strtol(++tmp, NULL, 10); else Aflag = Bflag = strtol(argv[optind] + 1, - (char **)NULL, 10); + NULL, 10); break; case 'A': - Aflag = strtol(optarg, (char **)NULL, 10); + Aflag = strtol(optarg, NULL, 10); break; case 'B': - Bflag = strtol(optarg, (char **)NULL, 10); + Bflag = strtol(optarg, NULL, 10); break; case 'C': if (optarg == NULL) Aflag = Bflag = 2; else - Aflag = Bflag = strtol(optarg, (char **)NULL, 10); + Aflag = Bflag = strtol(optarg, NULL, 10); break; case 'E': Fflag = Gflag = 0; diff --git a/usr.bin/grep/grep.h b/usr.bin/grep/grep.h index 249961a74c0..cc163e820f1 100644 --- a/usr.bin/grep/grep.h +++ b/usr.bin/grep/grep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.h,v 1.6 2003/06/25 15:02:36 millert Exp $ */ +/* $OpenBSD: grep.h,v 1.7 2003/06/25 17:28:00 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -66,7 +66,8 @@ extern int Aflag, Bflag, Eflag, Fflag, Gflag, Hflag, Lflag, Pflag, Sflag, Rflag, Zflag, bflag, cflag, hflag, iflag, lflag, nflag, qflag, sflag, vflag, wflag, xflag; -extern int binbehave, boleol, maxPatternLen; +extern int binbehave, boleol; +extern size_t maxPatternLen; extern int first, lead, matchall, patterns, tail; extern char **pattern; diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 04fe878bac4..a94b2d602ca 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.10 2003/06/25 05:31:11 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.11 2003/06/25 17:28:00 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -70,7 +70,7 @@ grep_tree(char **argv) fts_flags |= FTS_NOSTAT | FTS_NOCHDIR; - if (!(fts = fts_open(argv, fts_flags, (int (*) ()) NULL))) + if (!(fts = fts_open(argv, fts_flags, NULL))) err(1, NULL); while ((p = fts_read(fts)) != NULL) { switch (p->fts_info) { |