pidgin/pidgin

Fix rest of clang scan-build warnings

2014-04-03, Tomasz Wasilczyk
adeb081c2224
Parents e55fd1866f11
Children ecf3b04c3cc2
Fix rest of clang scan-build warnings
--- a/libpurple/protocols/zephyr/Zinternal.c Thu Apr 03 18:54:36 2014 +0200
+++ b/libpurple/protocols/zephyr/Zinternal.c Thu Apr 03 19:07:20 2014 +0200
@@ -524,15 +524,17 @@
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 @@
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;
--- a/libpurple/protocols/zephyr/zephyr.c Thu Apr 03 18:54:36 2014 +0200
+++ b/libpurple/protocols/zephyr/zephyr.c Thu Apr 03 19:07:20 2014 +0200
@@ -1436,7 +1436,6 @@
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%")) {
--- a/libpurple/prpl.h Thu Apr 03 18:54:36 2014 +0200
+++ b/libpurple/prpl.h Thu Apr 03 19:07:20 2014 +0200
@@ -652,8 +652,8 @@
};
#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) \