/pidgin/main: adeb081c2224: Fix rest of clang scan-build warnings

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu Apr 3 13:07:28 EDT 2014


Changeset: adeb081c22241928732b7987fd9337f653f4b1d0
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-03 19:07 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/adeb081c2224

Description:

Fix rest of clang scan-build warnings

diffstat:

 libpurple/protocols/zephyr/Zinternal.c |  20 ++++++++++++--------
 libpurple/protocols/zephyr/zephyr.c    |   1 -
 libpurple/prpl.h                       |   4 ++--
 3 files changed, 14 insertions(+), 11 deletions(-)

diffs (72 lines):

diff --git a/libpurple/protocols/zephyr/Zinternal.c b/libpurple/protocols/zephyr/Zinternal.c
--- a/libpurple/protocols/zephyr/Zinternal.c
+++ b/libpurple/protocols/zephyr/Zinternal.c
@@ -524,15 +524,17 @@ Code_t Z_AddNoticeToEntry(qptr, notice, 
 		hole = hole->next;
 	    }
 	    if (lasthole) {
-		if (!(lasthole->next = (struct _Z_Hole *)
-		      malloc(sizeof(struct _Z_InputQ))))
+		struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ));
+		if (!inputq)
 		    return (ENOMEM);
+		lasthole->next = (struct _Z_Hole *)inputq;
 		hole = lasthole->next;
 	    }
 	    else {
-		if (!(qptr->holelist = (struct _Z_Hole *)
-		      malloc(sizeof(struct _Z_InputQ))))
+		struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ));
+		if (!inputq)
 		    return (ENOMEM);
+		qptr->holelist = (struct _Z_Hole *)inputq;
 		hole = qptr->holelist;
 	    }
 	    hole->next = NULL;
@@ -548,15 +550,17 @@ Code_t Z_AddNoticeToEntry(qptr, notice, 
 		hole = hole->next;
 	    }
 	    if (lasthole) {
-		if (!(lasthole->next = (struct _Z_Hole *)
-		      malloc(sizeof(struct _Z_InputQ))))
+		struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ));
+		if (!inputq)
 		    return (ENOMEM);
+		lasthole->next = (struct _Z_Hole *)inputq;
 		hole = lasthole->next;
 	    }
 	    else {
-		if (!(qptr->holelist = (struct _Z_Hole *)
-		      malloc(sizeof(struct _Z_InputQ))))
+		struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ));
+		if (!inputq)
 		    return (ENOMEM);
+		qptr->holelist = (struct _Z_Hole *)inputq;
 		hole = qptr->holelist;
 	    }
 	    hole->next = (struct _Z_Hole *) 0;
diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c
--- a/libpurple/protocols/zephyr/zephyr.c
+++ b/libpurple/protocols/zephyr/zephyr.c
@@ -1436,7 +1436,6 @@ static void process_zsubs(zephyr_account
 					char *tmp = g_strdup_printf("%s", zephyr->username);
 					char *atptr;
 
-					z_instance = triple[1];
 					if (triple[2] == NULL) {
 						recip = g_malloc0(1);
 					} else if (!g_ascii_strcasecmp(triple[2], "%me%")) {
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -652,8 +652,8 @@ struct _PurplePluginProtocolInfo
 };
 
 #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \
-	(G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size && \
-	 prpl->member != NULL)
+	((prpl != NULL) && (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < \
+	prpl->struct_size && prpl->member != NULL))
 
 
 #define PURPLE_IS_PROTOCOL_PLUGIN(plugin) \



More information about the Commits mailing list