From 936de9a6e61cfc4e5fcf477517660eed5e3f2ada Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Mon, 10 Oct 2005 14:16:04 +0000 Subject: use rd_next in rcs_getrev() when patching to get to a revision instead of just decrementing the revision number, as the previous revision doesn't always follow the current revision - 1 rule. ok niallo@ --- usr.bin/cvs/rcs.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'usr.bin/cvs') diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index ebbf57fa13a..34698f31855 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.83 2005/10/10 13:41:25 joris Exp $ */ +/* $OpenBSD: rcs.c,v 1.84 2005/10/10 14:16:03 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -1369,22 +1369,15 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) /* Apply patches backwards to get the right version. * This will need some rework to support sub branches. */ - if ((crev = rcsnum_alloc()) == NULL) { - cvs_buf_free(rbuf); - return (NULL); - } - rcsnum_cpy(rfp->rf_head, crev, 0); + crev = rdp->rd_next; do { - crev->rn_id[crev->rn_len - 1]--; rdp = rcs_findrev(rfp, crev); if (rdp == NULL) { - rcsnum_free(crev); cvs_buf_free(rbuf); return (NULL); } if (cvs_buf_putc(rbuf, '\0') < 0) { - rcsnum_free(crev); cvs_buf_free(rbuf); return (NULL); } @@ -1393,9 +1386,8 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) free(bp); if (rbuf == NULL) break; + crev = rdp->rd_next; } while (rcsnum_cmp(crev, rev, 0) != 0); - - rcsnum_free(crev); } /* -- cgit v1.2.3