diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2013-01-21 16:30:22 +0100 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2013-01-21 09:41:54 -0600 |
commit | 9726e50d82e292e2be68d65d63d1e955055480a1 (patch) | |
tree | 445b31f68ecb63b87960f48bef566d1ad9121378 /drivers/hfpmodem | |
parent | abb54f4aa5811792ecdb775def88b7286641463f (diff) | |
download | ofono-9726e50d82e292e2be68d65d63d1e955055480a1.tar.bz2 |
hfpmodem: Refactor voicecall notify with foreach
Define a helper function in order to use foreach statements when
ofono_voicecall_notify() needs to be called.
Diffstat (limited to 'drivers/hfpmodem')
-rw-r--r-- | drivers/hfpmodem/voicecall.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c index 505601cb..97700596 100644 --- a/drivers/hfpmodem/voicecall.c +++ b/drivers/hfpmodem/voicecall.c @@ -91,6 +91,14 @@ static GSList *find_dialing(GSList *calls) return c; } +static void voicecall_notify(gpointer value, gpointer user) +{ + struct ofono_call *call = value; + struct ofono_voicecall *vc = user; + + ofono_voicecall_notify(vc, call); +} + static struct ofono_call *create_call(struct ofono_voicecall *vc, int type, int direction, int status, const char *num, int num_type, int clip) @@ -1029,15 +1037,13 @@ static void hfp_clcc_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_voicecall *vc = user_data; struct voicecall_data *vd = ofono_voicecall_get_data(vc); - GSList *l; if (!ok) return; vd->calls = at_util_parse_clcc(result); - for (l = vd->calls; l; l = l->next) - ofono_voicecall_notify(vc, l->data); + g_slist_foreach(vd->calls, voicecall_notify, vc); } static void hfp_voicecall_initialized(gboolean ok, GAtResult *result, |