cvs-cvs
[Top][All Lists]
Advanced

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

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


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog hash.c
Date: Thu, 18 Sep 2008 16:49:08 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     08/09/18 16:49:08

Modified files:
        src            : ChangeLog hash.c 

Log message:
        * hash.c (walklist): Make it OK for callback procs to delete the node
        they were passed.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3597&r2=1.3598
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/hash.c?cvsroot=cvs&r1=1.55&r2=1.56

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3597
retrieving revision 1.3598
diff -u -b -r1.3597 -r1.3598
--- ChangeLog   17 Sep 2008 19:53:28 -0000      1.3597
+++ ChangeLog   18 Sep 2008 16:49:07 -0000      1.3598
@@ -1,3 +1,8 @@
+2008-09-18  Derek R. Price  <address@hidden>
+
+       * hash.c (walklist): Make it OK for callback procs to delete the node
+       they were passed.
+
 2008-09-17  Derek R. Price  <address@hidden>
 
        * add.c (add), client.c (call_in_directory, update_entries,

Index: hash.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/hash.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- hash.c      17 Sep 2008 19:53:29 -0000      1.55
+++ hash.c      18 Sep 2008 16:49:08 -0000      1.56
@@ -413,6 +413,9 @@
  * Walk LIST, calling PROC for each node in LIST and preserving CLOSURE.  Does
  * nothing when LIST is NULL or empty.
  *
+ * NOTES
+ *   It is okay for PROC to call `delnode (P)'.
+ *
  * RETURNS
  *   The sum total of each of the integers returned by all calls to PROC.
  */
@@ -428,8 +431,13 @@
     if (!list) return 0;
 
     head = list->list;
-    for (p = head->next; p != head; p = p->next)
+    p = head->next;
+    while (p != head)
+    {
+       Node *next = p->next;
        err += proc (p, closure);
+       p = next;
+    }
     return err;
 }
 




reply via email to

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