[evolution-ews] Change e_ews_autodiscover_ws_url to accept const gchar * instead of gchar * arguments



commit 823c1515de847f528e53a955dd106b20dc218124
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Tue May 17 13:50:17 2011 +0530

    Change e_ews_autodiscover_ws_url to accept const gchar * instead of gchar * arguments

 .../exchange-ews-account-setup.c                   |    6 +++---
 src/server/e-ews-connection.c                      |    7 +------
 src/server/e-ews-connection.h                      |    4 ++--
 3 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-ews-account-setup.c b/src/account-setup-eplugin/exchange-ews-account-setup.c
index cfe97ea..6930e63 100644
--- a/src/account-setup-eplugin/exchange-ews-account-setup.c
+++ b/src/account-setup-eplugin/exchange-ews-account-setup.c
@@ -112,7 +112,7 @@ validate_credentials (GtkWidget *widget, struct _AutoDiscCallBackData *cbdata)
 	EConfig *config = cbdata->config;
 	EMConfigTargetAccount *target_account = (EMConfigTargetAccount *)(config->target);
 	CamelURL *url = NULL;
-	gchar *key, *password;
+	gchar *key, *password = NULL;
 
 	url = camel_url_new (e_account_get_string (target_account->account, E_ACCOUNT_SOURCE_URL), NULL);
 
@@ -133,14 +133,14 @@ validate_credentials (GtkWidget *widget, struct _AutoDiscCallBackData *cbdata)
 	/*Can there be a account without password ?*/
 	if (password && *password) {
 		e_ews_autodiscover_ws_url (autodiscover_callback, cbdata->entry,
-					   g_strdup(target_account->account->id->address),
+					   target_account->account->id->address,
 					   password);
 	} else {
 		e_passwords_forget_password (EXCHANGE_EWS_PASSWORD_COMPONENT, key);
 		e_notice (NULL, GTK_MESSAGE_ERROR, "%s", _("Authentication failed."));
-		g_free (password);
 	}
 
+	g_free (password);
 	g_free (key);
 	camel_url_free (url);
 }
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index b96558d..b60e98e 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1122,7 +1122,7 @@ e_ews_autodiscover_ws_msg(EEwsConnection *cnc, gchar *url,
 
 void
 e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
-			   gchar *email, gchar *password)
+			   const gchar *email, const gchar *password)
 {
 	struct _autodiscover_data *ad;
 	xmlOutputBuffer *buf;
@@ -1157,8 +1157,6 @@ e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
 	cnc = e_ews_connection_new (url, email, password, NULL, NULL, &error);
 	if (!cnc) {
 	err:
-		g_free (email);
-		g_free (password);
 		cb (NULL, cbdata, error);
 		return;
 	}
@@ -1193,9 +1191,6 @@ e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
 
 	g_object_unref (cnc); /* the GSimpleAsyncResult holds it now */
 
-	g_free (email);
-	g_free (password);
-
 	xmlOutputBufferClose (buf);
 	xmlFreeDoc (doc);
 }
diff --git a/src/server/e-ews-connection.h b/src/server/e-ews-connection.h
index 849d59a..e8764a6 100644
--- a/src/server/e-ews-connection.h
+++ b/src/server/e-ews-connection.h
@@ -89,8 +89,8 @@ void		e_ews_connection_authenticate	(EEwsConnection *cnc,
 typedef void (*EEwsAutoDiscoverCallback) (char *url, gpointer user_data, GError *error);
 void		e_ews_autodiscover_ws_url	(EEwsAutoDiscoverCallback cb,
 						 gpointer cbdata,
-						 gchar *email,
-						 gchar *password);
+						 const gchar *email,
+						 const gchar *password);
 void		e_ews_connection_set_mailbox	(EEwsConnection *cnc,
 						 const gchar *email);
 /* Sync folder items */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]