Don't use g_slist_length to check for empty lists.
PATCH 2/4 Don't use g_slist_length to check for empty lists.
A glib Anti-pattern according to http://www.burtonini.com/blog
--- src/voicecall.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
src/voicecall.c +3 -3
@@ -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 ; }
Signature · 1 line
1.6.1
Hi,
Quoted 1 line
A glib Anti-pattern according to http://www.burtonini.com/blog
Patch has been applied.
Regards,
-Denis