diff options
author | 2005-12-24 04:10:51 +0000 | |
---|---|---|
committer | 2005-12-24 04:10:51 +0000 | |
commit | ecfb32e086223d04e2cb7e17612b38a236036e08 (patch) | |
tree | effa94b9a34adc529e94c05f404f1540249cc750 | |
parent | we should be calling cvs_vlog(); to at least get some decent output; (diff) | |
download | wireguard-openbsd-ecfb32e086223d04e2cb7e17612b38a236036e08.tar.xz wireguard-openbsd-ecfb32e086223d04e2cb7e17612b38a236036e08.zip |
remove useless cvs_buf_alloc() failure checks;
-rw-r--r-- | usr.bin/cvs/buf.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/diff3.c | 15 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/util.c | 9 |
4 files changed, 12 insertions, 26 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index a06d5083213..cca18065e43 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.24 2005/12/23 00:27:04 joris Exp $ */ +/* $OpenBSD: buf.c,v 1.25 2005/12/24 04:10:51 joris Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -112,9 +112,7 @@ cvs_buf_load(const char *path, u_int flags) if (fstat(fd, &st) == -1) fatal("cvs_buf_load: fstat: %s", strerror(errno)); - if ((buf = cvs_buf_alloc((size_t)st.st_size, flags)) == NULL) - fatal("cvs_buf_load: cvs_buf_alloc failed"); - + buf = cvs_buf_alloc((size_t)st.st_size, flags); for (bp = buf->cb_cur; ; bp += (size_t)ret) { len = SIZE_LEFT(buf); ret = read(fd, bp, len); diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c index f7939d85c64..3800ed09d6f 100644 --- a/usr.bin/cvs/diff3.c +++ b/usr.bin/cvs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.9 2005/12/20 18:17:01 xsa Exp $ */ +/* $OpenBSD: diff3.c,v 1.10 2005/12/24 04:10:51 joris Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -71,7 +71,7 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diff3.c,v 1.9 2005/12/20 18:17:01 xsa Exp $"; +static const char rcsid[] = "$OpenBSD: diff3.c,v 1.10 2005/12/24 04:10:51 joris Exp $"; #endif /* not lint */ #include <sys/queue.h> @@ -187,14 +187,9 @@ cvs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2) if ((b3 = rcs_getrev(rf, rev2)) == NULL) goto out; - if ((d1 = cvs_buf_alloc((size_t)128, BUF_AUTOEXT)) == NULL) - goto out; - - if ((d2 = cvs_buf_alloc((size_t)128, BUF_AUTOEXT)) == NULL) - goto out; - - if ((diffb = cvs_buf_alloc((size_t)128, BUF_AUTOEXT)) == NULL) - goto out; + d1 = cvs_buf_alloc((size_t)128, BUF_AUTOEXT); + d2 = cvs_buf_alloc((size_t)128, BUF_AUTOEXT); + diffb = cvs_buf_alloc((size_t)128, BUF_AUTOEXT); strlcpy(path1, "/tmp/diff1.XXXXXXXXXX", sizeof(path1)); cvs_buf_write_stmp(b1, path1, 0600); diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index a23fc84b9dc..9a56fa3b5ea 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.115 2005/12/22 02:26:33 niallo Exp $ */ +/* $OpenBSD: rcs.c,v 1.116 2005/12/24 04:10:51 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -1245,9 +1245,8 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) cvs_buf_empty(rbuf); return (rbuf); } - if ((rbuf = cvs_buf_alloc(len, BUF_AUTOEXT)) == NULL) - return (NULL); + rbuf = cvs_buf_alloc(len, BUF_AUTOEXT); cvs_buf_append(rbuf, rdp->rd_text, len); if (res != 0) { @@ -1282,8 +1281,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) expmode = RCS_KWEXP_DEFAULT; if ((rbuf != NULL) && !(expmode & RCS_KWEXP_NONE)) { - if ((dbuf = cvs_buf_alloc(len, BUF_AUTOEXT)) == NULL) - return (rbuf); + dbuf = cvs_buf_alloc(len, BUF_AUTOEXT); if ((rdp = rcs_findrev(rfp, rev)) == NULL) return (rbuf); diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index 1513008e468..11565ea828f 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.61 2005/12/22 14:31:44 xsa Exp $ */ +/* $OpenBSD: util.c,v 1.62 2005/12/24 04:10:51 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -963,13 +963,8 @@ cvs_patchfile(const char *data, const char *patch, return (NULL); } - if ((res = cvs_buf_alloc(len, BUF_AUTOEXT)) == NULL) { - cvs_freelines(dlines); - cvs_freelines(plines); - return (NULL); - } - lineno = 0; + res = cvs_buf_alloc(len, BUF_AUTOEXT); TAILQ_FOREACH(lp, &dlines->l_lines, l_list) { if (lineno != 0) cvs_buf_fappend(res, "%s\n", lp->l_line); |