pidgin: 1f2fc8a0: Avoid needlessly calling gethostname() i...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Nov 29 19:00:46 EST 2008


-----------------------------------------------------------------
Revision: 1f2fc8a0af00fe7a38dfd8b1cced6e89ae7da540
Ancestor: d6dcc1a4c4c210ef92876374958ac4e4cb237c05
Author: rekkanoryo at pidgin.im
Date: 2008-11-29T23:53:50
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1f2fc8a0af00fe7a38dfd8b1cced6e89ae7da540

Modified files:
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
resource string.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	ececcbdd7b75e6d939abd56355ac85694d240078
+++ libpurple/protocols/jabber/jabber.c	236721f932fe5b0928bb1dbe80dad09828c7987c
@@ -153,6 +153,9 @@ static char *jabber_prep_resource(char *
 	if (*input == '\0')
 		return NULL;
 
+	if (strstr(input, "__HOSTNAME__") == NULL)
+		return input;
+
 	/* Replace __HOSTNAME__ with hostname */
 	if (gethostname(hostname, sizeof(hostname) - 1)) {
 		purple_debug_warning("jabber", "gethostname: %s\n", g_strerror(errno));


More information about the Commits mailing list