pidgin/pidgin

Remove some unnecessary NULL checks.

2021-01-23, Elliott Sales de Andrade
447c01698e1c
Parents b317bb7479e5
Children 645607090674
Remove some unnecessary NULL checks.

* When removing a buddy, the group is optional as noted in the description.
* When setting a buddy icon, the icon may be %NULL to remove existing icons.

Testing Done:
Compile and watch for assertion failures in the log, when signing out of Bonjour, and when removing a buddy icon from an account (which did nothing.)

Reviewed at https://reviews.imfreedom.org/r/445/
--- a/libpurple/purpleprotocolserver.c Sat Jan 23 20:26:48 2021 -0600
+++ b/libpurple/purpleprotocolserver.c Sat Jan 23 20:28:06 2021 -0600
@@ -206,7 +206,6 @@
g_return_if_fail(PURPLE_IS_PROTOCOL_SERVER(protocol_server));
g_return_if_fail(PURPLE_IS_CONNECTION(connection));
g_return_if_fail(PURPLE_IS_BUDDY(buddy));
- g_return_if_fail(PURPLE_IS_GROUP(group));
iface = PURPLE_PROTOCOL_SERVER_GET_IFACE(protocol_server);
if(iface != NULL && iface->remove_buddy != NULL) {
@@ -333,7 +332,6 @@
g_return_if_fail(PURPLE_IS_PROTOCOL_SERVER(protocol_server));
g_return_if_fail(PURPLE_IS_CONNECTION(connection));
- g_return_if_fail(PURPLE_IS_IMAGE(img));
iface = PURPLE_PROTOCOL_SERVER_GET_IFACE(protocol_server);
if(iface != NULL && iface->set_buddy_icon != NULL) {
--- a/libpurple/purpleprotocolserver.h Sat Jan 23 20:26:48 2021 -0600
+++ b/libpurple/purpleprotocolserver.h Sat Jan 23 20:28:06 2021 -0600
@@ -274,7 +274,7 @@
* @protocol_server: The #PurpleProtocolServer instance.
* @connection: The #PurpleConnection instance.
* @buddy: The #PurpleBuddy instance.
- * @group: The #PurpleGroup instance.
+ * @group: (nullable): The #PurpleGroup instance.
*
* Removes @buddy and potentially @group from the server side list of contacts.
*
@@ -372,7 +372,7 @@
* purple_protocol_server_set_buddy_icon:
* @protocol_server: The #PurpleProtocolServer instance.
* @connection: The #PurpleConnection instance.
- * @img: The #PurpleImage instance.
+ * @img: (nullable): The #PurpleImage instance, or %NULL to unset the icon.
*
* Sets the user's buddy icon to @img.
*