Re: [RFC 1/4] network: __ofono_netreg_registration_status internal api

2011-01-12 Thread Denis Kenzior
Hi Jeevaka,

On 01/10/2011 03:43 AM, Jeevaka Badrappan wrote:
 ---
  src/network.c |8 
  src/ofono.h   |2 ++
  2 files changed, 10 insertions(+), 0 deletions(-)
 
 diff --git a/src/network.c b/src/network.c
 index eb0f797..640391d 100644
 --- a/src/network.c
 +++ b/src/network.c
 @@ -1864,3 +1864,11 @@ void *ofono_netreg_get_data(struct ofono_netreg 
 *netreg)
  {
   return netreg-driver_data;
  }
 +
 +int __ofono_netreg_registration_status(struct ofono_netreg *netreg)
 +{
 + if (netreg == NULL)
 + return NETWORK_REGISTRATION_STATUS_UNKNOWN;
 +

For internal API I suggest skipping the NULL check.  I'd rather see us
crash early.

 + return netreg-status;
 +}
 diff --git a/src/ofono.h b/src/ofono.h
 index cab70cd..91f737f 100644
 --- a/src/ofono.h
 +++ b/src/ofono.h
 @@ -375,6 +375,8 @@ gboolean __ofono_netreg_remove_status_watch(struct 
 ofono_netreg *netreg,
  void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
   const char *name);
  
 +int __ofono_netreg_registration_status(struct ofono_netreg *netreg);
 +

Please name this __ofono_netreg_get_registration_status

  #include ofono/history.h
  
  void __ofono_history_probe_drivers(struct ofono_modem *modem);

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


[RFC 1/4] network: __ofono_netreg_registration_status internal api

2011-01-10 Thread Jeevaka Badrappan
---
 src/network.c |8 
 src/ofono.h   |2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/network.c b/src/network.c
index eb0f797..640391d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1864,3 +1864,11 @@ void *ofono_netreg_get_data(struct ofono_netreg *netreg)
 {
return netreg-driver_data;
 }
+
+int __ofono_netreg_registration_status(struct ofono_netreg *netreg)
+{
+   if (netreg == NULL)
+   return NETWORK_REGISTRATION_STATUS_UNKNOWN;
+
+   return netreg-status;
+}
diff --git a/src/ofono.h b/src/ofono.h
index cab70cd..91f737f 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -375,6 +375,8 @@ gboolean __ofono_netreg_remove_status_watch(struct 
ofono_netreg *netreg,
 void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
const char *name);
 
+int __ofono_netreg_registration_status(struct ofono_netreg *netreg);
+
 #include ofono/history.h
 
 void __ofono_history_probe_drivers(struct ofono_modem *modem);
-- 
1.7.0.4

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