summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-05-29 00:19:11 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-05-29 00:19:11 +0000
commitc5f0f50dae49c13e66ed1ad97606a14435d0c1d9 (patch)
tree14a0fe05a641971be935db072bd71113510f8361 /usr.bin
parent04f22301b1591dc3ad7bd6d58fc5515fbe615cab (diff)
Since xrealloc dies on failure it is safe to directly assign to the
original pointer. Theo agrees, and so does the rest of the tree (ssh, etc. all do this already). Saves a bunch of variables and assignments. OK niallo@
Diffstat (limited to 'usr.bin')
-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
-rw-r--r--usr.bin/rcs/buf.c7
-rw-r--r--usr.bin/rcs/diff.c33
-rw-r--r--usr.bin/rcs/diff3.c30
-rw-r--r--usr.bin/rcs/rcs.c7
-rw-r--r--usr.bin/rcs/rcsnum.c14
-rw-r--r--usr.bin/rcs/rcsutil.c6
12 files changed, 66 insertions, 128 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;
diff --git a/usr.bin/rcs/buf.c b/usr.bin/rcs/buf.c
index 40aeac46c0f..6e8b36c0808 100644
--- a/usr.bin/rcs/buf.c
+++ b/usr.bin/rcs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.12 2007/02/27 07:59:13 xsa Exp $ */
+/* $OpenBSD: buf.c,v 1.13 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -393,9 +393,6 @@ rcs_buf_write_stmp(BUF *b, char *template)
static void
rcs_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/rcs/diff.c b/usr.bin/rcs/diff.c
index ce9186ed6b8..d690956963b 100644
--- a/usr.bin/rcs/diff.c
+++ b/usr.bin/rcs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.16 2007/05/28 23:02:40 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.17 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -298,7 +298,6 @@ rcs_diffreg(const char *file1, const char *file2, BUF *out, int flags)
{
FILE *f1, *f2;
int i, rval;
- void *tmp;
f1 = f2 = NULL;
rval = D_SAME;
@@ -364,13 +363,11 @@ rcs_diffreg(const char *file1, const char *file2, BUF *out, int flags)
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;
@@ -383,17 +380,14 @@ rcs_diffreg(const char *file1, const char *file2, BUF *out, int flags)
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, flags);
output(f1, f2, flags);
@@ -441,7 +435,6 @@ files_differ(FILE *f1, FILE *f2)
static int
prepare(int i, FILE *fd, off_t filesize, int flags)
{
- void *tmp;
struct line *p;
int j, h;
size_t sz;
@@ -456,8 +449,7 @@ prepare(int i, FILE *fd, off_t filesize, int flags)
for (j = 0; (h = readhash(fd, flags));) {
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;
}
@@ -592,13 +584,12 @@ stone(int *a, int n, int *b, int *c, int flags)
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;
@@ -939,12 +930,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/rcs/diff3.c b/usr.bin/rcs/diff3.c
index 7792fc962d9..cbe476f17ee 100644
--- a/usr.bin/rcs/diff3.c
+++ b/usr.bin/rcs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.20 2007/02/27 07:59:13 xsa Exp $ */
+/* $OpenBSD: diff3.c,v 1.21 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.20 2007/02/27 07:59:13 xsa Exp $";
+ "$OpenBSD: diff3.c,v 1.21 2007/05/29 00:19:10 ray Exp $";
#endif /* not lint */
#include <ctype.h>
@@ -632,12 +632,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';
@@ -929,25 +927,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/rcs/rcs.c b/usr.bin/rcs/rcs.c
index 549aeb9f407..b26c19c1801 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.37 2007/05/17 03:33:24 ray Exp $ */
+/* $OpenBSD: rcs.c,v 1.38 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -2532,11 +2532,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/rcs/rcsnum.c b/usr.bin/rcs/rcsnum.c
index 34d2327a2b7..a3eb31987be 100644
--- a/usr.bin/rcs/rcsnum.c
+++ b/usr.bin/rcs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.6 2007/05/12 17:33:05 ray Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.7 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -214,7 +214,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)
@@ -234,9 +233,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;
}
@@ -297,9 +295,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++;
}
@@ -396,9 +393,6 @@ 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/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index f23279e4678..2dff77b1d21 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.29 2007/02/27 07:59:13 xsa Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.30 2007/05/29 00:19:10 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -595,7 +595,6 @@ rcs_strsplit(const char *str, const char *sep)
{
struct rcs_argvector *av;
size_t i = 0;
- char **nargv;
char *cp, *p;
cp = xstrdup(str);
@@ -605,9 +604,8 @@ rcs_strsplit(const 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;