Explorar el Código

BPending: use LinkedList1 instead of LinkedList2

ambrop7 hace 15 años
padre
commit
1f5176a841
Se han modificado 2 ficheros con 14 adiciones y 14 borrados
  1. 11 11
      system/BPending.c
  2. 3 3
      system/BPending.h

+ 11 - 11
system/BPending.c

@@ -29,7 +29,7 @@
 void BPendingGroup_Init (BPendingGroup *g)
 void BPendingGroup_Init (BPendingGroup *g)
 {
 {
     // init jobs list
     // init jobs list
-    LinkedList2_Init(&g->jobs);
+    LinkedList1_Init(&g->jobs);
     
     
     // init pending counter
     // init pending counter
     DebugCounter_Init(&g->pending_ctr);
     DebugCounter_Init(&g->pending_ctr);
@@ -41,7 +41,7 @@ void BPendingGroup_Init (BPendingGroup *g)
 void BPendingGroup_Free (BPendingGroup *g)
 void BPendingGroup_Free (BPendingGroup *g)
 {
 {
     DebugCounter_Free(&g->pending_ctr);
     DebugCounter_Free(&g->pending_ctr);
-    ASSERT(LinkedList2_IsEmpty(&g->jobs))
+    ASSERT(LinkedList1_IsEmpty(&g->jobs))
     DebugObject_Free(&g->d_obj);
     DebugObject_Free(&g->d_obj);
 }
 }
 
 
@@ -49,21 +49,21 @@ int BPendingGroup_HasJobs (BPendingGroup *g)
 {
 {
     DebugObject_Access(&g->d_obj);
     DebugObject_Access(&g->d_obj);
     
     
-    return !LinkedList2_IsEmpty(&g->jobs);
+    return !LinkedList1_IsEmpty(&g->jobs);
 }
 }
 
 
 void BPendingGroup_ExecuteJob (BPendingGroup *g)
 void BPendingGroup_ExecuteJob (BPendingGroup *g)
 {
 {
-    ASSERT(!LinkedList2_IsEmpty(&g->jobs))
+    ASSERT(!LinkedList1_IsEmpty(&g->jobs))
     DebugObject_Access(&g->d_obj);
     DebugObject_Access(&g->d_obj);
     
     
     // get a job
     // get a job
-    LinkedList2Node *node = LinkedList2_GetLast(&g->jobs);
+    LinkedList1Node *node = LinkedList1_GetLast(&g->jobs);
     BPending *p = UPPER_OBJECT(node, BPending, pending_node);
     BPending *p = UPPER_OBJECT(node, BPending, pending_node);
     ASSERT(p->pending)
     ASSERT(p->pending)
     
     
     // remove from jobs list
     // remove from jobs list
-    LinkedList2_Remove(&g->jobs, &p->pending_node);
+    LinkedList1_Remove(&g->jobs, &p->pending_node);
     
     
     // set not pending
     // set not pending
     p->pending = 0;
     p->pending = 0;
@@ -77,7 +77,7 @@ BPending * BPendingGroup_PeekJob (BPendingGroup *g)
 {
 {
     DebugObject_Access(&g->d_obj);
     DebugObject_Access(&g->d_obj);
     
     
-    LinkedList2Node *node = LinkedList2_GetLast(&g->jobs);
+    LinkedList1Node *node = LinkedList1_GetLast(&g->jobs);
     if (!node) {
     if (!node) {
         return NULL;
         return NULL;
     }
     }
@@ -109,7 +109,7 @@ void BPending_Free (BPending *o)
     
     
     // remove from jobs list
     // remove from jobs list
     if (o->pending) {
     if (o->pending) {
-        LinkedList2_Remove(&o->g->jobs, &o->pending_node);
+        LinkedList1_Remove(&o->g->jobs, &o->pending_node);
     }
     }
 }
 }
 
 
@@ -119,11 +119,11 @@ void BPending_Set (BPending *o)
     
     
     // remove from jobs list
     // remove from jobs list
     if (o->pending) {
     if (o->pending) {
-        LinkedList2_Remove(&o->g->jobs, &o->pending_node);
+        LinkedList1_Remove(&o->g->jobs, &o->pending_node);
     }
     }
     
     
     // insert to jobs list
     // insert to jobs list
-    LinkedList2_Append(&o->g->jobs, &o->pending_node);
+    LinkedList1_Append(&o->g->jobs, &o->pending_node);
     
     
     // set pending
     // set pending
     o->pending = 1;
     o->pending = 1;
@@ -135,7 +135,7 @@ void BPending_Unset (BPending *o)
     
     
     if (o->pending) {
     if (o->pending) {
         // remove from jobs list
         // remove from jobs list
-        LinkedList2_Remove(&o->g->jobs, &o->pending_node);
+        LinkedList1_Remove(&o->g->jobs, &o->pending_node);
         
         
         // set not pending
         // set not pending
         o->pending = 0;
         o->pending = 0;

+ 3 - 3
system/BPending.h

@@ -28,7 +28,7 @@
 #define BADVPN_SYSTEM_BPENDING_H
 #define BADVPN_SYSTEM_BPENDING_H
 
 
 #include <misc/debugcounter.h>
 #include <misc/debugcounter.h>
-#include <structure/LinkedList2.h>
+#include <structure/LinkedList1.h>
 #include <system/DebugObject.h>
 #include <system/DebugObject.h>
 
 
 /**
 /**
@@ -46,7 +46,7 @@ typedef void (*BPending_handler) (void *user);
  * Object that contains a list of jobs pending execution.
  * Object that contains a list of jobs pending execution.
  */
  */
 typedef struct {
 typedef struct {
-    LinkedList2 jobs;
+    LinkedList1 jobs;
     DebugCounter pending_ctr;
     DebugCounter pending_ctr;
     DebugObject d_obj;
     DebugObject d_obj;
 } BPendingGroup;
 } BPendingGroup;
@@ -59,7 +59,7 @@ typedef struct {
     BPending_handler handler;
     BPending_handler handler;
     void *user;
     void *user;
     int pending;
     int pending;
-    LinkedList2Node pending_node;
+    LinkedList1Node pending_node;
     DebugObject d_obj;
     DebugObject d_obj;
 } BPending;
 } BPending;