All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] Don't use g_slist_length to check for empty lists.
@ 2009-07-30  8:05 Andrzej Zaborowski
  2009-07-31 14:58 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Andrzej Zaborowski @ 2009-07-30  8:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

A glib Anti-pattern according to http://www.burtonini.com/blog
---
 src/voicecall.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 409d97a..b343ed6 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -897,7 +897,7 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,
 	if (!calls->ops->release_specific)
 		return dbus_gsm_not_implemented(msg);
 
-	if (g_slist_length(calls->call_list) == 0) {
+	if (calls->call_list == NULL) {
 		DBusMessage *reply = dbus_message_new_method_return(msg);
 		return reply;
 	}
@@ -1009,7 +1009,7 @@ static DBusMessage *multiparty_hangup(DBusConnection *conn,
 	if (!calls->ops->release_all_active)
 		return dbus_gsm_not_implemented(msg);
 
-	if (g_slist_length(calls->multiparty_list) == 0) {
+	if (calls->multiparty_list == NULL) {
 		DBusMessage *reply = dbus_message_new_method_return(msg);
 		return reply;
 	}
@@ -1362,7 +1362,7 @@ static void multirelease_callback(const struct ofono_error *error, void *data)
 	DBusConnection *conn = dbus_gsm_connection();
 	DBusMessage *reply;
 
-	if (g_slist_length(calls->release_list)) {
+	if (calls->release_list != NULL) {
 		voicecalls_release_next(modem);
 		return;
 	}
-- 
1.6.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-31 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30  8:05 [PATCH 2/4] Don't use g_slist_length to check for empty lists Andrzej Zaborowski
2009-07-31 14:58 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.