replaces at_util_call_compare (atmodem) and
call_compare (rild).
---
drivers/atmodem/atutil.c | 17 ++---------------
drivers/atmodem/atutil.h | 1 -
drivers/atmodem/voicecall.c | 2 +-
drivers/hfpmodem/voicecall.c | 2 +-
drivers/huaweimodem/voicecall.c | 2 +-
drivers/ifxmodem/voicecall.c | 2 +-
drivers/rilmodem/voicecall.c | 16 +---------------
drivers/stemodem/voicecall.c | 2 +-
src/common.c | 14 ++++++++++++++
src/common.h | 2 ++
10 files changed, 24 insertions(+), 36 deletions(-)
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 14873483..1a48b606 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -31,6 +31,7 @@
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/log.h>
#include <ofono/types.h>
+#include "../src/common.h"
#include "atutil.h"
#include "vendor.h"
@@ -101,20 +102,6 @@ gint at_util_call_compare_by_id(gconstpointer a,
gconstpointer b)
return 0;
}
-gint at_util_call_compare(gconstpointer a, gconstpointer b)
-{
- const struct ofono_call *ca = a;
- const struct ofono_call *cb = b;
-
- if (ca->id < cb->id)
- return -1;
-
- if (ca->id > cb->id)
- return 1;
-
- return 0;
-}
-
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *ret_mpty_ids)
{
GAtResultIter iter;
@@ -173,7 +160,7 @@ GSList *at_util_parse_clcc(GAtResult *result, unsigned int
*ret_mpty_ids)
else
call->clip_validity = 2;
- l = g_slist_insert_sorted(l, call, at_util_call_compare);
+ l = g_slist_insert_sorted(l, call, ofono_call_compare);
if (mpty)
mpty_ids |= 1 << id;
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 5cb88b78..95e09900 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -54,7 +54,6 @@ void decode_at_error(struct ofono_error *error, const char
*final);
gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b);
gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b);
gint at_util_call_compare_by_id(gconstpointer a, gconstpointer b);
-gint at_util_call_compare(gconstpointer a, gconstpointer b);
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *mpty_ids);
gboolean at_util_parse_reg(GAtResult *result, const char *prefix,
int *mode, int *status,
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index e4c59c26..6fee39bc 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -132,7 +132,7 @@ static struct ofono_call *create_call(struct
ofono_voicecall *vc, int type,
call->clip_validity = clip;
call->cnap_validity = CNAP_VALIDITY_NOT_AVAILABLE;
- d->calls = g_slist_insert_sorted(d->calls, call, at_util_call_compare);
+ d->calls = g_slist_insert_sorted(d->calls, call, ofono_call_compare);
return call;
}
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index ffdf4b7b..1a282903 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -128,7 +128,7 @@ static struct ofono_call *create_call(struct
ofono_voicecall *vc, int type,
call->phone_number.type = num_type;
}
- d->calls = g_slist_insert_sorted(d->calls, call, at_util_call_compare);
+ d->calls = g_slist_insert_sorted(d->calls, call, ofono_call_compare);
call->clip_validity = clip;
diff --git a/drivers/huaweimodem/voicecall.c b/drivers/huaweimodem/voicecall.c
index f55568d3..0887f652 100644
--- a/drivers/huaweimodem/voicecall.c
+++ b/drivers/huaweimodem/voicecall.c
@@ -76,7 +76,7 @@ static struct ofono_call *create_call(struct ofono_voicecall
*vc, int type,
call->clip_validity = clip;
- d->calls = g_slist_insert_sorted(d->calls, call, at_util_call_compare);
+ d->calls = g_slist_insert_sorted(d->calls, call, ofono_call_compare);
return call;
}
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index 45b5ca42..581a7906 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -107,7 +107,7 @@ static struct ofono_call *create_call(struct
ofono_voicecall *vc, int type,
call->clip_validity = clip;
- d->calls = g_slist_insert_sorted(d->calls, call, at_util_call_compare);
+ d->calls = g_slist_insert_sorted(d->calls, call, ofono_call_compare);
return call;
}
diff --git a/drivers/rilmodem/voicecall.c b/drivers/rilmodem/voicecall.c
index b7180b90..f248d871 100644
--- a/drivers/rilmodem/voicecall.c
+++ b/drivers/rilmodem/voicecall.c
@@ -117,20 +117,6 @@ done:
ofono_voicecall_disconnected(vc, reqdata->id, reason, NULL);
}
-static int call_compare(gconstpointer a, gconstpointer b)
-{
- const struct ofono_call *ca = a;
- const struct ofono_call *cb = b;
-
- if (ca->id < cb->id)
- return -1;
-
- if (ca->id > cb->id)
- return 1;
-
- return 0;
-}
-
static void clcc_poll_cb(struct ril_msg *message, gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
@@ -209,7 +195,7 @@ static void clcc_poll_cb(struct ril_msg *message, gpointer
user_data)
call->id, call->status, call->type,
call->phone_number.number, call->name);
- calls = g_slist_insert_sorted(calls, call, call_compare);
+ calls = g_slist_insert_sorted(calls, call, ofono_call_compare);
}
no_calls:
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
index 356ab7c6..19276111 100644
--- a/drivers/stemodem/voicecall.c
+++ b/drivers/stemodem/voicecall.c
@@ -128,7 +128,7 @@ static struct ofono_call *create_call(struct
ofono_voicecall *vc, int type,
call->clip_validity = clip;
- d->calls = g_slist_insert_sorted(d->calls, call, at_util_call_compare);
+ d->calls = g_slist_insert_sorted(d->calls, call, ofono_call_compare);
return call;
}
diff --git a/src/common.c b/src/common.c
index 17d1d58a..75bb94dc 100644
--- a/src/common.c
+++ b/src/common.c
@@ -736,3 +736,17 @@ void ofono_call_init(struct ofono_call *call)
call->cnap_validity = CNAP_VALIDITY_NOT_AVAILABLE;
call->clip_validity = CLIP_VALIDITY_NOT_AVAILABLE;
}
+
+gint ofono_call_compare(gconstpointer a, gconstpointer b)
+{
+ const struct ofono_call *ca = a;
+ const struct ofono_call *cb = b;
+
+ if (ca->id < cb->id)
+ return -1;
+
+ if (ca->id > cb->id)
+ return 1;
+
+ return 0;
+}
diff --git a/src/common.h b/src/common.h
index 05f2a851..46bae577 100644
--- a/src/common.h
+++ b/src/common.h
@@ -184,3 +184,5 @@ const char *registration_tech_to_string(int tech);
const char *packet_bearer_to_string(int bearer);
gboolean is_valid_apn(const char *apn);
+
+gint ofono_call_compare(gconstpointer a, gconstpointer b);
--
2.13.3
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono