changeset 24568:6b9552b09de0

Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the resource string.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sat, 29 Nov 2008 23:53:50 +0000
parents cff5d920b87f
children 491bf0159ecb
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sat Nov 29 23:35:12 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat Nov 29 23:53:50 2008 +0000
@@ -153,6 +153,9 @@
 	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));