pidgin: 47dce238: There's no need to call purple_xfer_get_...

qulogic at pidgin.im qulogic at pidgin.im
Wed Dec 23 03:47:05 EST 2009


-----------------------------------------------------------------
Revision: 47dce238cde8f3b3ca9141a97caa4ca1ad5378f8
Ancestor: 127846902276c5c3eb716c87088a6cad91c75f1a
Author: qulogic at pidgin.im
Date: 2009-12-23T05:15:17
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/47dce238cde8f3b3ca9141a97caa4ca1ad5378f8

Modified files:
        libpurple/ft.c

ChangeLog: 

There's no need to call purple_xfer_get_type() repeatedly.

-------------- next part --------------
============================================================
--- libpurple/ft.c	faa1f0186de8858511255fddb6866f7af73c3035
+++ libpurple/ft.c	eb31098f7f52ccd0df1ee19b298328daf44be937
@@ -268,14 +268,16 @@ purple_xfer_choose_file_ok_cb(void *user
 purple_xfer_choose_file_ok_cb(void *user_data, const char *filename)
 {
 	PurpleXfer *xfer;
+	PurpleXferType type;
 	struct stat st;
 	gchar *dir;
 
 	xfer = (PurpleXfer *)user_data;
+	type = purple_xfer_get_type(xfer);
 
 	if (g_stat(filename, &st) != 0) {
 		/* File not found. */
-		if (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) {
+		if (type == PURPLE_XFER_RECEIVE) {
 #ifndef _WIN32
 			int mode = W_OK;
 #else
@@ -300,16 +302,14 @@ purple_xfer_choose_file_ok_cb(void *user
 			purple_xfer_request_denied(xfer);
 		}
 	}
-	else if ((purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) &&
-			 (st.st_size == 0)) {
+	else if ((type == PURPLE_XFER_SEND) && (st.st_size == 0)) {
 
 		purple_notify_error(NULL, NULL,
 						  _("Cannot send a file of 0 bytes."), NULL);
 
 		purple_xfer_request_denied(xfer);
 	}
-	else if ((purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) &&
-			 S_ISDIR(st.st_mode)) {
+	else if ((type == PURPLE_XFER_SEND) && S_ISDIR(st.st_mode)) {
 		/*
 		 * XXX - Sending a directory should be valid for some protocols.
 		 */
@@ -318,8 +318,7 @@ purple_xfer_choose_file_ok_cb(void *user
 
 		purple_xfer_request_denied(xfer);
 	}
-	else if ((purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) &&
-			 S_ISDIR(st.st_mode)) {
+	else if ((type == PURPLE_XFER_RECEIVE) && S_ISDIR(st.st_mode)) {
 		char *msg, *utf8;
 		utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
 		msg = g_strdup_printf(


More information about the Commits mailing list