summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/file.c
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-04-05 01:38:57 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-04-05 01:38:57 +0000
commit0898160056a31f0981cae42f585dce85844d89b7 (patch)
tree2ab8437cd5dbf0558b5d3f90f54443694d8a7d53 /usr.bin/cvs/file.c
parent83701e885596de792fb8b058bf3e19ceb443a245 (diff)
Use variable names for sizeof, remove casts in front of xmalloc,
use xcalloc and xstrdup where appropriate, and other stuff. OK joris@
Diffstat (limited to 'usr.bin/cvs/file.c')
-rw-r--r--usr.bin/cvs/file.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 807d139b774..c2248ecdb91 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.135 2006/04/02 02:02:27 joris Exp $ */
+/* $OpenBSD: file.c,v 1.136 2006/04/05 01:38:55 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -162,7 +162,7 @@ cvs_file_ignore(const char *pat)
char *cp;
struct cvs_ignpat *ip;
- ip = (struct cvs_ignpat *)xmalloc(sizeof(*ip));
+ ip = xmalloc(sizeof(*ip));
strlcpy(ip->ip_pat, pat, sizeof(ip->ip_pat));
/* check if we will need globbing for that pattern */
@@ -1043,11 +1043,7 @@ cvs_file_sort(struct cvs_flist *flp, u_int nfiles)
size_t nb;
CVSFILE *cf, **cfvec;
- cfvec = (CVSFILE **)calloc((size_t)nfiles, sizeof(CVSFILE *));
- if (cfvec == NULL) {
- cvs_log(LP_ERRNO, "failed to allocate sorting vector");
- return (-1);
- }
+ cfvec = xcalloc((size_t)nfiles, sizeof(*cfvec));
i = 0;
SIMPLEQ_FOREACH(cf, flp, cf_list) {
@@ -1103,8 +1099,7 @@ cvs_file_alloc(const char *path, u_int type)
CVSFILE *cfp;
char *p;
- cfp = (CVSFILE *)xmalloc(sizeof(*cfp));
- memset(cfp, 0, sizeof(*cfp));
+ cfp = xcalloc(1, sizeof(*cfp));
cfp->cf_type = type;
cfp->cf_cvstat = CVS_FST_UNKNOWN;