cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/src ChangeLog rcs.c


From: Mark D. Baushke
Subject: [Cvs-cvs] ccvs/src ChangeLog rcs.c
Date: Tue, 09 May 2006 23:55:22 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Branch:         
Changes by:     Mark D. Baushke <address@hidden>        06/05/09 23:55:21

Modified files:
        src            : ChangeLog rcs.c 

Log message:
        Merge changes from 1.11.x.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ChangeLog.diff?tr1=1.3401&tr2=1.3402&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.c.diff?tr1=1.363&tr2=1.364&r1=text&r2=text

Patches:
Index: ccvs/src/ChangeLog
diff -u ccvs/src/ChangeLog:1.3401 ccvs/src/ChangeLog:1.3402
--- ccvs/src/ChangeLog:1.3401   Tue May  9 01:47:55 2006
+++ ccvs/src/ChangeLog  Tue May  9 23:55:21 2006
@@ -1,3 +1,14 @@
+2006-05-09  Mark D. Baushke  <address@hidden>
+
+       * rcs.c (findhighestmagicrev_proc): New function to find the
+       highest magic rev with the required number of dots.
+       (findnextmagicrev): New function to walk the symbolic tag list
+       calling findhighestmagicrev_proc() to find the next unused magic
+       branch revision.
+       (RCS_magicrev): Use findnextmagicrev().
+       (Patch suggested by "Kelly F. Hickel" <address@hidden> based
+       on advice from Larry Jones <address@hidden>.)
+
 2006-05-08  Derek Price  <address@hidden>
 
        * sign.c (gen_signature), verify.c (verify_signature): s/%a/%@/ &
Index: ccvs/src/rcs.c
diff -u ccvs/src/rcs.c:1.363 ccvs/src/rcs.c:1.364
--- ccvs/src/rcs.c:1.363        Tue Apr 25 14:02:14 2006
+++ ccvs/src/rcs.c      Tue May  9 23:55:21 2006
@@ -143,6 +143,8 @@
 static FILE *rcs_internal_lockfile (char *);
 static void rcs_internal_unlockfile (FILE *, char *);
 static char *rcs_lockfilename (const char *);
+static int findnextmagicrev (RCSNode *, char *, int);
+static int findhighestmagicrev_proc (Node *, void *);
 
 /* The RCS file reading functions are called a lot, and they do some
    string comparisons.  This macro speeds things up a bit by skipping
@@ -2516,6 +2518,11 @@
     else
       rev_num = 2;
 
+    /* prime the pump by finding the next unused magic rev,
+     * if none are found, it should return the initial rev_num value.
+     */
+    rev_num = findnextmagicrev (rcs, rev, rev_num);
+    
     /* only look at even numbered branches */
     for ( ; ; rev_num += 2)
     {
@@ -9242,3 +9249,61 @@
     }
     return CVSname;
 }
+
+/*
+ * Go through the symbolic tag list, find the next unused magic
+ * branch revision.
+ *
+ * Returns defaultrev if it can't figure anything out, then the caller
+ * will end up doing a linear search.
+ */
+static int findnextmagicrev_dots;
+static int
+findnextmagicrev (RCSNode *rcs, char *rev, int defaultrv)
+{
+    int rv = defaultrv;
+
+    /* Tell the walklist proc how many dots we're looking for,
+     * which is the number of dots in the existing rev, plus
+     * 2.  one for RCS_MAGIC_BRANCH and one for the new rev number.
+     */
+    findnextmagicrev_dots = numdots (rev) + 2;
+  
+    /* walk the symbols list to find the highest revision. */
+    walklist (RCS_symbols (rcs), findhighestmagicrev_proc, &rv);
+
+    /* adjust to next even number if we found something */
+    if (rv != defaultrv)
+    {
+       if ((rv % 2) != 0)
+           rv++;
+       else
+           rv += 2;
+    }
+
+    return rv;
+}
+
+/*
+ * walklist proc to find the highest magic rev with
+ * the required number of dots.
+ */
+static int
+findhighestmagicrev_proc (Node *p, void *closure)
+{
+    int *rev = closure;
+
+    if (numdots (p->data) == findnextmagicrev_dots)
+    {
+       /* if the last term of the rev is greater than the current
+          max, update */
+       char *cp = strrchr (p->data, '.');
+       if ((cp != NULL) && (cp[1] != 0))
+       {
+           int new_rev = atoi (cp + 1);
+           if (new_rev > *rev)
+               *rev = new_rev;
+       }
+    }
+    return 1;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]