Re: [PATCHv3 04/12] call-forwarding: Refactor cf_find_unconditional()

2012-03-21 Thread Oleg Zhurakivskyy

Hello Denis,

On 03/21/2012 01:51 AM, Denis Kenzior wrote:

+#define cf_find_unconditional(_cf) \
+({ \
+   cf_find((_cf)->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL],\
+   BEARER_CLASS_VOICE);\
+})
+


Actually I'd prefer if we made this an inline function rather than a
macro.  A bit easier to read that way.


Sure, strongly agree. I was going to do this myself, it just didn't make it into 
these patches.


Regards,
Oleg
--
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCHv3 04/12] call-forwarding: Refactor cf_find_unconditional()

2012-03-20 Thread Denis Kenzior
On 03/13/2012 08:46 AM, Oleg Zhurakivskyy wrote:
> Re-use cf_find() instead.
> ---
>  src/call-forwarding.c |   28 ++--
>  1 files changed, 6 insertions(+), 22 deletions(-)
> 
> diff --git a/src/call-forwarding.c b/src/call-forwarding.c
> index 5a2ab28..b1a1a72 100644
> --- a/src/call-forwarding.c
> +++ b/src/call-forwarding.c
> @@ -44,6 +44,12 @@
>  
>  #define CFC(_x) ((struct ofono_call_forwarding_condition *)(_x))
>  
> +#define cf_find_unconditional(_cf)   \
> +({   \
> + cf_find((_cf)->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL],\
> + BEARER_CLASS_VOICE);\
> +})
> +

Actually I'd prefer if we made this an inline function rather than a
macro.  A bit easier to read that way.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv3 04/12] call-forwarding: Refactor cf_find_unconditional()

2012-03-13 Thread Oleg Zhurakivskyy
Re-use cf_find() instead.
---
 src/call-forwarding.c |   28 ++--
 1 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 5a2ab28..b1a1a72 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -44,6 +44,12 @@
 
 #define CFC(_x) ((struct ofono_call_forwarding_condition *)(_x))
 
+#define cf_find_unconditional(_cf) \
+({ \
+   cf_find((_cf)->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL],\
+   BEARER_CLASS_VOICE);\
+})
+
 #define is_cfu_enabled(_cf)\
 ({ \
cf_find_unconditional(_cf) ? TRUE : FALSE;  \
@@ -188,28 +194,6 @@ static void sim_cphs_cff_update_cb(int ok, void *data)
ofono_info("Failed to update EFcphs-cff");
 }
 
-static struct ofono_call_forwarding_condition *cf_find_unconditional(
-   struct ofono_call_forwarding *cf)
-{
-   GSList *l = cf->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL];
-   struct ofono_call_forwarding_condition *cond;
-
-   /*
-* For now we only support Voice, although Fax & all Data
-* basic services are applicable as well.
-*/
-   for (; l; l = l->next) {
-   cond = l->data;
-
-   if (cond->cls > BEARER_CLASS_VOICE)
-   continue;
-
-   return cond;
-   }
-
-   return NULL;
-}
-
 static void sim_set_cf_indicator(struct ofono_call_forwarding *cf)
 {
struct ofono_call_forwarding_condition *cfu_voice =
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono