diff src/ft.c @ 6269:0a902bd3e170

[gaim-migrate @ 6766] I'm going to be boiled alive for this.. Changing gaim_xfers_get_local_system_ip() to use a static buffer that it returns instead of a g_strdup()'d copy of the buffer... but that's rarely of use, because I don't think the IP will be changing often enough where this will screw up code :P Also, fixed a function's name, because I broke compiling again. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 22 Jul 2003 08:22:08 +0000
parents 084e1f6610a8
children 16fcc379e484
line wrap: on
line diff
--- a/src/ft.c	Tue Jul 22 08:12:08 2003 +0000
+++ b/src/ft.c	Tue Jul 22 08:22:08 2003 +0000
@@ -45,7 +45,7 @@
 	xfer->who     = g_strdup(who);
 	xfer->ui_ops  = gaim_get_xfer_ui_ops();
 
-	xfer->local_ip = gaim_xfers_get_ip_for_account(account);
+	xfer->local_ip = g_strdup(gaim_xfers_get_ip_for_account(account));
 
 	ui_ops = gaim_xfer_get_ui_ops(xfer);
 
@@ -723,13 +723,13 @@
 	return ip;
 }
 
-char *
+const char *
 gaim_xfers_get_local_system_ip(void)
 {
 	struct hostent *host;
 	char localhost[129];
 	long unsigned add;
-	char ip[46];
+	static char ip[46];
 
 	if (gethostname(localhost, 128) < 0)
 		return NULL;
@@ -742,18 +742,18 @@
 
 	g_snprintf(ip, 11, "%lu", add);
 
-	return g_strdup(ip);
+	return ip;
 }
 
-char *
+const char *
 gaim_xfers_get_ip_for_account(const GaimAccount *account)
 {
 	g_return_val_if_fail(account != NULL, NULL);
 
 	if (gaim_account_get_public_ip(account) != NULL)
-		return g_strdup(gaim_account_get_public_ip(account));
+		return gaim_account_get_public_ip(account);
 	else if (gaim_xfers_get_local_ip() != NULL)
-		return g_strdup(gaim_xfers_get_local_ip());
+		return gaim_xfers_get_local_ip();
 	else
 		return gaim_xfers_get_local_system_ip();
 }