pidgin: 9a78b258: Minor cleanups.

qulogic at pidgin.im qulogic at pidgin.im
Fri May 21 18:04:06 EDT 2010


-----------------------------------------------------------------
Revision: 9a78b258014365b50e88b15d780432ef8411388e
Ancestor: fce2d42be089680f91f3bc1cf6e12a8922c2e04d
Author: qulogic at pidgin.im
Date: 2010-04-11T05:53:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9a78b258014365b50e88b15d780432ef8411388e

Modified files:
        libpurple/protocols/msn/directconn.c

ChangeLog: 

Minor cleanups.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/directconn.c	083d110a65a8e2dcbb3b5ba18df08832ade7fbf3
+++ libpurple/protocols/msn/directconn.c	83ba274df72d4e0a8fea9458051fa5b387b3ac8a
@@ -94,8 +94,7 @@ msn_dc_destroy_packet(MsnDirectConnPacke
 static void
 msn_dc_destroy_packet(MsnDirectConnPacket *p)
 {
-	if (p->data)
-		g_free(p->data);
+	g_free(p->data);
 
 	if (p->msg)
 		msn_message_unref(p->msg);
@@ -647,7 +646,7 @@ msn_dc_send_handshake(MsnDirectConn *dc)
 {
 	MsnDirectConnPacket *p;
 	const gchar *h;
-	guint32 l;
+	guint32 len;
 
 	g_return_if_fail(dc != NULL);
 
@@ -656,9 +655,8 @@ msn_dc_send_handshake(MsnDirectConn *dc)
 	p->length = 4 + DC_PACKET_HEADER_SIZE;
 	p->data = g_malloc(p->length);
 
-	l = DC_PACKET_HEADER_SIZE;
-	l = GUINT32_TO_LE(l);
-	memcpy(p->data, &l, 4);
+	len = GUINT32_TO_LE(DC_PACKET_HEADER_SIZE);
+	memcpy(p->data, &len, 4);
 
 	dc->header.session_id = 0;
 	dc->header.id = dc->slpcall->slplink->slp_seq_id++;
@@ -679,7 +677,7 @@ msn_dc_send_handshake_reply(MsnDirectCon
 {
 	MsnDirectConnPacket *p;
 	const gchar *h;
-	guint32 l;
+	guint32 len;
 
 	g_return_if_fail(dc != NULL);
 
@@ -688,9 +686,8 @@ msn_dc_send_handshake_reply(MsnDirectCon
 	p->length = 4 + DC_PACKET_HEADER_SIZE;
 	p->data = g_malloc(p->length);
 
-	l = DC_PACKET_HEADER_SIZE;
-	l = GUINT32_TO_LE(l);
-	memcpy(p->data, &l, 4);
+	len = GUINT32_TO_LE(DC_PACKET_HEADER_SIZE);
+	memcpy(p->data, &len, 4);
 
 	dc->header.id = dc->slpcall->slplink->slp_seq_id++;
 	dc->header.length = 0;
@@ -724,8 +721,7 @@ msn_dc_enqueue_msg(MsnDirectConn *dc, Ms
 	memcpy(p->data + 4 + DC_PACKET_HEADER_SIZE, msg->body, msg->body_len);
 
 	p->sent_cb = msn_dc_send_packet_cb;
-	p->msg = msg;
-	msn_message_ref(msg);
+	p->msg = msn_message_ref(msg);
 
 	msn_dc_enqueue_packet(dc, p);
 }
@@ -739,16 +735,15 @@ msn_dc_process_packet(MsnDirectConn *dc,
 	case DC_STATE_CLOSED:
 		break;
 
-	case DC_STATE_FOO: {
+	case DC_STATE_FOO:
 		/* FOO message is always 4 bytes long */
 		if (packet_length != 4 || memcmp(dc->in_buffer, "\4\0\0\0foo", 8) != 0)
 			return DC_PROCESS_FALLBACK;
 
 		dc->state = DC_STATE_HANDSHAKE;
 		break;
-		}
 
-	case DC_STATE_HANDSHAKE: {
+	case DC_STATE_HANDSHAKE:
 		if (packet_length != DC_PACKET_HEADER_SIZE)
 			return DC_PROCESS_FALLBACK;
 
@@ -759,7 +754,6 @@ msn_dc_process_packet(MsnDirectConn *dc,
 		msn_slpcall_session_init(dc->slpcall);
 		dc->slpcall = NULL;
 		break;
-		}
 
 	case DC_STATE_HANDSHAKE_REPLY:
 		/* TODO: Check! */


More information about the Commits mailing list