gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r18709 - gnunet/src/statistics


From: gnunet
Subject: [GNUnet-SVN] r18709 - gnunet/src/statistics
Date: Tue, 20 Dec 2011 00:01:04 +0100

Author: grothoff
Date: 2011-12-20 00:01:03 +0100 (Tue, 20 Dec 2011)
New Revision: 18709

Modified:
   gnunet/src/statistics/statistics_api.c
Log:
-properly use DLL apis where appropriate

Modified: gnunet/src/statistics/statistics_api.c
===================================================================
--- gnunet/src/statistics/statistics_api.c      2011-12-19 22:35:19 UTC (rev 
18708)
+++ gnunet/src/statistics/statistics_api.c      2011-12-19 23:01:03 UTC (rev 
18709)
@@ -856,7 +856,6 @@
 {
   struct GNUNET_STATISTICS_GetHandle *pos;
   struct GNUNET_STATISTICS_GetHandle *next;
-  struct GNUNET_STATISTICS_GetHandle *prev;
   struct GNUNET_TIME_Relative timeout;
   int i;
 
@@ -879,36 +878,23 @@
         h->current = NULL;
       }
     }
-    pos = h->action_head;
-    prev = NULL;
-    while (pos != NULL)
+    next = h->action_head; 
+    while (NULL != (pos = next))
     {
       next = pos->next;
       if (pos->type == ACTION_GET)
       {
-        if (prev == NULL)
-          h->action_head = next;
-        else
-          prev->next = next;
+       GNUNET_CONTAINER_DLL_remove (h->action_head,
+                                    h->action_tail,
+                                    pos);
         free_action_item (pos);
       }
-      else
-      {
-        prev = pos;
-      }
-      pos = next;
     }
-    h->action_tail = prev;
-    if (h->current == NULL)
-    {
-      h->current = h->action_head;
-      if (h->action_head != NULL)
-      {
-        h->action_head = h->action_head->next;
-        if (h->action_head == NULL)
-          h->action_tail = NULL;
-      }
-    }
+    if ( (NULL == h->current) &&
+        (NULL != (h->current = h->action_head)) )
+      GNUNET_CONTAINER_DLL_remove (h->action_head,
+                                  h->action_tail,
+                                  h->current);
     h->do_destroy = GNUNET_YES;
     if ((h->current != NULL) && (h->th == NULL))
     {
@@ -928,7 +914,7 @@
       }
     }
     if (h->th != NULL)
-      return;
+      return; /* do not finish destruction just yet */
   }
   while (NULL != (pos = h->action_head))
   {




reply via email to

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