summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-28 07:17:18 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-28 07:17:18 +0000
commitdf79e8f9180701a3da97251ad4b4e53c2c225595 (patch)
treece5826bf146f9c748042b2f9e454e78342a8b2d1 /usr.bin/cvs
parent42a222d063e9f2a25f4df603095f6c6680ea59fc (diff)
xmalloc(num * size) -> xcalloc(num, size)
asprintf -> xasprintf Remove asprintf check, which was non-portable anyway. ``okidoki'' xsa@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/diff.c10
-rw-r--r--usr.bin/cvs/req.c6
-rw-r--r--usr.bin/cvs/util.c4
3 files changed, 9 insertions, 11 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index c7579a0515e..98d37169df2 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.84 2006/03/28 02:13:44 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.85 2006/03/28 07:17:16 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -721,10 +721,10 @@ cvs_diffreg(const char *file1, const char *file2, BUF *out)
tmp = xrealloc(class, slen[0] + 2, sizeof(int));
class = (int *)tmp;
- klist = xmalloc((slen[0] + 2) * sizeof(int));
+ klist = xcalloc(slen[0] + 2, sizeof(int));
clen = 0;
clistlen = 100;
- clist = xmalloc(clistlen * sizeof(cand));
+ clist = xcalloc(clistlen, sizeof(cand));
if ((i = stone(class, slen[0], member, klist)) < 0)
goto closem;
@@ -801,7 +801,7 @@ prepare(int i, FILE *fd, off_t filesize)
if (sz < 100)
sz = 100;
- p = (struct line *)xmalloc((sz + 3) * sizeof(struct line));
+ p = (struct line *)xcalloc(sz + 3, sizeof(struct line));
for (j = 0; (h = readhash(fd));) {
if (j == (int)sz) {
sz = sz * 3 / 2;
@@ -1135,7 +1135,7 @@ unsort(struct line *f, int l, int *b)
{
int *a, i;
- a = (int *)xmalloc((l + 1) * sizeof(int));
+ a = (int *)xcalloc(l + 1, sizeof(int));
for (i = 1; i <= l; i++)
a[f[i].serial] = f[i].value;
for (i = 1; i <= l; i++)
diff --git a/usr.bin/cvs/req.c b/usr.bin/cvs/req.c
index 56a90eeb388..001a81a6fe8 100644
--- a/usr.bin/cvs/req.c
+++ b/usr.bin/cvs/req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: req.c,v 1.42 2006/01/27 12:56:28 xsa Exp $ */
+/* $OpenBSD: req.c,v 1.43 2006/03/28 07:17:17 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -485,10 +485,8 @@ cvs_req_argument(int reqid, char *line)
if (cvs_req_nargs == 0)
cvs_log(LP_WARN, "no argument to append to");
else {
- asprintf(&nap, "%s%s", cvs_req_args[cvs_req_nargs - 1],
+ xasprintf(&nap, "%s%s", cvs_req_args[cvs_req_nargs - 1],
line);
- if (nap == NULL)
- fatal("cvs_req_argument: asprintf failed");
xfree(cvs_req_args[cvs_req_nargs - 1]);
cvs_req_args[cvs_req_nargs - 1] = nap;
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index a11d84bc0c3..2a5c611fee5 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.74 2006/03/28 02:13:44 ray Exp $ */
+/* $OpenBSD: util.c,v 1.75 2006/03/28 07:17:17 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -1063,7 +1063,7 @@ cvs_strsplit(char *str, const char *sep)
cp = xstrdup(str);
av = xmalloc(sizeof(struct cvs_argvector));
av->str = cp;
- av->argv = (char **)xmalloc((i+1) * sizeof(char *));
+ av->argv = (char **)xcalloc(i + 1, sizeof(char *));
while ((p = strsep(&cp, sep)) != NULL) {
av->argv[i++] = p;