From 17903940c5d356cb0bfb44d26bce422ec2ec06f6 Mon Sep 17 00:00:00 2001 From: Zhenhua Zhang Date: Thu, 29 Oct 2009 01:22:06 +0800 Subject: Refactor: Move & Rename functions to atutil.c Move and rename call_compare and call_compare_by_status to atutil.c. These will be utilized by other drivers, including hfpmodem. --- drivers/atmodem/atutil.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'drivers/atmodem/atutil.c') diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c index 5d9ceb85..578522f6 100644 --- a/drivers/atmodem/atutil.c +++ b/drivers/atmodem/atutil.c @@ -55,3 +55,29 @@ void decode_at_error(struct ofono_error *error, const char *final) error->error = 0; } } + +gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b) +{ + const struct ofono_call *call = a; + int status = GPOINTER_TO_INT(b); + + if (status != call->status) + return 1; + + 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; +} + -- cgit v1.2.3