summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/buf.c7
-rw-r--r--usr.bin/cvs/diff3.c30
-rw-r--r--usr.bin/cvs/diff_internals.c33
-rw-r--r--usr.bin/cvs/rcs.c7
-rw-r--r--usr.bin/cvs/rcsnum.c14
-rw-r--r--usr.bin/cvs/util.c6
6 files changed, 33 insertions, 64 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c
index a7d316c7ebc..acc0c1e5765 100644
--- a/usr.bin/cvs/buf.c
+++ b/usr.bin/cvs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.60 2007/02/22 06:42:09 otto Exp $ */
+/* $OpenBSD: buf.c,v 1.61 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -367,10 +367,7 @@ cvs_buf_write_stmp(BUF *b, char *template, struct timeval *tv)
static void
cvs_buf_grow(BUF *b, size_t len)
{
- void *tmp;
-
- tmp = xrealloc(b->cb_buf, 1, b->cb_size + len);
- b->cb_buf = tmp;
+ b->cb_buf = xrealloc(b->cb_buf, 1, b->cb_size + len);
b->cb_size += len;
}
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c
index 5f573c49ddf..3479f4f822e 100644
--- a/usr.bin/cvs/diff3.c
+++ b/usr.bin/cvs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.35 2007/02/22 06:42:09 otto Exp $ */
+/* $OpenBSD: diff3.c,v 1.36 2007/05/29 00:19:10 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.35 2007/02/22 06:42:09 otto Exp $";
+ "$OpenBSD: diff3.c,v 1.36 2007/05/29 00:19:10 ray Exp $";
#endif /* not lint */
#include <ctype.h>
@@ -492,12 +492,10 @@ getline(FILE *b, size_t *n)
if (cp[len - 1] != '\n')
len++;
if (len + 1 > bufsize) {
- char *newbuf;
do {
bufsize += 1024;
} while (len + 1 > bufsize);
- newbuf = xrealloc(buf, 1, bufsize);
- buf = newbuf;
+ buf = xrealloc(buf, 1, bufsize);
}
memcpy(buf, cp, len - 1);
buf[len - 1] = '\n';
@@ -789,25 +787,19 @@ edscript(int n)
static void
increase(void)
{
- struct diff *p;
- char *q;
size_t newsz, incr;
/* are the memset(3) calls needed? */
newsz = szchanges == 0 ? 64 : 2 * szchanges;
incr = newsz - szchanges;
- p = xrealloc(d13, newsz, sizeof(*d13));
- memset(p + szchanges, 0, incr * sizeof(*d13));
- d13 = p;
- p = xrealloc(d23, newsz, sizeof(*d23));
- memset(p + szchanges, 0, incr * sizeof(*d23));
- d23 = p;
- p = xrealloc(de, newsz, sizeof(*de));
- memset(p + szchanges, 0, incr * sizeof(*de));
- de = p;
- q = xrealloc(overlap, newsz, sizeof(*overlap));
- memset(q + szchanges, 0, incr * sizeof(*overlap));
- overlap = q;
+ d13 = xrealloc(d13, newsz, sizeof(*d13));
+ memset(d13 + szchanges, 0, incr * sizeof(*d13));
+ d23 = xrealloc(d23, newsz, sizeof(*d23));
+ memset(d23 + szchanges, 0, incr * sizeof(*d23));
+ de = xrealloc(de, newsz, sizeof(*de));
+ memset(de + szchanges, 0, incr * sizeof(*de));
+ overlap = xrealloc(overlap, newsz, sizeof(*overlap));
+ memset(overlap + szchanges, 0, incr * sizeof(*overlap));
szchanges = newsz;
}
diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c
index 89c851844c3..bb23118d6c2 100644
--- a/usr.bin/cvs/diff_internals.c
+++ b/usr.bin/cvs/diff_internals.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff_internals.c,v 1.8 2007/05/28 23:02:40 ray Exp $ */
+/* $OpenBSD: diff_internals.c,v 1.9 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -295,7 +295,6 @@ cvs_diffreg(const char *file1, const char *file2, BUF *out)
{
FILE *f1, *f2;
int i, rval;
- void *tmp;
f1 = f2 = NULL;
rval = D_SAME;
@@ -351,13 +350,11 @@ cvs_diffreg(const char *file1, const char *file2, BUF *out)
member = (int *)file[1];
equiv(sfile[0], slen[0], sfile[1], slen[1], member);
- tmp = xrealloc(member, slen[1] + 2, sizeof(*member));
- member = tmp;
+ member = xrealloc(member, slen[1] + 2, sizeof(*member));
class = (int *)file[0];
unsort(sfile[0], slen[0], class);
- tmp = xrealloc(class, slen[0] + 2, sizeof(*class));
- class = tmp;
+ class = xrealloc(class, slen[0] + 2, sizeof(*class));
klist = xcalloc(slen[0] + 2, sizeof(*klist));
clen = 0;
@@ -370,17 +367,14 @@ cvs_diffreg(const char *file1, const char *file2, BUF *out)
xfree(member);
xfree(class);
- tmp = xrealloc(J, diff_len[0] + 2, sizeof(*J));
- J = tmp;
+ J = xrealloc(J, diff_len[0] + 2, sizeof(*J));
unravel(klist[i]);
xfree(clist);
xfree(klist);
- tmp = xrealloc(ixold, diff_len[0] + 2, sizeof(*ixold));
- ixold = tmp;
+ ixold = xrealloc(ixold, diff_len[0] + 2, sizeof(*ixold));
- tmp = xrealloc(ixnew, diff_len[1] + 2, sizeof(*ixnew));
- ixnew = tmp;
+ ixnew = xrealloc(ixnew, diff_len[1] + 2, sizeof(*ixnew));
check(f1, f2);
output(f1, f2);
@@ -428,7 +422,6 @@ files_differ(FILE *f1, FILE *f2)
static int
prepare(int i, FILE *fd, off_t filesize)
{
- void *tmp;
struct line *p;
int j, h;
size_t sz;
@@ -443,8 +436,7 @@ prepare(int i, FILE *fd, off_t filesize)
for (j = 0; (h = readhash(fd));) {
if (j == (int)sz) {
sz = sz * 3 / 2;
- tmp = xrealloc(p, sz + 3, sizeof(*p));
- p = tmp;
+ p = xrealloc(p, sz + 3, sizeof(*p));
}
p[++j].value = h;
}
@@ -578,13 +570,12 @@ stone(int *a, int n, int *b, int *c)
static int
newcand(int x, int y, int pred)
{
- struct cand *q, *tmp;
+ struct cand *q;
int newclistlen;
if (clen == clistlen) {
newclistlen = clistlen * 11 / 10;
- tmp = xrealloc(clist, newclistlen, sizeof(*clist));
- clist = tmp;
+ clist = xrealloc(clist, newclistlen, sizeof(*clist));
clistlen = newclistlen;
}
q = clist + clen;
@@ -923,12 +914,10 @@ proceed:
* Allocate change records as needed.
*/
if (context_vec_ptr == context_vec_end - 1) {
- struct context_vec *tmp;
ptrdiff_t offset = context_vec_ptr - context_vec_start;
max_context <<= 1;
- tmp = xrealloc(context_vec_start, max_context,
- sizeof(*context_vec_start));
- context_vec_start = tmp;
+ context_vec_start = xrealloc(context_vec_start,
+ max_context, sizeof(*context_vec_start));
context_vec_end = context_vec_start + max_context;
context_vec_ptr = context_vec_start + offset;
}
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index b0e57cb7065..ebdcad29a2a 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.211 2007/05/26 20:58:36 niallo Exp $ */
+/* $OpenBSD: rcs.c,v 1.212 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -2359,11 +2359,10 @@ rcs_pushtok(RCSFILE *rfp, const char *tok, int type)
static void
rcs_growbuf(RCSFILE *rf)
{
- void *tmp;
struct rcs_pdata *pdp = (struct rcs_pdata *)rf->rf_pdata;
- tmp = xrealloc(pdp->rp_buf, 1, pdp->rp_blen + RCS_BUFEXTSIZE);
- pdp->rp_buf = tmp;
+ pdp->rp_buf = xrealloc(pdp->rp_buf, 1,
+ pdp->rp_blen + RCS_BUFEXTSIZE);
pdp->rp_blen += RCS_BUFEXTSIZE;
pdp->rp_bufend = pdp->rp_buf + pdp->rp_blen - 1;
}
diff --git a/usr.bin/cvs/rcsnum.c b/usr.bin/cvs/rcsnum.c
index 2682b8fdd6f..b4a25bb0265 100644
--- a/usr.bin/cvs/rcsnum.c
+++ b/usr.bin/cvs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.44 2007/05/26 00:36:04 krw Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.45 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -213,7 +213,6 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
{
u_int32_t val;
const char *sp;
- void *tmp;
char *s;
if (nump->rn_id == NULL)
@@ -233,9 +232,8 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
}
nump->rn_len++;
- tmp = xrealloc(nump->rn_id,
+ nump->rn_id = xrealloc(nump->rn_id,
nump->rn_len + 1, sizeof(*(nump->rn_id)));
- nump->rn_id = tmp;
nump->rn_id[nump->rn_len] = 0;
continue;
}
@@ -296,9 +294,8 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
/* We can't have a single-digit rcs number. */
if (nump->rn_len == 0) {
- tmp = xrealloc(nump->rn_id,
+ nump->rn_id = xrealloc(nump->rn_id,
nump->rn_len + 1, sizeof(*(nump->rn_id)));
- nump->rn_id = tmp;
nump->rn_id[nump->rn_len + 1] = 0;
nump->rn_len++;
}
@@ -395,10 +392,7 @@ rcsnum_brtorev(const RCSNUM *brnum)
static void
rcsnum_setsize(RCSNUM *num, u_int len)
{
- void *tmp;
-
- tmp = xrealloc(num->rn_id, len, sizeof(*(num->rn_id)));
- num->rn_id = tmp;
+ num->rn_id = xrealloc(num->rn_id, len, sizeof(*(num->rn_id)));
num->rn_len = len;
}
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 78f430dc8aa..a9b837f0c7f 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.110 2007/05/27 00:37:46 ray Exp $ */
+/* $OpenBSD: util.c,v 1.111 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -737,7 +737,6 @@ cvs_strsplit(char *str, const char *sep)
{
struct cvs_argvector *av;
size_t i = 0;
- char **nargv;
char *cp, *p;
cp = xstrdup(str);
@@ -747,9 +746,8 @@ cvs_strsplit(char *str, const char *sep)
while ((p = strsep(&cp, sep)) != NULL) {
av->argv[i++] = p;
- nargv = xrealloc(av->argv,
+ av->argv = xrealloc(av->argv,
i + 1, sizeof(*(av->argv)));
- av->argv = nargv;
}
av->argv[i] = NULL;