On Fri, Nov 28, 2014 at 04:14:50PM +0100, Otto Moerbeek wrote: > On Sun, Nov 23, 2014 at 05:19:16PM +0100, Fritjof Bornebusch wrote: > > > Hi tech, > > > > like the XXX comment says, rcsnum_cmp() can be used instead of a *for* loop. > > The following shows the original behavior: > > > > $ co -r1.2 foo.txt,v > > foo.txt,v --> foo.txt > > revision 1.2 > > done > > > > $ co -r1.1 foo.txt,v > > foo.txt,v --> foo.txt > > revision 1.1 > > done > > > > $ co foo.txt,v > > foo.txt,v --> foo.txt > > revision 1.2 > > done > > > > The following shows the changed behavior: > > > > $ co -r1.2 foo.txt,v > > foo.txt,v --> foo.txt > > revision 1.2 > > done > > > > $ co -r1.1 foo.txt,v > > foo.txt,v --> foo.txt > > revision 1.1 > > done > > > > $ co foo.txt,v > > foo.txt,v --> foo.txt > > revision 1.2 > > done > > > > Could some verify that I didn't miss a test case. > > Hmm, your examples show no diffference. I think the intention is to > not change the behaviour, right? >
Yes.
But as Tobias mentioned the behaviour will change anyway using my diff.
I'm checking out the official GnuRCS version regarding this right now.
> -Otto
>
fritjof
> >
> > fritjof
> >
> > Index: co.c
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/rcs/co.c,v
> > retrieving revision 1.119
> > diff -u -p -r1.119 co.c
> > --- co.c 10 Oct 2014 08:15:25 -0000 1.119
> > +++ co.c 23 Nov 2014 15:40:30 -0000
> > @@ -265,18 +265,14 @@ checkout_rev(RCSFILE *file, RCSNUM *frev
> > (void)fprintf(stderr,
> > "no revisions present; generating empty revision 0.0\n");
> >
> > - /* XXX rcsnum_cmp()
> > + /*
> > * Check out the latest revision if <frev> is greater than HEAD
> > */
> > if (file->rf_ndelta != 0) {
> > - for (i = 0; i < file->rf_head->rn_len; i++) {
> > - if (file->rf_head->rn_id[i] < frev->rn_id[i]) {
> > - frev = file->rf_head;
> > - break;
> > - }
> > - }
> > + if (rcsnum_cmp(file->rf_head, frev, 0) == 1)
> > + frev = file->rf_head;
> > }
> > -
> > +
> > lcount = 0;
> > TAILQ_FOREACH(lkp, &(file->rf_locks), rl_list) {
> > if (!strcmp(lkp->rl_name, lockname))
> >
> >
> > Index: rcs.c
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/rcs/rcs.c,v
> > retrieving revision 1.81
> > diff -u -p -r1.81 rcs.c
> > --- rcs.c 10 Oct 2014 08:15:25 -0000 1.81
> > +++ rcs.c 23 Nov 2014 15:56:58 -0000
> > @@ -905,16 +905,15 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
> > else
> > rev = frev;
> >
> > - /* XXX rcsnum_cmp() */
> > - for (i = 0; i < rfp->rf_head->rn_len; i++) {
> > - if (rfp->rf_head->rn_id[i] < rev->rn_id[i]) {
> > - rcs_errno = RCS_ERR_NOENT;
> > - return (NULL);
> > - }
> > + if(rcsnum_cmp(rfp->rf_head, rev, 0) == 1) {
> > + rcs_errno = RCS_ERR_NOENT;
> > + return (NULL);
> > }
> > -
> > - /* No matter what, we'll need everything parsed up until the description
> > - so go for it. */
> > +
> > + /*
> > + * No matter what, we'll need everything parsed up until the description
> > + * so go for it.
> > + */
> > if (rcsparse_deltas(rfp, NULL))
> > return (NULL);
> >
>
>
pgpZD2UEfcOPl.pgp
Description: PGP signature
