diff options
-rw-r--r-- | gril/gril.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/gril/gril.c b/gril/gril.c index ead82062..d279c449 100644 --- a/gril/gril.c +++ b/gril/gril.c @@ -420,48 +420,36 @@ static gboolean node_check_destroyed(struct ril_notify_node *node, static void handle_unsol_req(struct ril_s *p, struct ril_msg *message) { - GHashTableIter iter; struct ril_notify *notify; - int req_key; - gpointer key, value; - GList *list_item; - struct ril_notify_node *node; - gboolean found = FALSE; if (p->notify_list == NULL) return; p->in_notify = TRUE; - g_hash_table_iter_init(&iter, p->notify_list); + notify = g_hash_table_lookup(p->notify_list, &message->req); + if (notify != NULL) { + GSList *list_item; - while (g_hash_table_iter_next(&iter, &key, &value)) { - req_key = *((int *)key); - notify = value; - - if (req_key != message->req) - continue; + for (list_item = notify->nodes; list_item; + list_item = g_slist_next(list_item)) { + struct ril_notify_node *node = list_item->data; - list_item = (GList *) notify->nodes; - - while (list_item != NULL) { - node = list_item->data; + if (node->destroyed) + continue; node->callback(message, node->user_data); - found = TRUE; - list_item = (GList *) g_slist_next(list_item); } - } - - /* Only log events not being listended for... */ - if (!found) + } else { + /* Only log events not being listended for... */ DBG("RIL Event slot %d: %s\n", p->slot, unsol_request_to_string(p, message->req)); + } p->in_notify = FALSE; /* Now destroy nodes possibly removed by callbacks */ - if (found) + if (notify != NULL) ril_unregister_all(p, FALSE, node_check_destroyed, GUINT_TO_POINTER(TRUE)); } |