summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/commit.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-07-23 11:19:47 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-07-23 11:19:47 +0000
commit316e7b4ce9ddeaa9df048f14eb629be01439aa55 (patch)
treef4f74e1c0f91731e6481818a3caeac96f0c80c34 /usr.bin/cvs/commit.c
parent9cb789f35012b533e6bb67128d89a9154482620c (diff)
rewrite of the file code. the previous one was just
a mess and not clean. this code is much cleaner, faster, and uses less memory overall. tested by xsa@, brad@, Michael Knudsen, and myself. okay xsa@
Diffstat (limited to 'usr.bin/cvs/commit.c')
-rw-r--r--usr.bin/cvs/commit.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index a3d6286ed77..a269133e003 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.43 2005/07/23 00:03:00 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.44 2005/07/23 11:19:46 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -126,7 +126,7 @@ cvs_commit_pre_exec(struct cvsroot *root)
{
CVSFILE *cfp;
CVSFILE *tmp;
- int i, flags = CF_RECURSE | CF_IGNORE | CF_SORT;
+ int ret, i, flags = CF_RECURSE | CF_IGNORE | CF_SORT;
struct cvs_flist added, modified, removed, *cl[3];
int stattype[] = { CVS_FST_ADDED, CVS_FST_MODIFIED, CVS_FST_REMOVED };
@@ -138,26 +138,26 @@ cvs_commit_pre_exec(struct cvsroot *root)
cl[1] = &modified;
cl[2] = &removed;
+ if ((tmp = cvs_file_loadinfo(".", CF_NOFILES, NULL, NULL, 1)) == NULL)
+ return (CVS_EX_DATA);
+
/*
* Obtain the file lists for the logmessage.
*/
- tmp = NULL;
for (i = 0; i < 3; i++) {
- if (tmp != NULL)
- cvs_file_free(tmp);
-
wantedstatus = stattype[i];
-
if (commit_fcount != 0) {
- tmp = cvs_file_getspec(commit_files, commit_fcount,
- flags, cvs_commit_prepare, cl[i]);
+ ret = cvs_file_getspec(commit_files, commit_fcount,
+ flags, cvs_commit_prepare, cl[i], NULL);
} else {
- tmp = cvs_file_get(".", flags, cvs_commit_prepare,
- cl[i]);
+ ret = cvs_file_get(".", flags, cvs_commit_prepare,
+ cl[i], NULL);
}
- if (tmp == NULL)
+ if (ret != CVS_EX_OK) {
+ cvs_file_free(tmp);
return (CVS_EX_DATA);
+ }
}
/*