summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/buf.c4
-rw-r--r--usr.bin/cvs/buf.h4
-rw-r--r--usr.bin/cvs/diff.c24
-rw-r--r--usr.bin/cvs/diff3.c23
-rw-r--r--usr.bin/cvs/rcs.c26
5 files changed, 41 insertions, 40 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c
index 74614a18062..29c7bc1c85f 100644
--- a/usr.bin/cvs/buf.c
+++ b/usr.bin/cvs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.39 2006/03/23 08:50:41 xsa Exp $ */
+/* $OpenBSD: buf.c,v 1.40 2006/03/25 21:29:58 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -246,7 +246,7 @@ cvs_buf_putc(BUF *b, int c)
*
*/
u_char
-cvs_buf_getc(BUF *b, u_int pos)
+cvs_buf_getc(BUF *b, size_t pos)
{
return (b->cb_cur[pos]);
}
diff --git a/usr.bin/cvs/buf.h b/usr.bin/cvs/buf.h
index f91af7bebed..78fed232823 100644
--- a/usr.bin/cvs/buf.h
+++ b/usr.bin/cvs/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.12 2006/03/23 08:50:41 xsa Exp $ */
+/* $OpenBSD: buf.h,v 1.13 2006/03/25 21:29:59 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -49,7 +49,7 @@ BUF *cvs_buf_alloc(size_t, u_int);
BUF *cvs_buf_load(const char *, u_int);
void cvs_buf_free(BUF *);
void *cvs_buf_release(BUF *);
-u_char cvs_buf_getc(BUF *, u_int);
+u_char cvs_buf_getc(BUF *, size_t);
void cvs_buf_empty(BUF *);
ssize_t cvs_buf_copy(BUF *, size_t, void *, size_t);
ssize_t cvs_buf_set(BUF *, const void *, size_t, size_t);
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 82ed5468edb..f4f6d2d935c 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.82 2006/03/24 13:34:27 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.83 2006/03/25 21:29:59 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -172,7 +172,7 @@ static int cvs_diff_pre_exec(struct cvsroot *);
static int cvs_diff_cleanup(void);
#endif
-static void output(const char *, FILE *, const char *, FILE *);
+static void output(FILE *, FILE *);
static void check(FILE *, FILE *);
static void range(int, int, char *);
static void uni_range(int, int);
@@ -183,8 +183,7 @@ static void prune(void);
static void equiv(struct line *, int, struct line *, int, int *);
static void unravel(int);
static void unsort(struct line *, int, int *);
-static void change(const char *, FILE *, const char *, FILE *, int,
- int, int, int);
+static void change(FILE *, FILE *, int, int, int, int);
static void sort(struct line *, int);
static int ignoreline(char *);
static int asciifile(FILE *);
@@ -745,7 +744,7 @@ cvs_diffreg(const char *file1, const char *file2, BUF *out)
tmp = xrealloc(ixnew, (diff_len[1] + 2) * sizeof(long));
ixnew = (long *)tmp;
check(f1, f2);
- output(file1, f1, file2, f2);
+ output(f1, f2);
closem:
if (anychange == 1) {
@@ -966,9 +965,9 @@ search(int *c, int k, int y)
return (k + 1);
i = 0;
j = k + 1;
- while (1) {
- l = i + j;
- if ((l >>= 1) <= i)
+ for (;;) {
+ l = (i + j) / 2;
+ if (l <= i)
break;
t = clist[c[l]].y;
if (t > y)
@@ -1155,7 +1154,7 @@ skipline(FILE *f)
}
static void
-output(const char *file1, FILE *f1, const char *file2, FILE *f2)
+output(FILE *f1, FILE *f2)
{
int m, i0, i1, j0, j1;
@@ -1173,10 +1172,10 @@ output(const char *file1, FILE *f1, const char *file2, FILE *f2)
i1++;
j1 = J[i1 + 1] - 1;
J[i1] = j1;
- change(file1, f1, file2, f2, i0, i1, j0, j1);
+ change(f1, f2, i0, i1, j0, j1);
}
if (m == 0)
- change(file1, f1, file2, f2, 1, 0, 1, diff_len[1]);
+ change(f1, f2, 1, 0, 1, diff_len[1]);
if (diff_format == D_IFDEF) {
for (;;) {
#define c i0
@@ -1246,8 +1245,7 @@ ignoreline(char *line)
* lines missing from the to file.
*/
static void
-change(const char *file1, FILE *f1, const char *file2, FILE *f2,
- int a, int b, int c, int d)
+change(FILE *f1, FILE *f2, int a, int b, int c, int d)
{
static size_t max_context = 64;
int i;
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c
index 1e4e19866c0..128a6782188 100644
--- a/usr.bin/cvs/diff3.c
+++ b/usr.bin/cvs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.19 2006/03/16 08:32:34 xsa Exp $ */
+/* $OpenBSD: diff3.c,v 1.20 2006/03/25 21:29:59 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -72,7 +72,7 @@ static const char copyright[] =
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: diff3.c,v 1.19 2006/03/16 08:32:34 xsa Exp $";
+ "$OpenBSD: diff3.c,v 1.20 2006/03/25 21:29:59 ray Exp $";
#endif /* not lint */
#include "includes.h"
@@ -140,10 +140,10 @@ static int edit(struct diff *, int, int);
static char *getchange(FILE *);
static char *getline(FILE *, size_t *);
static int number(char **);
-static int readin(char *, struct diff **);
+static size_t readin(char *, struct diff **);
static int skip(int, int, char *);
static int edscript(int);
-static int merge(int, int);
+static int merge(size_t, size_t);
static void change(int, struct range *, int);
static void keep(int, struct range *);
static void prange(struct range *);
@@ -271,7 +271,8 @@ out:
static int
diff3_internal(int argc, char **argv, const char *fmark, const char *rmark)
{
- int i, m, n;
+ size_t m, n;
+ int i;
/* XXX */
eflag = 3;
@@ -402,7 +403,7 @@ ed_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines)
* since the vector is processed in one sequential pass.
* The vector could be optimized out of existence)
*/
-static int
+static size_t
readin(char *name, struct diff **dd)
{
int a, b, c, d;
@@ -499,7 +500,7 @@ getline(FILE *b, size_t *n)
}
static int
-merge(int m1, int m2)
+merge(size_t m1, size_t m2)
{
struct diff *d1, *d2, *d3;
int dpl, j, t1, t2;
@@ -510,10 +511,10 @@ merge(int m1, int m2)
while ((t1 = d1 < d13 + m1) | (t2 = d2 < d23 + m2)) {
if (debug) {
printf("%d,%d=%d,%d %d,%d=%d,%d\n",
- d1->old.from,d1->old.to,
- d1->new.from,d1->new.to,
- d2->old.from,d2->old.to,
- d2->new.from,d2->new.to);
+ d1->old.from, d1->old.to,
+ d1->new.from, d1->new.to,
+ d2->old.from, d2->old.to,
+ d2->new.from, d2->new.to);
}
/* first file is different from others */
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 7c3a2c205af..33bdcb4357b 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.146 2006/03/24 16:18:22 xsa Exp $ */
+/* $OpenBSD: rcs.c,v 1.147 2006/03/25 21:29:59 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1429,7 +1429,7 @@ rcs_kwexp_set(RCSFILE *file, int mode)
tmp = xstrdup(buf);
if (file->rf_expand != NULL)
- free(file->rf_expand);
+ xfree(file->rf_expand);
file->rf_expand = tmp;
/* not synced anymore */
file->rf_flags &= ~RCS_SYNCED;
@@ -1688,7 +1688,7 @@ rcs_parse_admin(RCSFILE *rfp)
if (tok == RCS_TOK_ERR) {
rcs_errno = RCS_ERR_PARSE;
cvs_log(LP_ERR, "parse error in RCS admin section");
- return (-1);
+ goto fail;
} else if ((tok == RCS_TOK_NUM) || (tok == RCS_TOK_DESC)) {
/*
* Assume this is the start of the first delta or
@@ -1707,7 +1707,7 @@ rcs_parse_admin(RCSFILE *rfp)
if (hmask & (1 << tok)) {
rcs_errno = RCS_ERR_PARSE;
cvs_log(LP_ERR, "duplicate RCS key");
- return (-1);
+ goto fail;
}
hmask |= (1 << tok);
@@ -1736,7 +1736,7 @@ rcs_parse_admin(RCSFILE *rfp)
rfp->rf_branch = rcsnum_alloc();
if (rcsnum_aton(RCS_TOKSTR(rfp), NULL,
rfp->rf_branch) < 0)
- return (-1);
+ goto fail;
} else if (tok == RCS_TOK_COMMENT) {
rfp->rf_comment = xstrdup(RCS_TOKSTR(rfp));
} else if (tok == RCS_TOK_EXPAND) {
@@ -1750,31 +1750,32 @@ rcs_parse_admin(RCSFILE *rfp)
cvs_log(LP_ERR,
"missing semi-colon after RCS `%s' key",
rk->rk_str);
- return (-1);
+ goto fail;
}
break;
case RCS_TOK_ACCESS:
if (rcs_parse_access(rfp) < 0)
- return (-1);
+ goto fail;
break;
case RCS_TOK_SYMBOLS:
if (rcs_parse_symbols(rfp) < 0)
- return (-1);
+ goto fail;
break;
case RCS_TOK_LOCKS:
if (rcs_parse_locks(rfp) < 0)
- return (-1);
+ goto fail;
break;
default:
rcs_errno = RCS_ERR_PARSE;
cvs_log(LP_ERR,
"unexpected token `%s' in RCS admin section",
RCS_TOKSTR(rfp));
- return (-1);
+ goto fail;
}
}
- return (0);
+fail:
+ return (-1);
}
/*
@@ -2512,8 +2513,9 @@ static char *
rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *data,
size_t len, int mode)
{
+ size_t i;
int kwtype, sizdiff;
- u_int i, j, found, start_offset, c_offset;
+ u_int j, found, start_offset, c_offset;
char *c, *kwstr, *start, *end, *tbuf;
char expbuf[256], buf[256];
struct tm *tb;