return 0;
}
+unsigned int at_util_alloc_next_id(unsigned int *id_list)
+{
+ unsigned int i;
+
+ for (i = 1; i < sizeof(unsigned int) * 8; i++) {
+ if (*id_list & (1 << i))
+ continue;
+
+ *id_list |= (1 << i);
+ return i;
+ }
+
+ return 0;
+}
+
+void at_util_release_id(unsigned int *id_list, unsigned int id)
+{
+ *id_list &= ~(1 << id);
+}
+
void dump_response(const char *func, gboolean ok, GAtResult *result);
gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b);
gint at_util_call_compare(gconstpointer a, gconstpointer b);
+unsigned int at_util_alloc_next_id(unsigned int *id_list);
+void at_util_release_id(unsigned int *id_list, unsigned int id);
struct cb_data {
void *cb;
}
}
-static unsigned int alloc_next_id(struct voicecall_data *d)
-{
- unsigned int i;
-
- for (i = 1; i < sizeof(d->id_list) * 8; i++) {
- if (d->id_list & (0x1 << i))
- continue;
-
- d->id_list |= (0x1 << i);
- return i;
- }
-
- return 0;
-}
-
-static void release_id(struct voicecall_data *d, unsigned int id)
-{
- d->id_list &= ~(0x1 << id);
-}
-
static struct ofono_call *create_call(struct voicecall_data *d, int type,
int direction, int status,
const char *num, int num_type, int clip)
if (!call)
return NULL;
- call->id = alloc_next_id(d);
+ call->id = at_util_alloc_next_id(&d->id_list);
call->type = type;
call->direction = direction;
call->status = status;
ofono_voicecall_disconnected(vc, oc->id,
reason, NULL);
- release_id(vd, oc->id);
+ at_util_release_id(&vd->id_list, oc->id);
o = o->next;
} else if (nc && (!oc || (nc->id < oc->id))) {