diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-05-31 18:24:56 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-05-31 18:24:56 +0000 |
commit | fb94c9d6329f2abaa8916326ec5f05caeedd42a6 (patch) | |
tree | ad442ce7aa1f46dfe7db70f326d41cdbeb759435 /usr.bin | |
parent | d6e54419256d595a027d46ec89765f9bcbc15445 (diff) |
be smarter when comparing 2 revisions to each other.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/rcsnum.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/usr.bin/cvs/rcsnum.c b/usr.bin/cvs/rcsnum.c index c6185704025..69fc51adbf1 100644 --- a/usr.bin/cvs/rcsnum.c +++ b/usr.bin/cvs/rcsnum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsnum.c,v 1.37 2006/05/27 03:30:31 joris Exp $ */ +/* $OpenBSD: rcsnum.c,v 1.38 2006/05/31 18:24:55 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -175,12 +175,15 @@ rcsnum_cpy(const RCSNUM *nsrc, RCSNUM *ndst, u_int depth) * two numbers. */ int -rcsnum_cmp(const RCSNUM *n1, const RCSNUM *n2, u_int depth) +rcsnum_cmp(RCSNUM *n1, RCSNUM *n2, u_int depth) { int res; u_int i; size_t slen; + if (!rcsnum_differ(n1, n2)) + return (0); + slen = MIN(n1->rn_len, n2->rn_len); if (depth != 0 && slen > depth) slen = depth; @@ -403,3 +406,20 @@ rcsnum_setsize(RCSNUM *num, u_int len) num->rn_id = tmp; num->rn_len = len; } + +int +rcsnum_differ(RCSNUM *r1, RCSNUM *r2) +{ + int i, len; + + if (r1->rn_len != r2->rn_len) + return (1); + + len = MIN(r1->rn_len, r2->rn_len); + for (i = 0; i < len; i++) { + if (r1->rn_id[i] != r2->rn_id[i]) + return (1); + } + + return (0); +} |