summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-01-10 10:09:28 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-01-10 10:09:28 +0000
commitf0d933a184564f8b5eb15fb3238d257cfa0b5597 (patch)
treedd662dec2919514fff0256da34dcd7ea20934242 /usr.bin
parent0f5cebe91fb780a119496047300ea893bae226c3 (diff)
xmalloc + memset -> xcalloc
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/entries.c5
-rw-r--r--usr.bin/cvs/file.c5
-rw-r--r--usr.bin/cvs/util.c11
3 files changed, 8 insertions, 13 deletions
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c
index 25b1fd75d75..c5550672303 100644
--- a/usr.bin/cvs/entries.c
+++ b/usr.bin/cvs/entries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entries.c,v 1.85 2007/11/11 10:06:52 tobias Exp $ */
+/* $OpenBSD: entries.c,v 1.86 2008/01/10 10:09:27 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -37,8 +37,7 @@ cvs_ent_open(const char *dir)
struct cvs_ent *ent;
struct cvs_ent_line *line;
- ep = (CVSENTRIES *)xmalloc(sizeof(*ep));
- memset(ep, 0, sizeof(*ep));
+ ep = (CVSENTRIES *)xcalloc(1, sizeof(*ep));
(void)xsnprintf(buf, sizeof(buf), "%s/%s", dir, CVS_PATH_ENTRIES);
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index df2aa365ae5..8a66d6f6023 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.206 2008/01/10 09:37:26 tobias Exp $ */
+/* $OpenBSD: file.c,v 1.207 2008/01/10 10:09:27 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -216,8 +216,7 @@ cvs_file_get_cf(const char *d, const char *f, int fd, int type)
for (p = rpath; p[0] == '.' && p[1] == '/';)
p += 2;
- cf = (struct cvs_file *)xmalloc(sizeof(*cf));
- memset(cf, 0, sizeof(*cf));
+ cf = (struct cvs_file *)xcalloc(1, sizeof(*cf));
cf->file_name = xstrdup(f);
cf->file_wd = xstrdup(d);
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index b3a8c30915f..fbf95c8b91e 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.123 2008/01/10 10:08:22 tobias Exp $ */
+/* $OpenBSD: util.c,v 1.124 2008/01/10 10:09:27 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -653,20 +653,17 @@ cvs_splitlines(u_char *data, size_t len)
struct cvs_lines *lines;
struct cvs_line *lp;
- lines = xmalloc(sizeof(*lines));
- memset(lines, 0, sizeof(*lines));
+ lines = xcalloc(1, sizeof(*lines));
TAILQ_INIT(&(lines->l_lines));
- lp = xmalloc(sizeof(*lp));
- memset(lp, 0, sizeof(*lp));
+ lp = xcalloc(1, sizeof(*lp));
TAILQ_INSERT_TAIL(&(lines->l_lines), lp, l_list);
p = c = data;
for (i = 0; i < len; i++) {
if (*p == '\n' || (i == len - 1)) {
tlen = p - c + 1;
- lp = xmalloc(sizeof(*lp));
- memset(lp, 0, sizeof(*lp));
+ lp = xcalloc(1, sizeof(*lp));
lp->l_line = c;
lp->l_len = tlen;
lp->l_lineno = ++(lines->l_nblines);