diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-03-24 13:34:28 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-03-24 13:34:28 +0000 |
commit | 41913ef29fbfeb6b3ba30ac53350ad9ca1edbb28 (patch) | |
tree | 6069986b659019c22b0312cef6f3c327310ebe9a /usr.bin | |
parent | 1f6bc076e36bb3fccad1c8ca90ac8df8b0a0db31 (diff) |
Remove unused variables, better integer types, prevent fallthroughs.
Found by lint.
Compare char * variables against NULL for consistency and add
parentheses around complicated comparisons, suggested by xsa@.
OK xsa@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/admin.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/checkout.c | 7 | ||||
-rw-r--r-- | usr.bin/cvs/diff.c | 28 |
3 files changed, 14 insertions, 24 deletions
diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c index 1c88aa96ad8..a5f750749f9 100644 --- a/usr.bin/cvs/admin.c +++ b/usr.bin/cvs/admin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: admin.c,v 1.30 2006/03/16 09:06:19 xsa Exp $ */ +/* $OpenBSD: admin.c,v 1.31 2006/03/24 13:34:27 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005 Joris Vink <joris@openbsd.org> @@ -322,6 +322,7 @@ cvs_admin_remote(CVSFILE *cf, void *arg) case CVS_FST_MODIFIED: cvs_sendreq(root, CVS_REQ_MODIFIED, cf->cf_name); cvs_sendfile(root, fpath); + break; default: break; } diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index c2f43325b1e..fff1e30859b 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.50 2006/01/31 13:55:20 xsa Exp $ */ +/* $OpenBSD: checkout.c,v 1.51 2006/03/24 13:34:27 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -92,7 +92,6 @@ static int cvs_checkout_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg) { int ch; - RCSNUM *rcs; date = tag = koptstr = tgtdir = rcsid = NULL; @@ -164,11 +163,11 @@ cvs_checkout_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg) /* `export' command exceptions */ if (cvs_cmdop == CVS_OP_EXPORT) { - if (!tag && !date) + if ((tag == NULL) && (date == NULL)) fatal("must specify a tag or date"); /* we don't want numerical revisions here */ - if (tag && (rcs = rcsnum_parse(tag)) != NULL) + if ((tag != NULL) && (rcsnum_parse(tag) != NULL)) fatal("tag `%s' must be a symbolic tag", tag); } diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index b0efc566423..82ed5468edb 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.81 2006/03/23 13:09:09 xsa Exp $ */ +/* $OpenBSD: diff.c,v 1.82 2006/03/24 13:34:27 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -337,7 +337,6 @@ struct cvs_cmd cvs_cmd_rdiff = { #if !defined(RCSPROG) static struct diff_arg *dap = NULL; -static int recurse; static int cvs_diff_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg) @@ -367,7 +366,6 @@ cvs_diff_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg) break; case 'l': strlcat(diffargs, " -l", sizeof(diffargs)); - recurse = 0; cvs_cmd_diff.file_flags &= ~CF_RECURSE; break; case 'i': @@ -472,8 +470,7 @@ cvs_diff_pre_exec(struct cvsroot *root) static int cvs_diff_remote(struct cvs_file *cfp, void *arg) { - char *dir, *repo; - char fpath[MAXPATHLEN], dfpath[MAXPATHLEN]; + char fpath[MAXPATHLEN]; struct cvsroot *root; if (cfp->cf_type == DT_DIR) { @@ -503,15 +500,10 @@ cvs_diff_remote(struct cvs_file *cfp, void *arg) diff_file = cvs_file_getpath(cfp, fpath, sizeof(fpath)); - if (cfp->cf_parent != NULL) { - dir = cvs_file_getpath(cfp->cf_parent, dfpath, sizeof(dfpath)); + if (cfp->cf_parent != NULL) root = cfp->cf_parent->cf_root; - repo = cfp->cf_parent->cf_repo; - } else { - dir = "."; + else root = NULL; - repo = NULL; - } if (cfp->cf_cvstat == CVS_FST_UNKNOWN) { cvs_sendreq(root, CVS_REQ_QUESTIONABLE, cfp->cf_name); @@ -535,21 +527,18 @@ cvs_diff_remote(struct cvs_file *cfp, void *arg) static int cvs_diff_local(CVSFILE *cf, void *arg) { - char *repo, buf[64]; + char buf[64]; char fpath[MAXPATHLEN], rcspath[MAXPATHLEN]; char path_tmp1[MAXPATHLEN], path_tmp2[MAXPATHLEN]; BUF *b1, *b2; RCSNUM *r1, *r2; RCSFILE *rf; - struct cvsroot *root; struct timeval tv[2], tv2[2]; memset(&tv, 0, sizeof(tv)); memset(&tv2, 0, sizeof(tv2)); rf = NULL; - root = CVS_DIR_ROOT(cf); - repo = CVS_DIR_REPO(cf); diff_file = cvs_file_getpath(cf, fpath, sizeof(fpath)); if (cf->cf_type == DT_DIR) { @@ -1372,7 +1361,8 @@ proceed: static void fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) { - int i, j, c, lastc, col, nc; + long j, nc; + int i, c, col; /* * When doing #ifdef's, copy down to current line @@ -1412,7 +1402,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) diff_output(" "); } col = 0; - for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { + for (j = 0; j < nc; j++) { if ((c = getc(lb)) == EOF) { if (diff_format == D_RCSDIFF) cvs_log(LP_WARN, @@ -1500,7 +1490,7 @@ static int asciifile(FILE *f) { char buf[BUFSIZ]; - int i, cnt; + size_t i, cnt; if ((aflag == 1) || (f == NULL)) return (1); |