summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2010-10-27 08:35:46 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2010-10-27 08:35:46 +0000
commit2601576aec3b2fbcb07e244861f10f37dd690af5 (patch)
tree153ec26a9fab6aef8167693ae2965868291540aa /usr.bin/cvs
parentcb930948e3f68cd7d22e2a415ccbd3b34fb5223b (diff)
Merge -k and expand @@ parsing code between OpenCVS and OpenRCS, resulting
in a performance gain in OpenCVS in some "cvs update" scenarios. ok zinovik
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/rcs.c24
-rw-r--r--usr.bin/cvs/update.c6
2 files changed, 11 insertions, 19 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index ebffcca0445..84adf7d7be3 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.305 2010/10/20 19:53:53 tobias Exp $ */
+/* $OpenBSD: rcs.c,v 1.306 2010/10/27 08:35:45 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1404,7 +1404,10 @@ rcs_kwexp_set(RCSFILE *file, int mode)
int
rcs_kwexp_get(RCSFILE *file)
{
- return rcs_kflag_get(file->rf_expand);
+ if (file->rf_expand == NULL)
+ return (RCS_KWEXP_DEFAULT);
+
+ return (rcs_kflag_get(file->rf_expand));
}
/*
@@ -1421,13 +1424,10 @@ rcs_kflag_get(const char *flags)
size_t len;
const char *fp;
- if (flags == NULL)
- return 0;
+ if (flags == NULL || !(len = strlen(flags)))
+ return (RCS_KWEXP_ERR);
fl = 0;
- if (!(len = strlen(flags)))
- return RCS_KWEXP_ERR;
-
for (fp = flags; *fp != '\0'; fp++) {
if (*fp == 'k')
fl |= RCS_KWEXP_NAME;
@@ -2068,10 +2068,7 @@ rcs_rev_getbuf(RCSFILE *rfp, RCSNUM *rev, int mode)
bp = buf_alloc(1024 * 16);
if (!(mode & RCS_KWEXP_NONE)) {
- if (rfp->rf_expand != NULL)
- expmode = rcs_kwexp_get(rfp);
- else
- expmode = RCS_KWEXP_DEFAULT;
+ expmode = rcs_kwexp_get(rfp);
if (!(expmode & RCS_KWEXP_NONE)) {
if ((rdp = rcs_findrev(rfp, rev)) == NULL)
@@ -2123,10 +2120,7 @@ rcs_rev_write_fd(RCSFILE *rfp, RCSNUM *rev, int _fd, int mode)
lines = rcs_rev_getlines(rfp, rev, NULL);
if (!(mode & RCS_KWEXP_NONE)) {
- if (rfp->rf_expand != NULL)
- expmode = rcs_kwexp_get(rfp);
- else
- expmode = RCS_KWEXP_DEFAULT;
+ expmode = rcs_kwexp_get(rfp);
if (!(expmode & RCS_KWEXP_NONE)) {
if ((rdp = rcs_findrev(rfp, rev)) == NULL)
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 2623495577b..031783e7e47 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.164 2010/09/29 18:14:52 nicm Exp $ */
+/* $OpenBSD: update.c,v 1.165 2010/10/27 08:35:45 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -580,7 +580,6 @@ update_has_conflict_markers(struct cvs_file *cf)
void
update_join_file(struct cvs_file *cf)
{
- int flag;
time_t told;
RCSNUM *rev1, *rev2;
const char *state1, *state2;
@@ -688,8 +687,7 @@ update_join_file(struct cvs_file *cf)
goto out;
}
- flag = rcs_kwexp_get(cf->file_rcs);
- if (flag & RCS_KWEXP_NONE) {
+ if (rcs_kwexp_get(cf->file_rcs) & RCS_KWEXP_NONE) {
cvs_printf("non-mergable file: %s needs merge!\n",
cf->file_path);
goto out;