[PATCH 2/2] Refactor release_with_status

Zhenhua Zhang zhenhua.zhang at intel.com
Mon Nov 16 02:21:08 PST 2009


release_with_status is rewritten based on previous patch to remove
the released call from the list.
---
 drivers/hfpmodem/voicecall.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index d12cd4c..2f52f51 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -161,27 +161,18 @@ static void release_all_calls(struct
ofono_voicecall *vc)
 static void release_with_status(struct ofono_voicecall *vc, int status)
 {
 	struct voicecall_data *vd = ofono_voicecall_get_data(vc);
-	GSList *p = NULL;
 	GSList *c = vd->calls;
 	struct ofono_call *call;
 
 	while (c) {
 		call = c->data;
 
-		if (call->status != status) {
-			p = c;
-			c = c->next;
-			continue;
-		}
-
-		release_call(vc, call);
+		if (call->status == status) {
+			release_call(vc, call);
 
-		if (p)
-			p->next = c->next;
-		else
-			vd->calls = c->next;
-
-			g_slist_free_1(c);
+			c = vd->calls;
+		} else
+			c = c->next;
 	}
 }
 
-- 
1.6.2.5





More information about the ofono mailing list